Skip to content

Conversation

analytically
Copy link
Contributor

When writing metadata files, the code was using O_WRONLY|O_CREATE flags without O_TRUNC. This could cause file corruption when writing shorter content than what existed previously, as the remaining bytes from the old content would persist in the file.

The fix adds O_TRUNC to ensure clean overwrites and maintain data integrity.

When writing metadata files, the code was using O_WRONLY|O_CREATE flags without
O_TRUNC. This could cause file corruption when writing shorter content than what
existed previously, as the remaining bytes from the old content would persist in
the file.

The fix adds O_TRUNC to ensure clean overwrites and maintain data integrity.

Signed-off-by: Mathias Bogaert <mathias.bogaert@gmail.com>
@analytically analytically requested a review from a team as a code owner March 16, 2025 23:25
@taylorsilva taylorsilva changed the title fix: add missing O_TRUNC flag to file write operations fix: add O_TRUNC flag when writing volume metadata file May 12, 2025
Copy link
Member

@taylorsilva taylorsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely never caused any issues since I don't think there's a case where baggageclaim would try to write the metadata file twice. Definitely doesn't hurt to add this. Thanks!

@taylorsilva taylorsilva merged commit 2e54d31 into concourse:master May 12, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Pull Requests May 12, 2025
@analytically analytically deleted the truncatemeta branch May 12, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants