[issue6975] symlinks incorrectly resolved on POSIX platforms
Serhiy Storchaka added the comment: I have no access to Windows and can't design Windows tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Arfrever Frehtes Taifersar Arahesis added the comment: Use os.path.sep and os.path.sep.encode() instead of hardcoding / and b/. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Serhiy Storchaka added the comment: Use os.path.sep and os.path.sep.encode() instead of hardcoding / and b/. Some separators will be '\\' (if they are derived from OS functions, i.e. getcwd), and some will be '/' (if they are generated by posixpath). I do not have the ability to research where there are any. Feel free to fix these tests for Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Arfrever Frehtes Taifersar Arahesis added the comment: You could probably test '.\\.' and '..\\..' etc. in these tests on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Serhiy Storchaka added the comment: Thank you for the report. I'm surprised that the tests are not caught it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Roundup Robot added the comment: New changeset 50ed06b3d419 by Serhiy Storchaka in branch '2.7': Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). http://hg.python.org/cpython/rev/50ed06b3d419 New changeset cb3fbadb65aa by Serhiy Storchaka in branch '3.2': Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). http://hg.python.org/cpython/rev/cb3fbadb65aa New changeset aad7e68eff0a by Serhiy Storchaka in branch '3.3': Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). http://hg.python.org/cpython/rev/aad7e68eff0a New changeset f99ff3b01fab by Serhiy Storchaka in branch 'default': Fix posixpath.realpath() for multiple pardirs (fixes issue #6975). http://hg.python.org/cpython/rev/f99ff3b01fab -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Roundup Robot added the comment: New changeset 3c5517c4fa5d by Serhiy Storchaka in branch '2.7': Disable posixpath.realpath() tests on Windows (fix for issue #6975). http://hg.python.org/cpython/rev/3c5517c4fa5d New changeset 0bbf7cdea551 by Serhiy Storchaka in branch '3.2': Disable posixpath.realpath() tests on Windows (fix for issue #6975). http://hg.python.org/cpython/rev/0bbf7cdea551 New changeset 79ea59b394bf by Serhiy Storchaka in branch '3.3': Disable posixpath.realpath() tests on Windows (fix for issue #6975). http://hg.python.org/cpython/rev/79ea59b394bf New changeset aa77f7eb2bf1 by Serhiy Storchaka in branch 'default': Disable posixpath.realpath() tests on Windows (fix for issue #6975). http://hg.python.org/cpython/rev/aa77f7eb2bf1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Arfrever Frehtes Taifersar Arahesis added the comment: The above revisions have broken handling of arguments with =2 ... Before these revisions: $ cd /usr/bin $ python3.2 -c 'import os; print(os.path.realpath(..))' /usr $ python3.2 -c 'import os; print(os.path.realpath(../..))' / $ python3.2 -c 'import os; print(os.path.realpath(../../..))' / $ python3.2 -c 'import os; print(os.path.realpath(../../../..))' After these revisions: $ cd /usr/bin $ python3.2 -c 'import os; print(os.path.realpath(..))' /usr $ python3.2 -c 'import os; print(os.path.realpath(../..))' /usr/bin $ python3.2 -c 'import os; print(os.path.realpath(../../..))' /usr $ python3.2 -c 'import os; print(os.path.realpath(../../../..))' /usr/bin -- nosy: +Arfrever, benjamin.peterson, larry priority: normal - release blocker resolution: fixed - stage: committed/rejected - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Arfrever Frehtes Taifersar Arahesis added the comment: The actual output of last command in Before these revisions: is: / -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Roundup Robot added the comment: New changeset 6ec6dbf787f4 by Serhiy Storchaka in branch '2.7': Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. http://hg.python.org/cpython/rev/6ec6dbf787f4 New changeset c5f4fa02fc86 by Serhiy Storchaka in branch '3.2': Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. http://hg.python.org/cpython/rev/c5f4fa02fc86 New changeset bfe9526606e2 by Serhiy Storchaka in branch '3.3': Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. http://hg.python.org/cpython/rev/bfe9526606e2 New changeset f42cabe6ccb5 by Serhiy Storchaka in branch 'default': Issue #6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. http://hg.python.org/cpython/rev/f42cabe6ccb5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Serhiy Storchaka added the comment: I don't really understand your algorithm. Why do you need a stack? Before resolving the symlink we mark the path as unresolved symlink for detecting infinite symlink loops. Before resolving the symlink we mark the path as resolved symlink (and cache the resolved value for speed) for allowing finite symlink recursion. Here is a test which pathlib fails. -- Added file: http://bugs.python.org/file28720/pathlib_resolve_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
R. David Murray added the comment: Vis the discussion of x[:0] in the review. This kind of construct is only unfamiliar because it is new in Python3, and there are not *that* many places that you want to (and can) deal with both bytes and strings using the same code. But when you can, it is the more-or-less obvious way to write the code. In this particular case you could also write type(x)(). There are pluses and minuses to both forms, but if any of the rest of the code uses slicing to work around the fact that byte strings index into ints, then I would definitely prefer the slice form. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Changes by Marco Buccini marcu...@gmail.com: -- nosy: -markon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Antoine Pitrou added the comment: I don't really understand your algorithm. Why do you need a stack? It should be simply iterative: - if the symlink is relative, prepend the symlink target to the rest - if the symlink is absolute, discard the current path and prepend the symlink target to the rest Here is how pathlib does it: https://bitbucket.org/pitrou/pathlib/src/67a2524b057f1af5b3cba26370b1353e73cdda16/pathlib.py?at=default#cl-227 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Changes by Hynek Schlawack h...@ox.cx: -- title: symlinks incorrectly resolved on Linux - symlinks incorrectly resolved on POSIX platforms ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6975] symlinks incorrectly resolved on POSIX platforms
Serhiy Storchaka added the comment: Patch rewritten using recursion. Non-recursive version is not stack limited (and a little faster), but recursive version is perhaps more understandable. Some comments added. -- Added file: http://bugs.python.org/file28672/posix_realpath_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6975 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com