[Python-bugs-list] [ python-Bugs-456621 ] normpath on Win32 not collapsing c:\..

noreply@sourceforge.net noreply@sourceforge.net
Wed, 29 Aug 2001 14:55:17 -0700


Bugs item #456621, was opened at 2001-08-29 11:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456621&group_id=5470

Category: Extension Modules
>Group: Platform-specific
>Status: Open
Resolution: Rejected
Priority: 5
Submitted By: Paul Spencer (pgs)
Assigned to: Tim Peters (tim_one)
Summary: normpath on Win32 not collapsing c:\..

Initial Comment:
normpath as implemented in ntpath.py doesn't collapse 
c:\.. at all, resulting in paths that are not 
normalized.  Adding the following to ntpath.py fixes 
this, but since I don't know how to create a context 
diff, its probably not patch quality code :)

elseif comps[i] == '..' and i == 0:
  del comps[i]

and put this before the final else.

Cheers.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-08-29 14:55

Message:
Logged In: YES 
user_id=31435

Hmm -- I was running on a command.com box.  I'm surprised 
(and appalled <wink>) if the cmd.exe used by Win2K differs 
in this respect from the one used by NT.  Maybe it actually 
has to do with the filesystem?  I was running FAT32, and 
there is no ".." entry in the root there; perhaps there is 
under NTFS (but I can't check that right now).

Reopening pending more info.

----------------------------------------------------------------------

Comment By: Paul Spencer (pgs)
Date: 2001-08-29 13:55

Message:
Logged In: YES 
user_id=52126

Sorry, I should have been more specific.  Your example does 
work on Win2K, just not on win9x or WinNT.  I know under 
*nix that the parent of the root directory is the root 
directory, perhaps Microsoft has modified the command 
processor under 2K to be more '*nix' like.  I'll certainly 
abide by your decision since I have found another 
workaround to my problem which avoids this situation in any 
case, but it is os specific now, which is unfortunate.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-08-29 12:30

Message:
Logged In: YES 
user_id=31435

Since c:\.. is a senseless path (you can't go above the 
root!), I think changing it to a legal path would be wrong.

C:\>dir c:\..

 Volume in drive C is HOMEDRIVE
 Volume Serial Number is 2637-18E7
Invalid directory

C:\>dir ..

 Volume in drive C is HOMEDRIVE
 Volume Serial Number is 2637-18E7
Invalid directory

C:\>cd c:\..
Invalid directory

C:\>

Garbage in, garbage out, so rejecting this feature request.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456621&group_id=5470