#113 closed defect (fixed)

isdir fails because of trailing forward slash

Reported by: ftputiluser Owned by: schwa
Priority: major Milestone: 3.4
Component: Library Version: 3.3.1
Keywords: isfile isdir path normalization Cc:

Description

I believe there is a bug in lines 134 and 155 of path.py. The lines I'm talking about are of the form

if path == self._host.getcwd():

the error is that (at least) in some cases _host.getcwd() returns the path with a trailing forward slash while path may not have a trailing slash, that makes the comparison

u'/somepath' == u'/somepath/'

fail when it shouldn't.

I think paths should be normalized before comparing.

Change History (4)

comment:1 Changed 21 months ago by ftputiluser

Resolution: invalid
Status: newclosed

"Apparently the error only appeared as a consequence of the LIST -a command failing. When I set the use_list_a_option to False it does not manifest."

I rushed into this. Sorry, the error is still there even with use_list_a_option set to False

Last edited 21 months ago by ftputiluser (previous) (diff)

comment:2 Changed 21 months ago by ftputiluser

Resolution: invalid
Status: closedreopened

comment:3 Changed 21 months ago by schwa

Status: reopenednew

Thanks a lot for your report! :-)

Although not strictly necessary, it would be great if you had a working code example that shows the bug.

comment:4 Changed 20 months ago by schwa

Keywords: isfile isdir path normalization added
Milestone: 3.4
Resolution: fixed
Status: newclosed

Fixed in commits [b4c9b089b6b8] and [4027740cdd2d].

Note: See TracTickets for help on using tickets.