about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-27T17·20+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-27T17·20+0000
commit7718b19389fd02407860ce587196adc04f80bb5d (patch)
treeef4d327be4ea96b546d2444a41caa8700da54981 /src/libstore/build.cc
parent9cc0da84533f1ced2ed89ea807ac18b1078f7f88 (diff)
* Explicitly set PWD to prevent problems with chroot builds. In
  particular, dietlibc cannot figure out the cwd because the inode of
  the current directory doesn't appear in .. (because getdents returns
  the inode of the mount point).

Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index cc3588a1eaac..538990ed9989 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1552,6 +1552,12 @@ void DerivationGoal::startBuilder()
     /* Also set TMPDIR and variants to point to this directory. */
     env["TMPDIR"] = env["TEMPDIR"] = env["TMP"] = env["TEMP"] = tmpDir;
 
+    /* Explicitly set PWD to prevent problems with chroot builds.  In
+       particular, dietlibc cannot figure out the cwd because the
+       inode of the current directory doesn't appear in .. (because
+       getdents returns the inode of the mount point). */
+    env["PWD"] = tmpDir;
+
     /* Compatibility hack with Nix <= 0.7: if this is a fixed-output
        derivation, tell the builder, so that for instance `fetchurl'
        can skip checking the output.  On older Nixes, this environment