Skip to content

Fix Permission denied error from bikeshed echidna on Windows - #3328

Merged
tabatkins merged 1 commit into
speced:mainfrom
Thanatos9404:fix/echidna-windows-tempfile
Oct 20, 2026
Merged

tabatkins merged 1 commit into
speced:mainfrom
Thanatos9404:fix/echidna-windows-tempfile

Conversation

@Thanatos9404

Copy link
Copy Markdown
Contributor

Fixes #3314

prepareTar() writes Overview.html into a tempfile.NamedTemporaryFile() and then opens that file again by name, first in doc.finish() and then in tar.add(). With the default delete=True, Windows opens the temp file with delete-on-close, and while it is open that way a plain open() of the same path is refused. So doc.finish() reports "Something prevented me from saving the output document", and tar.add() then dies with PermissionError: [Errno 13], which is the traceback in the issue.

This passes delete_on_close=False to that temp file. It is still deleted when the with block 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

  • A small script that calls publish.prepareTar() with a stub doc whose finish() 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-tar on a tiny spec on Windows 11: before, the same error and traceback as in the issue; after, a valid tar with Overview.html and images/. On Linux the tar contents are identical before and after.
  • black, ruff, pylint and mypy are clean, and bikeshed test passes on Python 3.12 and 3.14.

No test added: Bikeshed has no unit tests, and bikeshed test only renders documents, so it never reaches prepareTar(). If you want coverage, a Windows CI step running bikeshed -s echidna --just-tar on a small spec would catch it; happy to add that.

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
@tabatkins
tabatkins merged commit 1bce7f0 into speced:main Oct 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission Denied error in Temp folder running bikeshed echidna on Windows

2 participants