This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iszegedi
Recipients
Date 2007-05-08.12:50:16
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I agree with the approach that josm suggested. That is a reasonable way to get the fix approved or declined.

To response to the remarks from siemer:

1 - 2./ I think what we miss here is the exact definition what path normalization means. All examples that I have seen so far - including the comments in the posixpath python module as well - are about removing redundant information or extra dots and double dots from the path (e.g. A//B, A/./B and A/foo/../B all become A/B). I have not seen any precise definition how to deal with trailing slash in a pathname (except for the one that I copy&pasted from POSIX standard). 
That says explicitly that "a pathname ... SHALL BE RESOLVED as if a single dot .. were appended". 

Nevertheless, I can accept that since it is not implemented neither in regular UNIX shell utilities nor in C system libraries, we may opt for a "common sense solution" meaning that 

os.path.normpath('/etc/passwd/')  -->  '/etc/passwd/'


In fact, this is pretty simple to implement as I have already given an example; the original proposal needs to be modified by one character only:

Instead of adding '/.' to the end of the path, just add a '/': 

# The next two lines were added by iszegedi
    if trailing_slash:
        path = path + '/'



3./ path = path.rstrip()
This doesn't remove any significant whitespaces from the pathname, as far as I see. It only removes the trailing whitespaces from the pathname, the rest is going to stay as is. An example:

In the current posixpath module, if you use spaces at the end of the pathname string, it will be displayed like:

os.path.normpath('/etc/password/   ')   --->  '/etc/passwd/    '

if we use rstrip() as suggested, then the result would be:

os.path.normpath('/etc/password/   ')   --->  '/etc/passwd/'

which makes more sense to me.

But for instance:

os.path.normpath('/etc/   /passwd/')   ---> '/etc/   /passwd/'


Istvan
History
Date User Action Args
2007-08-23 14:53:26adminlinkissue1707768 messages
2007-08-23 14:53:26admincreate