coreutils: fix unprivileged sandbox build

In usernamespaces some POSIX assumptions break, which
make some coreutils fail when running with sandbox but without a nix-deamon.
With this pull request it is possible to bootstrap stdenv without root-permission,
which is quiet useful in HPC environments.
This commit is contained in:
Jörg Thalheim 2018-12-22 11:42:22 +00:00
parent 1b146a8c6f
commit 0a35c5cc8c

View file

@ -25,16 +25,27 @@ stdenv.mkDerivation rec {
patches = optional stdenv.hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch;
# The test tends to fail on btrfs and maybe other unusual filesystems.
postPatch = ''
# The test tends to fail on btrfs and maybe other unusual filesystems.
sed '2i echo Skipping dd sparse test && exit 0' -i ./tests/dd/sparse.sh
sed '2i echo Skipping cp sparse test && exit 0' -i ./tests/cp/sparse.sh
sed '2i echo Skipping rm deep-2 test && exit 0' -i ./tests/rm/deep-2.sh
sed '2i echo Skipping du long-from-unreadable test && exit 0' -i ./tests/du/long-from-unreadable.sh
# sandbox does not allow setgid
sed '2i echo Skipping chmod setgid test && exit 0' -i ./tests/chmod/setgid.sh
sed '2i print "Skipping env -S test"; exit 0;' -i ./tests/misc/env-S.pl
substituteInPlace ./tests/install/install-C.sh \
--replace 'mode3=2755' 'mode3=1755'
sed '2i print "Skipping env -S test"; exit 0;' -i ./tests/misc/env-S.pl
# these tests fail in the unprivileged nix sandbox (without nix-daemon) as we break posix assumptions
for f in ./tests/chgrp/{basic.sh,recurse.sh,default-no-deref.sh,no-x.sh,posix-H.sh}; do
sed '2i echo Skipping chgrp && exit 0' -i "$f"
done
for f in gnulib-tests/{test-chown.c,test-fchownat.c,test-lchown.c}; do
echo "int main() { return 0; }" > "$f"
done
'';
outputs = [ "out" "info" ];