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

SourceForge.net noreply at sourceforge.net
Sun Jul 11 00:59:41 CEST 2004


Bugs item #930024, was opened at 2004-04-05 13:59
Message generated for change (Comment added) made by bcannon
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: Closed
>Resolution: Fixed
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't be followed.


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

>Comment By: Brett Cannon (bcannon)
Date: 2004-07-10 15:59

Message:
Logged In: YES 
user_id=357491

Applied as rev. 1.67 in 2.4a2 and rev. 1.62.6.2 in 2.3.5 with only minor 
cleanup.

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

Comment By: A.M. Kuchling (akuchling)
Date: 2004-06-05 11:58

Message:
Logged In: YES 
user_id=11375

Patch attached; review requested.


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

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