[Python-Dev] Re: os.path.commonprefix breakage

Thomas Wouters thomas@xs4all.net
Thu, 17 Aug 2000 09:09:42 +0200


On Thu, Aug 17, 2000 at 04:28:19PM +1200, Greg Ewing wrote:

> given platform -- e.g Unix doesn't care whether there's a
> trailing slash on a pathname.

Bzzzt. This is unfortunately not true. Observe:

daemon2:~/python > mkdir perl
daemon2:~/python > rm perl/
rm: perl/: is a directory
daemon2:~/python > rmdir perl/
rmdir: perl/: Is a directory
daemon2:~/python > rm -rf perl/
rm: perl/: Is a directory
daemon2:~/python > su
# rmdir perl/
rmdir: perl/: Is a directory
# rm -rf perl/
rm: perl/: Is a directory
# ^D
daemon2:~/python > rmdir perl
daemon2:~/python >

Note that the trailing slash is added by all tab-completing shells that I
know. And the problem *really* is that trailing slash, I shit you not.
Needless to say, every one of us ran into this at one time or another, and
spent an hour figuring out *why* the rmdir wouldn't remove a directory.

Consequently, I'm all for removing trailing slashes, but not enough to break
existing code. I wonder howmuch breakage there really is, though.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!