Skip to content

Commit 36f363b

Browse files
committedJun 12, 2017
On macOS, don't use /var/folders for TMPDIR
This broke "nix-store --serve". (cherry picked from commit 25230a1)
1 parent c338545 commit 36f363b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/libmain/shared.cc

+8
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ void initNix()
162162

163163
if (char *pack = getenv("_NIX_OPTIONS"))
164164
settings.unpack(pack);
165+
166+
/* On macOS, don't use the per-session TMPDIR (as set e.g. by
167+
sshd). This breaks build users because they don't have access
168+
to the TMPDIR, in particular in ‘nix-store --serve’. */
169+
#if __APPLE__
170+
if (getuid() == 0 && hasPrefix(getEnv("TMPDIR"), "/var/folders/"))
171+
unsetenv("TMPDIR");
172+
#endif
165173
}
166174

167175

0 commit comments

Comments
 (0)
Please sign in to comment.