coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

shred: --remove exits on the first failed rename and skips remaining files

Open fixfon opened this issue 1 month ago • 0 comments

When shred -u can't rename a file, for example because its directory isn't writable, it prints an error and exits right away. The file is never unlinked and the remaining operands are skipped.

mkdir shr ok; touch shr/f ok/g; chmod a-w shr
shred -u shr/f ok/g; echo $?; ls ok

uutils main (5dd33b8):

shred: shr/f: Couldn't rename to 'shr/0': Permission denied
1
g

GNU 9.12:

shred: shr/f: failed to remove: Permission denied
1

GNU keeps going and removes ok/g; uutils leaves it in place. This is the shred/shred-remove case in #14705.

fixfon avatar Oct 31 '26 15:10 fixfon