Repository navigation
Fix Permission denied error from bikeshed echidna on Windows - #3328
Merged
Merged
Conversation
prepareTar() writes Overview.html into a NamedTemporaryFile and then opens it again by name, in doc.finish() and then in tar.add(). On Windows that file is opened with delete-on-close, which blocks any second open, so `bikeshed echidna` failed with "[Errno 13] Permission denied". Pass delete_on_close=False (Python 3.12+, the minimum Bikeshed supports). The file is still removed when the with block exits. Fixes speced#3314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3314
prepareTar()writesOverview.htmlinto atempfile.NamedTemporaryFile()and then opens that file again by name, first indoc.finish()and then intar.add(). With the defaultdelete=True, Windows opens the temp file with delete-on-close, and while it is open that way a plainopen()of the same path is refused. Sodoc.finish()reports "Something prevented me from saving the output document", andtar.add()then dies withPermissionError: [Errno 13], which is the traceback in the issue.This passes
delete_on_close=Falseto that temp file. It is still deleted when thewithblock exits, but it can now be reopened by name. The parameter was added in Python 3.12, which is Bikeshed's minimum. Nothing changes on Linux and macOS. The outer temp file that holds the tar is only used through its file object, so it is left as is.Testing
publish.prepareTar()with a stub doc whosefinish()writes the file by name, then checks the tar contents and that no temp file is left behind. On Windows 11 it fails before this change (PermissionError, Python 3.12 and 3.14) and passes after. On Linux it passes before and after.bikeshed echidna --just-taron a tiny spec on Windows 11: before, the same error and traceback as in the issue; after, a valid tar withOverview.htmlandimages/. On Linux the tar contents are identical before and after.bikeshed testpasses on Python 3.12 and 3.14.No test added: Bikeshed has no unit tests, and
bikeshed testonly renders documents, so it never reachesprepareTar(). If you want coverage, a Windows CI step runningbikeshed -s echidna --just-taron a small spec would catch it; happy to add that.