Bug#913268: properly choosing the temporary directory
Al Ma
alma0 at ro.ru
Thu Nov 6 16:03:49 GMT 2025
Upon thinking more, having the temporary file on the same partition as the original file ensures that if the computer crashes, the directory entry for the original file will more likely point to valid data.
So the logic should probably be as follows:
template="pngoutXXXXXX.png.tmp";
if directory_of_the_original_file is writable and has enough space then use directory_of_the_original_file + template as a temporary file
else if $TMPDIR exists, is on the same partition as the original file, is writable, and has enough space then use $TMPDIR + "/"+ template as a temporary file
else if "/tmp" exists, is on the same partition as the original, is writable, and has enough space then use "/tmp/" + template as a temporary file
else if "/var/tmp" exists, is on the same partition as the original, is writable, and has enough space then use "/var/tmp/" + template as a temporary file
else overwrite the original file directly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-phototools-devel/attachments/20251106/5f9e6a8a/attachment-0001.htm>
More information about the Pkg-phototools-devel
mailing list