From 7718b19389fd02407860ce587196adc04f80bb5d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 27 Aug 2008 17:20:25 +0000 Subject: [PATCH] * 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). --- src/libstore/build.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index cc3588a1e..538990ed9 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