classification
Title: os.path.normpath leading '//'
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
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")
'//usr/bin'
>>> os.path.normpath("///usr/bin")
'/usr/bin'
>>> os.path.normpath("//./usr/bin")
'//usr/bin'
msg13184 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-11-14 03:39
Logged In: YES 
user_id=33168

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 
user_id=555

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
sequences)?

This document (link below) says "Application developers
should avoid generating pathnames that start with "//".
Implementations are strongly encouraged to avoid using this
special interpretation..."

http://64.233.167.104/search?q=cache:DY5cJbmtg7QJ:www.opengroup.org/onlinepubs/009695399/xrat/xbd_chap04.html+posix+path+double+initial+slash&hl=en
msg13186 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-09-29 05:11
Logged In: YES 
user_id=33168

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
(python-list@python.org).  It's probably not appropriate for
python-dev.
History
Date User Action Args
2002-11-11 16:00:59carpaskicreate