<table><tr><td style="">aaronpuchert added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D17289">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D17289#398555" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D17289#398555</a>, <a href="https://phabricator.kde.org/p/rjvbb/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@rjvbb</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D17289#395491" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D17289#395491</a>, <a href="https://phabricator.kde.org/p/aaronpuchert/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@aaronpuchert</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>Temporary files being left behind after a crash is not unusual. This is why systemd <a href="https://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html" class="remarkup-link" target="_blank" rel="noreferrer">has</a> <tt style="background: #ebebeb; font-size: 13px;">systemd-tmpfiles --clean</tt>.</p></div>
</blockquote>

<p>Not really relevant outside of the systemd realm, right? :)</p></div>
</blockquote>

<p>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 <tt style="background: #ebebeb; font-size: 13px;">systemd-tmpfiles</tt>. If you don't use systemd, for example because you're not on Linux, there are certainly other tools for doing the same thing.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>So we could set <tt style="background: #ebebeb; font-size: 13px;">TMP_DIR</tt> for ourselves (based on the user-provided <tt style="background: #ebebeb; font-size: 13px;">TMP_DIR</tt>), but pass the original environment variable to all subprocesses.</p></blockquote>

<p>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.<br />
 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.<br />
 For instance, is KDevelop's environment profile feature applied to *every* subprocess that is created?</p></blockquote>

<p>I can't talk about Qt, but from the POSIX point of view there are <tt style="background: #ebebeb; font-size: 13px;">exec</tt> <a href="https://linux.die.net/man/3/exec" class="remarkup-link" target="_blank" rel="noreferrer">variants</a> 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 <tt style="background: #ebebeb; font-size: 13px;">TMP_DIR</tt> for childs that doesn't introduce race conditions.</p>

<p>However, because of the first point, I'm actually not sure if this is worth the trouble. We shouldn't deliberately leave garbage in <tt style="background: #ebebeb; font-size: 13px;">/tmp</tt>, but we don't need to guarantee that we clean it up either. That's pretty much the point of having <tt style="background: #ebebeb; font-size: 13px;">/tmp</tt> in the first place, otherwise we could just put the files somewhere else.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17289">https://phabricator.kde.org/D17289</a></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop, kfunk, mwolff<br /><strong>Cc: </strong>aaronpuchert, mwolff, pino, kfunk, kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>