|
From: | Alejandro Colomar |
Subject: | Re: Missing [/usr/local]/var/lib and [/usr/local]/tmp |
Date: | Mon, 18 Jul 2022 14:23:15 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
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?
Thanks, Alex -- Alejandro Colomar <http://www.alejandro-colomar.es/>
OpenPGP_signature
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |