#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:


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 20 months ago by ftputiluser

  • Resolution set to invalid
  • Status changed from new to closed

"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 20 months ago by ftputiluser (previous) (diff)

comment:2 Changed 20 months ago by ftputiluser

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:3 Changed 20 months ago by schwa

  • Status changed from reopened to new

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 18 months ago by schwa

  • Keywords isfile isdir path normalization added
  • Milestone set to 3.4
  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.