Skip to content

shred: truncate file to zero before unlinking#12298

Open
gabrielhnf wants to merge 1 commit into
uutils:mainfrom
gabrielhnf:fix-shred-deallocate-before-removal
Open

shred: truncate file to zero before unlinking#12298
gabrielhnf wants to merge 1 commit into
uutils:mainfrom
gabrielhnf:fix-shred-deallocate-before-removal

Conversation

@gabrielhnf
Copy link
Copy Markdown

Fixes #12287

When -u is 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).

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/tty-eof. tests/misc/tty-eof is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Congrats! The gnu test tests/printf/printf-surprise is now passing!

@sylvestre sylvestre force-pushed the fix-shred-deallocate-before-removal branch from 0c130f8 to ce9318b Compare May 16, 2026 20:18
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.

shred -u should deallocate file independently from dir permissions

1 participant