D17289: KDevelop/Shell: set dedicated TMPDIR
noreply at phabricator.kde.org
Wed Jan 23 23:01:58 GMT 2019
aaronpuchert added a comment.
In D17289#398555 <https://phabricator.kde.org/D17289#398555>, @rjvbb wrote:
> In D17289#395491 <https://phabricator.kde.org/D17289#395491>, @aaronpuchert wrote:
> > Temporary files being left behind after a crash is not unusual. This is why systemd has <https://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html> `systemd-tmpfiles --clean`.
> Not really relevant outside of the systemd realm, right? :)
I was just trying to point out that there is basically no way around regularly cleaning up temporary directories. This has nothing to do with systemd. I wanted to add that this is the reason for facilities like `systemd-tmpfiles`. If you don't use systemd, for example because you're not on Linux, there are certainly other tools for doing the same thing.
>> So we could set `TMP_DIR` for ourselves (based on the user-provided `TMP_DIR`), but pass the original environment variable to all subprocesses.
> Milan also suggested that, and I have no qualms with it except possibly for helper apps that are really specific to or used in a way specific to KDevelop. Those c/should use the KDevelop-specific tempdir, IMHO.
> The question is, can we do this env. tweak in a central way? I can start digging but it would help if someone already knows a formal answer.
> For instance, is KDevelop's environment profile feature applied to *every* subprocess that is created?
I can't talk about Qt, but from the POSIX point of view there are `exec` variants <https://linux.die.net/man/3/exec> with and without explicit environment argument. Those without take the environment of the existing process. So if we don't want to copy our environment over to subprocesses, we need to always call one of the variants with explicit environment argument. However, as you noted, that would be hard to enforce. I was just trying to point out that there is a way to reset `TMP_DIR` for childs that doesn't introduce race conditions.
However, because of the first point, I'm actually not sure if this is worth the trouble. We shouldn't deliberately leave garbage in `/tmp`, but we don't need to guarantee that we clean it up either. That's pretty much the point of having `/tmp` in the first place, otherwise we could just put the files somewhere else.
To: rjvbb, #kdevelop, kfunk, mwolff
Cc: aaronpuchert, mwolff, pino, kfunk, kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KDevelop-devel