Repository navigation
shred: truncate file to zero before unlinking - #12298
Open
gabrielhnf wants to merge 3 commits into
Open
gabrielhnf wants to merge 3 commits into
gabrielhnf wants to merge 3 commits into
Conversation
|
GNU testsuite comparison: |
sylvestre
force-pushed
the
fix-shred-deallocate-before-removal
branch
from
May 16, 2026 20:18
0c130f8 to
ce9318b
Compare
sylvestre
reviewed
Sep 21, 2026
| } | ||
|
|
||
| if remove_method != RemoveMethod::None { | ||
| file.set_len(0).map_err_context( |
Contributor
There was a problem hiding this comment.
a truncate failure reported as "failed to remove file" is a bit misleading, could you please use a dedicated message?
sylvestre
reviewed
Sep 21, 2026
| let file_path = "truncate_test/file"; | ||
|
|
||
| at.mkdir(dir); | ||
| // Create a 1MB file |
Contributor
There was a problem hiding this comment.
does it need to be 1MB? a few KB would be enough and faster :)
Contributor
Author
There was a problem hiding this comment.
Reduced to 4KB, thanks!
Contributor
|
sorry but it needs to be rebased |
gabrielhnf
force-pushed
the
fix-shred-deallocate-before-removal
branch
from
October 20, 2026 15:27
ce9318b to
fd0842e
Compare
Contributor
Author
|
Rebased onto the latest main. I've also addressed your review comments regarding the truncation error message and test file size. Thank you very much for the review! |
This branch has not been deployed
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 #12287
When
-uis given, shred now truncates the file to zero before attempting to unlink it. This ensures the file's allocated blocks are freed even when the parent directory is not writable (which would prevent unlinking).