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 Robin Roth
Recipients Robin Roth, berker.peksag, drawks, loewis, pablo.sole, pitrou, rossburton
Date 2015-11-14.14:26:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447511171.68.0.588046150002.issue2466@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-11-14 14:26:11Robin Rothsetrecipients: + Robin Roth, loewis, pitrou, rossburton, drawks, berker.peksag, pablo.sole
2015-11-14 14:26:11Robin Rothsetmessageid: <1447511171.68.0.588046150002.issue2466@psf.upfronthosting.co.za>
2015-11-14 14:26:11Robin Rothlinkissue2466 messages
2015-11-14 14:26:11Robin Rothcreate