Tapestry Will Crash on Encountering a File It Cannot Copy #31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
Tapestry Will Crash on Encountering a File It Cannot Copy. Normally this shouldn't happen, but can in the event that you're copying out (e.g.) system directories or other tools.
To Reproduce
Steps to reproduce the behavior:
--incmodes.Expected behavior
It would be better to skip and log such files, possibly with a displayed warning indicating that the script encountered files it cannot remove.
Log/Console Output
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
This bug actually gets more complicated than originally thought.
Thanks to the work of the mighty @EricaPomme we have an access_test function built in to Tapestry since at least 2.1.
This test returns a tuple of true, false, or none for each of the POSIX file permissions (read, write, execute) as well as if the file itself exists.
In the above-stated case, the access_test (which is fundamentally powered by
os.access) returns true for the read permission on the file in question. However, the file instead creates an error when it attempts to be opened.The shortcut solution would still be a try/except that catches the permission error but I want to have a crack at fixing the access_test function first as this evidentially came up at least once before.
The following is a direct quotation from the os module documentation:
This is the more or less exact use case that caused this issue. To be fair, I should not have been using Tapestry in this way; this was a lazy shortcut to avoid having to setup and configure tapestry on a remote headless system.
Given that we are already checking for local access permissions and alerting on failure, I will still add a small code change to catch this bug, but it is not considered a high priority bug any longer and will definitely not be patched until the 2.2 release.
7c78998is the commit that contains those changes.Closing now though of course the fix won't be in a release version until 2.2.0. 2.1.X users who need this functionality should compile and install the version of Tapestry currently available in the "Development" directory.