[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see
Robin Roth added the comment: Based on the review by SilentGhost I removed all refactoring-changes and only left the one line needed for the fix. -- Added file: http://bugs.python.org/file43140/minimal_fix_ismount_directory_not_readable.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see
Robin Roth added the comment: Any progress on merging this? The fix is simple, there is a test; anything else I can do to help? Ansible integrated the patch posted here as a workaround of an issue this caused. So there was some external review of the fix. See https://github.com/ansible/ansible-modules-core/pull/2737 -- versions: +Python 3.2, Python 3.3 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see
Robin Roth added the comment: any comments/updates on merging this? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see
Robin Roth added the comment: Antoine's suggestion does not work, because "dirname" does not cover enough cases (for example trailing slash, possibly more). As suggested by him I now use realpath (instead of abspath). I can't come up with a symlink-situation that is broken with the old code, but realpath is what "ismount" actually means. I also added a testcase that resembles the issue, i.e. it fails with the old code and passes with the fix. I mock the "Permission denied" by raising a generic OSError. Mocking can not resemble every real-life situation but by simulating all issues reporting and then fixing them, one should get a solid test coverage. I also took the liberty of minor cleanup in/around the functions changed, i.e. remove unused imports and remove single-use variables to make the code easier to read. Attached the updated patch. -- Added file: http://bugs.python.org/file41041/test_fix_ismount_directory_not_readable.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2466] os.path.ismount doesn't work for mounts the user doesn't have permission to see
Robin Roth added the comment: This bug is still present and annoying. For me it appeared when running ismount on a nfs-mounted directory, when the user who runs python has no read permission inside the directory. Therefore the lstat on /mntdir/.. fails. Attached a patch that fixes this by running abspath on the path. Symlinks will also work because they are checked/excluded before the part of the code where the patch is in. msg222528 is not related to the original bug and should be opened separately. -- keywords: +patch nosy: +Robin Roth Added file: http://bugs.python.org/file40641/ismount-permission.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2466> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com