[ python-Bugs-930024 ] os.path.realpath can't handle symlink loops

SourceForge.net noreply at sourceforge.net
Mon Apr 5 16:59:41 EDT 2004


Bugs item #930024, was opened at 2004-04-05 16:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=930024&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: A.M. Kuchling (akuchling)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.realpath can't handle symlink loops

Initial Comment:
Create a symlink pointing to itself:

ln -s infinite infinite

Run os.path.realpath() on it, and it recurses
infinitely (until the stack limit is hit):

>>> import os
>>> os.path.realpath('/home/amk/infinite')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/posixpath.py", line 416, in
realpath
    return realpath(newpath)

os.path.realpath() should be fixed; /home/amk/infinite
is a perfectly good path, though it can&#039;t be followed.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=930024&group_id=5470



More information about the Python-bugs-list mailing list