Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 41 lines 2.3 kB view raw
1diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java 2index 6fff2af..7e2877e 100644 3--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java 4+++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java 5@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider { 6 Map<String, String> env, BinTools binTools, String fallbackTmpDir) { 7 ImmutableMap.Builder<String, String> result = ImmutableMap.builder(); 8 result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); 9+ 10+ // In case we are running on NixOS. 11+ // If bash is called with an unset PATH on this platform, 12+ // it will set it to /no-such-path and default tools will be missings. 13+ // See, https://github.com/NixOS/nixpkgs/issues/94222 14+ // So we ensure that minimal dependencies are present. 15+ if (!env.containsKey("PATH")){ 16+ result.put("PATH", "@actionsPathPatch@"); 17+ } 18+ 19 String p = clientEnv.get("TMPDIR"); 20 if (Strings.isNullOrEmpty(p)) { 21 // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR 22index 95642767c6..39d3c62461 100644 23--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java 24+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java 25@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { 26 27 ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder(); 28 newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); 29+ 30+ // In case we are running on NixOS. 31+ // If bash is called with an unset PATH on this platform, 32+ // it will set it to /no-such-path and default tools will be missings. 33+ // See, https://github.com/NixOS/nixpkgs/issues/94222 34+ // So we ensure that minimal dependencies are present. 35+ if (!env.containsKey("PATH")){ 36+ newEnvBuilder.put("PATH", "@actionsPathPatch@"); 37+ } 38+ 39 String p = clientEnv.get("TMPDIR"); 40 if (Strings.isNullOrEmpty(p)) { 41 // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR