[Python-bugs-list] normpath error (PR#93)

jmrober1@ingr.com jmrober1@ingr.com
Mon, 4 Oct 1999 17:05:45 -0400 (EDT)


Hmmm, I see your reasoning.

But what if (and I have not run this yet) the test path is
d:\\\data/test\\test.dlf?
By using this function I am saying I cannot gaurantee what the input will
look like.

Looking at that loop, i would expect,
d:\\\data\test\test.dlf
since each pass adds a os.sep to the drive part after the split

a drive letter + ':' IS a detectable situation and could be handled and 
would not upset a UNC type path of just plain \\data\test\test.dlf

Thanks,
Joe Robertson
256-730-8216
jmrober1@ingr.com
jmrobert@ro.com
http://ro.com/~jmrobert/
"Does my reputation precede me...or was I too fast for it?"
Captain Zap Brannagan,
Futurama


> -----Original Message-----
> From:	Guido van Rossum [SMTP:guido@CNRI.Reston.VA.US]
> Sent:	Monday, October 04, 1999 3:24 PM
> To:	Robertson, Joseph M
> Cc:	python-bugs-list@python.org; bugs-py@python.org
> Subject:	Re: [Python-bugs-list] normpath error (PR#93)
> 
> > File: posixpath.py and ntpath.py
> > Method: normpath
> > Problem: initial multiple slashes are not collapsed
> > 
> > I traced to ntpath.py because I am using WindowsNT 4.0, 
> > but I believe that the same error will occur under POSIX.
> > 
> > Using a path such as:
> >     d://data\testdlf/test.dlf
> > for a test input I discovered that slashes were converted 
> > except for the first 2.
> > 
> > So I ended up with: 
> >     d://data/test/test.dlf
> > 
> > Making this change to the ntpath.py file fixed this issue.
> > os.sep is being added for each iteration of the loop.
> 
> This is actually a feature.  When there is no drive letter, Windows
> (as well as some Unix versions) has a different interpretation for a
> double leading (back)slash.
> 
> Some experimentation with NT 4.0 learns that (at least on that system)
> if a drive letter is followed by a double backslash, the drive letter
> is ignored -- while a double backslash elsewhere in a filename is
> treated the same as a single.
> 
> I can't say that I understand the wisdom of these rules, but they are
> standard NT, and I prefer not to try to "improve" upon it.
> 
> --Guido van Rossum (home page: http://www.python.org/~guido/)