[Patches] [ python-Patches-941486 ] Fx for bug 940578 (glob.glob on broken symlinks)

SourceForge.net noreply at sourceforge.net
Sat Apr 24 17:25:55 EDT 2004


Patches item #941486, was opened at 2004-04-24 23:23
Message generated for change (Comment added) made by cben
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=941486&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Cherniavsky Beni (cben)
Assigned to: Nobody/Anonymous (nobody)
>Summary: Fx for bug 940578 (glob.glob on broken symlinks)

Initial Comment:
This does minimal changes to fix the bug.
It implements a function similar to `os.path.exists()`
but using
`os.lstat()` that doesn't fail on broken symlinks. 
This function would more properly belong in `posix`. 
This patch is good if you want to avoid API changes,
e.g. for backporting the fix.
Test case and doc fix (to make the behavior on broken
symlinks clear) are included.


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

>Comment By: Cherniavsky Beni (cben)
Date: 2004-04-25 00:25

Message:
Logged In: YES 
user_id=36166

The second patch, glob-pathfix.diff, does the right thing by
adding `lexists` to `os.path` - it has no less right to be
there than `exists`.
It's implemented with `os.lstat()` in `posixpath`, alias to
`exists` in other `*path` modules.  **Please verify that
this is sufficient - it seems that no other platfrom has a
`os.lstat` that is not equivallent to `os.stat` but I can't
be sure.**

The glob.py bugfix then is a trivial  change from
``os.path.exists``
to ``os.path.lexists``.
Testcases and doc additions included.


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

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



More information about the Patches mailing list