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

Ensure mktemp creates files in a apropiate directory #667

Open MAProsper opened 1 month ago

MAProsper commented 1 month ago

Currently all uses of mktemp in scripts use a template that generate the file at the current working directory. This directory may not be writeable, desirable to use and additionally in the event of a interruption or termination it leaves the file in a location where the system will probably not clean it up.

This could be fixed prepending the patten with ${TMPDIR:-/tmp}/. This selects an appropriate directory, follows the same logic as the default behaviour of mktemp and is compatible with coreutils's and busybox's mktemp implementation.