Message164090
| Author |
o11c |
| Recipients |
o11c |
| Date |
2012年06月26日.19:03:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1340737442.15.0.365871986623.issue15196@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I encountered this bug with the following filesystem layout
project/build/bin/main-gdb.py -> ../src/main-gdb.py
project/build/src -> ../src/
project/src/main-gdb.py -> ../py/main-gdb.py
project/py/main-gdb.py
where root/py/main-gdb.py contains
import os
print(os.path.realpath(__file__))
Actual Result:
project/build/py/main-gdb.py
instead of
project/py/main-gdb.py
The cause of this bug is the fact that os.path._resolve_link calls os.path.normpath, which is not symlink-safe.
Specically, this is bad:
os.path.normpath('project/build/src/../py/main-gdb.py')
The correct thing to do is never call normpath; instead leave .. components and pop off the last element after ensuring that the preceding directory is not a symlink.
This bug seems pretty severe to me, because it prevents imports from working.
Exact python --version and Debian package versions:
Python 2.6.7 (2.6.7-4)
Python 2.7.3rc2 (2.7.3~rc2-2.1)
Python 3.2.3 (3.2.3-1) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年06月26日 19:04:02 | o11c | set | recipients:
+ o11c |
| 2012年06月26日 19:04:02 | o11c | set | messageid: <1340737442.15.0.365871986623.issue15196@psf.upfronthosting.co.za> |
| 2012年06月26日 19:04:01 | o11c | link | issue15196 messages |
| 2012年06月26日 19:03:59 | o11c | create |
|