about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-05-28 08:32:57 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-05-28 08:32:57 +0200
commit3685108787b28ba4592b994bbb6f9cded8f60b9c (patch)
treed02511707d6745be195f22a4a2bbfa55717ee229 /pkgs/build-support
parentdd12269b78a017a5075c89d1927fbf5f4b8bb4a9 (diff)
parent36a6746f2178141465761ce36de888389bc2968a (diff)
downloadnixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar.gz
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar.bz2
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar.lz
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar.xz
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.tar.zst
nixlib-3685108787b28ba4592b994bbb6f9cded8f60b9c.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c8
-rw-r--r--pkgs/build-support/build-fhs-userenv/env.nix4
2 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
index 0e9e36bc3014..34e050dde4fb 100644
--- a/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
+++ b/pkgs/build-support/build-fhs-userenv/chrootenv/chrootenv.c
@@ -19,6 +19,10 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+int min(int a, int b) {
+  return a > b ? b : a;
+}
+
 const gchar *bind_blacklist[] = {"bin", "etc", "host", "usr", "lib", "lib64", "lib32", "sbin", NULL};
 
 void bind_mount(const gchar *source, const gchar *target) {
@@ -126,7 +130,9 @@ int main(gint argc, gchar **argv) {
     int status;
 
     fail_if(waitpid(cpid, &status, 0) != cpid);
-    fail_if(nftw(prefix, nftw_remove, getdtablesize(),
+    // glibc 2.27 (and possibly other versions) can't handle
+    // an nopenfd value larger than 2^19
+    fail_if(nftw(prefix, nftw_remove, min(getdtablesize(), 1<<19),
                  FTW_DEPTH | FTW_MOUNT | FTW_PHYS));
 
     if (WIFEXITED(status))
diff --git a/pkgs/build-support/build-fhs-userenv/env.nix b/pkgs/build-support/build-fhs-userenv/env.nix
index be83c9da2108..295b17eec67c 100644
--- a/pkgs/build-support/build-fhs-userenv/env.nix
+++ b/pkgs/build-support/build-fhs-userenv/env.nix
@@ -52,8 +52,8 @@ let
   etcProfile = writeText "profile" ''
     export PS1='${name}-chrootenv:\u@\h:\w\$ '
     export LOCALE_ARCHIVE='/usr/lib/locale/locale-archive'
-    export LD_LIBRARY_PATH='/run/opengl-driver/lib:/run/opengl-driver-32/lib:/usr/lib:/usr/lib32'
-    export PATH='/run/wrappers/bin:/usr/bin:/usr/sbin'
+    export LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib:/usr/lib:/usr/lib32:$LD_LIBRARY_PATH"
+    export PATH="/run/wrappers/bin:/usr/bin:/usr/sbin:$PATH"
     export TZDIR='/etc/zoneinfo'
 
     # Force compilers and other tools to look in default search paths