Title: os.path.normpath leading '//'
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: carpaski, mkc, nnorwitz
Priority: normal Keywords:

Created on 2002-11-11 16:00 by carpaski, last changed 2005-09-29 05:11 by nnorwitz. This issue is now closed.

Messages (4)
msg13183 - (view) Author: Nicholas Jones (carpaski) Date: 2002-11-11 16:00
normpath does not remove leading double slashes. (Linux)
Python 2.2.1 (#1, Oct 30 2002, 19:46:40)

>>> import os.path
>>> os.path.normpath("//usr/bin")
>>> os.path.normpath("///usr/bin")
>>> os.path.normpath("//./usr/bin")
msg13184 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-11-14 03:39
Logged In: YES 

This is the intent of the code.  The comment says:
    # POSIX allows one or two initial slashes, but treats
three or more
    # as single slash.

Therefore, I'm closing this as Invalid.
msg13185 - (view) Author: Mike Coleman (mkc) Date: 2005-09-28 19:11
Logged In: YES 

Nonetheless, keeping an initial double slash renders this
function useless for its expected purpose.  If this cannot
be fixed outright, could be add a flag (with doc) to provide
the expected behavior (i.e., squish all multiple slash

This document (link below) says "Application developers
should avoid generating pathnames that start with "//".
Implementations are strongly encouraged to avoid using this
special interpretation..."
msg13186 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-09-29 05:11
Logged In: YES 

I am not an expert in this area by any means.  You are
welcome to submit a patch to modify the current behaviour. 
I don't know if the patch is likely to be accepted.  You can
also bring this issue up on comp.lang.python
(  It's probably not appropriate for
Date User Action Args
2002-11-11 16:00:59carpaskicreate