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 akima
Recipients akima, eryksun, pitrou, serhiy.storchaka, steve.dower
Date 2014-09-05.20:50:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409950253.32.0.784780667477.issue22302@psf.upfronthosting.co.za>
In-reply-to
Content
As eryksun pointed out, I created this bug report to report on one issue; that \\server\share isn't being consider absolute by os.path.isabs when it should be considered absolute.

I found this bug when I was writing a basic config file parsing module.  One of the options in the config (named log_dir) required an absolute path to a directory where my program could dump log files.  It has to be absolute because the working directory of the program changes.  A user entered a path \\pollux\logs as the log_dir value in their config file and my program rejected it informing the user that it wasn't absolute (because I checked the path using isabs).  I've worked around this bug in my program, but it is clearly a problem that needs fixing.

Steve: with regard to what isabs should return when given the string r"\\server": does it really matter whether it returns True or False?  As you said; \\server isn't a real path.  It's invalid.  If you ask python if it's absolute (using os.path.isabs) and you expect a boolean response, no matter whether the response is True or False, the response will be meaningless.  Consider this:

Python 3.2.3 (default, Feb 27 2014, 21:31:18) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.isabs("&monkeyfart!££")
False
>>> 

I just asked isabs if "&monkeyfart!££" was absolute and it told me it's not an absolute path, it's relative!  It's infact, not even a path.  There is no "os.path.isrelative" function.  If we want to know if a path is relative we use the isabs function and decide the path is relative if the result is False.  If you give the function a junk-string which isn't even a path (eg \\server  or  &monkeyfart!££ ) then you can only expect a junk response.  If we decide that all invalid paths provide to isabs should return False then what we are saying is all invalid paths provided to isabs should be considered relative paths.  What use is that to anyone?  Really, the programmer should ensure that the path is valid before trying to find out if it's relative or absolute.

To summarize: I think it's important that isabs works correctly when given a *valid* path (like \\server\share).  When it's given a string which is an invalid path (like \\server), its behaviour should be undefined.
History
Date User Action Args
2014-09-05 20:50:53akimasetrecipients: + akima, pitrou, serhiy.storchaka, eryksun, steve.dower
2014-09-05 20:50:53akimasetmessageid: <1409950253.32.0.784780667477.issue22302@psf.upfronthosting.co.za>
2014-09-05 20:50:53akimalinkissue22302 messages
2014-09-05 20:50:52akimacreate