sahib / rmlint

Extremely fast tool to remove duplicates and other lint from your filesystem
http://rmlint.rtfd.org
GNU General Public License v3.0
1.85k stars 128 forks source link

sh script's STAMPFILE loses mktemp safety #666

Open MAProsper opened 1 month ago

MAProsper commented 1 month ago

mktemp guaranties to create the STAMPFILE without clobbering other files. However the file gets deleted and manually created with touch in the remove_cmd function, losing it uniqueness guaranties.

This could be fix by calling rm -f "$STAMPFILE" at the end of the script and not remove it in remove_cmd. This also has the benefit of being more performant (since the file is not recreated constantly) and also it ensures that the stamp file is always deleted (even if remove_cmd is not called).