Skip to content

fix: allow opening non-existent file for writing#195

Merged
embray merged 1 commit into
asdf-format:mainfrom
embray:fix-open-file-stream-for-writing
May 15, 2026
Merged

fix: allow opening non-existent file for writing#195
embray merged 1 commit into
asdf-format:mainfrom
embray:fix-open-file-stream-for-writing

Conversation

@embray
Copy link
Copy Markdown
Collaborator

@embray embray commented May 15, 2026

The fopen mode string r+b will not actually create new files if they don't exist so should use w+b (keep support for r+b in the case of existing files though to prevent truncation; useful for possible streamed writing).

This wasn't caught by the tests because get_temp_file_path already always tries to create a dirent for the temp file before returning it.

CC @braingram

The fopen mode string r+b will not actually create new files if they
don't exist so should use w+b (keep support for r+b in the case of
existing files though to prevent truncation; useful for possible
streamed writing).

This wasn't caught by the tests because `get_temp_file_path` already
always tries to create a dirent for the temp file before returning it.
@embray embray added the bug Something isn't working label May 15, 2026
@embray embray merged commit 02c375e into asdf-format:main May 15, 2026
12 checks passed
@embray embray deleted the fix-open-file-stream-for-writing branch May 15, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant