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.

Author rvisser
Recipients rvisser
Date 2021-04-12.05:24:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618205085.71.0.310776377701.issue43810@roundup.psfhosted.org>
In-reply-to
Content
According to the python documentation os.path.abspath() does *not* resolve symbolic links. This however does not always seem to be true causing an invalid path return by abspath. This could potentially be exploited to crash python applications.

Example for bug reproduction on a linux terminal:
1. create a sub-directory "bug_abspath"
2. enter the sub-dir "bug_abspath"
3. create a symbolic link "local_link" onto the current dir using: "ln -s . local_link"
4. open python session and import os and enter the following:
5. path_correct = os.path.abspath('./../bug_abspath')  # returns correct path
6. path_invalid = os.path.abspath('local_link/../bug_abspath')  # returns invalid path with wrongly resolved "local_link"

From step 5 the correct/valid path is returned, from step 6 abspath returns an invalid path that is non-existing (contains non-existing "bug_abspath/bug_abspath" string. 
I consider this behavior incorrect and interpret it as a bug in the abspath routine which is not allowed to resolve the symbolic link "local_link".
(Note os.path.realpath works as expected but is unwanted by me).

Tested on
OS: linux ubuntu 20.04, CentOS 7.8
PY: python 3.7 and 3.8

Thanks for any help, best wishes, Rene
History
Date User Action Args
2021-04-12 05:24:45rvissersetrecipients: + rvisser
2021-04-12 05:24:45rvissersetmessageid: <1618205085.71.0.310776377701.issue43810@roundup.psfhosted.org>
2021-04-12 05:24:45rvisserlinkissue43810 messages
2021-04-12 05:24:45rvissercreate