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.

classification
Title: os.path.realpath() cannot handle symlinks
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, georg.brandl, isandler, rhettinger
Priority: normal Keywords:

Created on 2005-06-03 00:33 by isandler, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
realpath-fix-diff georg.brandl, 2005-06-03 07:58
realpath-testcase-diff georg.brandl, 2005-06-03 08:17
Messages (5)
msg25478 - (view) Author: Ilya Sandler (isandler) Date: 2005-06-03 00:33
To reproduce:

Create a link, say to /tmp:

  bagira:~/python> ls -l xxx
  lrwxrwxrwx    1 ilya     ilya            4 2005-06-02
17:09 xxx -> /tmp/

And now:
 
  bagira:~/python> python2.4
  Python 2.4.1 (#2, May  5 2005, 11:32:06) 
  [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
  Type "help", "copyright", "credits" or "license" for
more    
   information.
   >>> import os.path
   >>> os.path.realpath("xxx")
   '/home/ilya/python/xxx'

I'd expect realpath() to return "/tmp"

Note: This bug was reported earlier (e.g bug  990669)
but it was closed as fixed

msg25479 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-03 07:58
Logged In: YES 
user_id=1188172

Confirmed. Only occurs when the symlink is the first
directory part of the argument. Attaching fix, assigning to
Raymond to check in.
msg25480 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-03 08:17
Logged In: YES 
user_id=1188172

Attaching new test case for this problem.
msg25481 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-06-03 11:27
Logged In: YES 
user_id=80475

Run the full testsuite, then
go ahead an apply the patch.
Be sure to add an entry to Misc/NEWS.

msg25482 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-03 14:32
Logged In: YES 
user_id=1188172

Fixed, thanks for the report.

Lib/posixpath.py r1.74 r1.73.2.1
Lib/test/test_posixpath.py r1.13 r1.12.2.1
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 42049
2005-06-03 00:33:46isandlercreate