Skip to content

fix(writer): truncate existing files when writing - #1640

Open
seiyab wants to merge 2 commits into
apache:mainfrom
seiyab:openfile-flag
Open

seiyab wants to merge 2 commits into
apache:mainfrom
seiyab:openfile-flag

Conversation

@seiyab

@seiyab seiyab commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

writer.WriteFile leaves trailing bytes when overwriting an existing file with shorter content. Add O_TRUNC so the file contains exactly the new content.
Adds a regression test that fails before the fix and passes afterward. Verified with go test ./pkg/writer.


Context
I found this scanning this project with an static code analyzer while I evaluate the analyzer.
I might submit a few other minor fixes one by one if this is accepted.

seiyab and others added 2 commits October 2, 2026 00:08
Co-Authored-By: codex <codex@openai.com>
Co-Authored-By: codex <codex@openai.com>

This branch has not been deployed

No deployments
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.

1 participant