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 ibshields
Recipients ibshields
Date 2013-01-06.04:25:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357446315.42.0.750501561867.issue16877@psf.upfronthosting.co.za>
In-reply-to
Content
Filespecs that start with ~ are not properly handled by os.path.realpath or os.path.abspath (and maybe other functions). Following console output from Fedora 17 using Puthon 3.2 illustrates the issue. Similar issue in 2.7
[ian@attic4 developerworks]$ cd ..
[ian@attic4 ~]$ mkdir testpath
[ian@attic4 ~]$ cd testpath
[ian@attic4 testpath]$ pwd
/home/ian/testpath
[ian@attic4 testpath]$ python3
Python 3.2.3 (default, Jun  8 2012, 05:36:09) 
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.abspath("~")
'/home/ian/testpath/~'
>>> os.path.realpath("~/xxx/zzz")
'/home/ian/testpath/~/xxx/zzz'
>>> os.path.abspath("~/..")
'/home/ian/testpath'

Function should probably use expanduser to determine if path is already absolute. Documentation at http://docs.python.org/3/library/os.path.html is also misleading as this is not how these functions work if given an absolute path to start with.
History
Date User Action Args
2013-01-06 04:25:15ibshieldssetrecipients: + ibshields
2013-01-06 04:25:15ibshieldssetmessageid: <1357446315.42.0.750501561867.issue16877@psf.upfronthosting.co.za>
2013-01-06 04:25:15ibshieldslinkissue16877 messages
2013-01-06 04:25:14ibshieldscreate