Hi Eddy,

On 7/18/22 14:17, Edward Welbourne wrote:
Alejandro Colomar (Monday, July 18, 2022 14:07)
MacOS seems to be setting TMPDIR (or at least some script run at
startup seems to be setting it in my system), and it's set to something
really weird that I don't trust will exist after reboot.

Then I think the way you're using tmpdir doesn't match its usual
semantics, namely that it's exactly a directory that's routinely blown
away and recreated, at least as often as boot-time and ideally more
often.  If what you need is a place to store (even semi-) persistent
state for a program, that should survive reboots, then you want
$prefix/var/, not /tmp/ (which may well be a tmpfs partition, indeed).

This isn't my code, so I'm not entirely familiar with why it was implemented that way. I agree it's probably wrong.

But from I know, the data stored there shouldn't survive reboots. But the directory itself should, because it's hardcoded at compile time, and so the program tries to find it when creating temporary files in it.

I'm not sure if the program handles correctly `TMPDIR=/foo/bar unitd`, but it should. I guess $tmpdir would be the string to fallback if no TMPDIR is specified. Is it good to hardcode it in the binary to be /tmp, or should we allow compile-time modification at compile time thorugh $tmpdir?



Alejandro Colomar

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to