<p dir="auto">Hello! I'm packaging julia 1.4.1 for guix, and this test is failing</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/JuliaLang/julia/blob/381693d3dfc9b7072707f6d544f82f6637fc5e7c/test/file.jl#L70">julia/test/file.jl</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 70
      in
      <a data-pjax="true" class="commit-tease-sha" href="/JuliaLang/julia/commit/381693d3dfc9b7072707f6d544f82f6637fc5e7c">381693d</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L70" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="70"></td>
          <td id="LC70" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-c1">@test</span> <span class="pl-c1">dirname</span>(t) <span class="pl-k">==</span> d </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">I can reproduce it with:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using Test
using Random

function run()
    @testset &quot;tempname with parent&quot; begin
        t = tempname()
        @test dirname(t) == tempdir()
        mktempdir() do d
            t = tempname(d)
            @test dirname(t) == d
        end
        @test_throws ArgumentError tempname(randstring())
    end
end
# tempdir() uses the first environment variable found in the ordered list TMPDIR, TMP, TEMP, and TEMPDIR. If none of these are found, the path &quot;/tmp&quot; is used.
# Let's check all those variables are currently empty
all_empty() = @test all(isnothing.(get.(Ref(ENV), [&quot;TMPDIR&quot;, &quot;TMP&quot;, &quot;TEMP&quot;, &quot;TEMPDIR&quot;], nothing)))
all_empty()

# Check the test passes when no &quot;TEMP&quot; variable is set
@info &quot;No env var&quot;
run()

@info &quot;TMPDIR var&quot;
withenv(&quot;TMPDIR&quot; =&gt; mktempdir()) do
    run()
end
all_empty()"><pre class="notranslate"><span class="pl-k">using</span> Test
<span class="pl-k">using</span> Random

<span class="pl-k">function</span> <span class="pl-en">run</span>()
    <span class="pl-c1">@testset</span> <span class="pl-s"><span class="pl-pds">"</span>tempname with parent<span class="pl-pds">"</span></span> <span class="pl-k">begin</span>
        t <span class="pl-k">=</span> <span class="pl-c1">tempname</span>()
        <span class="pl-c1">@test</span> <span class="pl-c1">dirname</span>(t) <span class="pl-k">==</span> <span class="pl-c1">tempdir</span>()
        <span class="pl-c1">mktempdir</span>() <span class="pl-k">do</span> d
            t <span class="pl-k">=</span> <span class="pl-c1">tempname</span>(d)
            <span class="pl-c1">@test</span> <span class="pl-c1">dirname</span>(t) <span class="pl-k">==</span> d
        <span class="pl-k">end</span>
        <span class="pl-c1">@test_throws</span> ArgumentError <span class="pl-c1">tempname</span>(<span class="pl-c1">randstring</span>())
    <span class="pl-k">end</span>
<span class="pl-k">end</span>
<span class="pl-c"><span class="pl-c">#</span> tempdir() uses the first environment variable found in the ordered list TMPDIR, TMP, TEMP, and TEMPDIR. If none of these are found, the path "/tmp" is used.</span>
<span class="pl-c"><span class="pl-c">#</span> Let's check all those variables are currently empty</span>
<span class="pl-en">all_empty</span>() <span class="pl-k">=</span> <span class="pl-c1">@test</span> <span class="pl-c1">all</span>(<span class="pl-c1">isnothing</span>.(<span class="pl-c1">get</span>.(<span class="pl-c1">Ref</span>(<span class="pl-c1">ENV</span>), [<span class="pl-s"><span class="pl-pds">"</span>TMPDIR<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>TMP<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>TEMP<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>TEMPDIR<span class="pl-pds">"</span></span>], <span class="pl-c1">nothing</span>)))
<span class="pl-c1">all_empty</span>()

<span class="pl-c"><span class="pl-c">#</span> Check the test passes when no "TEMP" variable is set</span>
<span class="pl-c1">@info</span> <span class="pl-s"><span class="pl-pds">"</span>No env var<span class="pl-pds">"</span></span>
<span class="pl-c1">run</span>()

<span class="pl-c1">@info</span> <span class="pl-s"><span class="pl-pds">"</span>TMPDIR var<span class="pl-pds">"</span></span>
<span class="pl-c1">withenv</span>(<span class="pl-s"><span class="pl-pds">"</span>TMPDIR<span class="pl-pds">"</span></span> <span class="pl-k">=&gt;</span> <span class="pl-c1">mktempdir</span>()) <span class="pl-k">do</span>
    <span class="pl-c1">run</span>()
<span class="pl-k">end</span>
<span class="pl-c1">all_empty</span>()</pre></div>
<p dir="auto">Can anybody confirm the same happens with the official build?</p>
<p dir="auto">Thanks, Nicolò</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="compiler/validation                (31) |        started at 2020-12-14T10:40:17.674           
compiler/validation                (31) |     2.18 |   0.09 |  4.2 |      56.87 |   303.75
file                               (31) |        started at 2020-12-14T10:40:20.769                                                                                                                                  
file                               (31) |         failed at 2020-12-14T10:40:42.395
Test Failed at /nobackup/users/vchuravy/dev/julia/test/file.jl:72
  Expression: dirname(t) == d
   Evaluated: &quot;/tmp&quot; == &quot;/tmp/jl_b8KtOh&quot;"><pre class="notranslate"><code class="notranslate">compiler/validation                (31) |        started at 2020-12-14T10:40:17.674           
compiler/validation                (31) |     2.18 |   0.09 |  4.2 |      56.87 |   303.75
file                               (31) |        started at 2020-12-14T10:40:20.769                                                                                                                                  
file                               (31) |         failed at 2020-12-14T10:40:42.395
Test Failed at /nobackup/users/vchuravy/dev/julia/test/file.jl:72
  Expression: dirname(t) == d
   Evaluated: "/tmp" == "/tmp/jl_b8KtOh"
</code></pre></div>
<p dir="auto">I tried isolating it, but I have not yet reproduced it outside the tests themselves. Running <code class="notranslate">file</code> tests on it's own succeeds as well, but running <code class="notranslate">make testall</code> this is always reproducible.</p>