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

Robertson, Joseph M jmrober1@ingr.com
Mon, 4 Oct 1999 16:05:41 -0500

Hmmm, I see your reasoning.

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

Looking at that loop, i would expect,
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

Joe Robertson
"Does my reputation precede me...or was I too fast for it?"
Captain Zap Brannagan,

> -----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/)