lol

Merge pull request #142836 from happysalada/staging-next

authored by

Martin Weinelt and committed by
GitHub
3db31260 0336295c

+269 -1
+162
pkgs/tools/misc/coreutils/8.nix
··· 1 + { stdenv, lib, buildPackages 2 + , autoreconfHook, bison, texinfo, fetchurl, perl, xz, libiconv, gmp ? null 3 + , aclSupport ? stdenv.isLinux, acl ? null 4 + , attrSupport ? stdenv.isLinux, attr ? null 5 + , selinuxSupport? false, libselinux ? null, libsepol ? null 6 + # No openssl in default version, so openssl-induced rebuilds aren't too big. 7 + # It makes *sum functions significantly faster. 8 + , minimal ? true, withOpenssl ? !minimal, openssl ? null 9 + , withPrefix ? false 10 + , singleBinary ? "symlinks" # you can also pass "shebangs" or false 11 + }: 12 + 13 + # Note: this package is used for bootstrapping fetchurl, and thus 14 + # cannot use fetchpatch! All mutable patches (generated by GitHub or 15 + # cgit) that are needed here should be included directly in Nixpkgs as 16 + # files. 17 + 18 + assert aclSupport -> acl != null; 19 + assert selinuxSupport -> libselinux != null && libsepol != null; 20 + 21 + with lib; 22 + 23 + stdenv.mkDerivation (rec { 24 + pname = "coreutils"; 25 + version = "8.32"; 26 + 27 + src = fetchurl { 28 + url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz"; 29 + sha256 = "sha256-RFjY3nhJ30TMqxXhaxVIsoUiTbul8I+sBwwcDgvMTPo="; 30 + }; 31 + 32 + patches = [ ./sys-getdents-undeclared.patch ] 33 + ++ optional stdenv.hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch 34 + # fix gnulib tests on 32-bit ARM. Included on coreutils master. 35 + # https://lists.gnu.org/r/bug-gnulib/2020-08/msg00225.html 36 + ++ optional stdenv.hostPlatform.isAarch32 ./fix-gnulib-tests-arm.patch; 37 + 38 + postPatch = '' 39 + # The test tends to fail on btrfs,f2fs and maybe other unusual filesystems. 40 + sed '2i echo Skipping dd sparse test && exit 77' -i ./tests/dd/sparse.sh 41 + sed '2i echo Skipping du threshold test && exit 77' -i ./tests/du/threshold.sh 42 + sed '2i echo Skipping cp sparse test && exit 77' -i ./tests/cp/sparse.sh 43 + sed '2i echo Skipping rm deep-2 test && exit 77' -i ./tests/rm/deep-2.sh 44 + sed '2i echo Skipping du long-from-unreadable test && exit 77' -i ./tests/du/long-from-unreadable.sh 45 + 46 + # Depends on the mountpoints 47 + sed '2i echo Skipping df df-symlink test && exit 77' -i ./tests/df/df-symlink.sh 48 + 49 + # Some target platforms, especially when building inside a container have 50 + # issues with the inotify test. 51 + sed '2i echo Skipping tail inotify dir recreate test && exit 77' -i ./tests/tail-2/inotify-dir-recreate.sh 52 + 53 + # sandbox does not allow setgid 54 + sed '2i echo Skipping chmod setgid test && exit 77' -i ./tests/chmod/setgid.sh 55 + substituteInPlace ./tests/install/install-C.sh \ 56 + --replace 'mode3=2755' 'mode3=1755' 57 + 58 + sed '2i print "Skipping env -S test"; exit 77;' -i ./tests/misc/env-S.pl 59 + 60 + # Fails on systems with a rootfs. Looks like a bug in the test, see 61 + # https://lists.gnu.org/archive/html/bug-coreutils/2019-12/msg00000.html 62 + sed '2i print "Skipping df skip-rootfs test"; exit 77' -i ./tests/df/skip-rootfs.sh 63 + 64 + # these tests fail in the unprivileged nix sandbox (without nix-daemon) as we break posix assumptions 65 + for f in ./tests/chgrp/{basic.sh,recurse.sh,default-no-deref.sh,no-x.sh,posix-H.sh}; do 66 + sed '2i echo Skipping chgrp && exit 77' -i "$f" 67 + done 68 + for f in gnulib-tests/{test-chown.c,test-fchownat.c,test-lchown.c}; do 69 + echo "int main() { return 77; }" > "$f" 70 + done 71 + 72 + # tests try to access user 1000 which is forbidden in sandbox 73 + sed '2i print "Skipping id uid test"; exit 77' -i ./tests/id/uid.sh 74 + sed '2i print "Skipping id zero test"; exit 77' -i ./tests/id/zero.sh 75 + sed '2i print "Skipping misc help-versiob test"; exit 77' -i ./tests/misc/help-version.sh 76 + sed '2i print "Skipping chown separator test"; exit 77' -i ./tests/chown/separator.sh 77 + '' + optionalString (stdenv.hostPlatform.libc == "musl") (lib.concatStringsSep "\n" [ 78 + '' 79 + echo "int main() { return 77; }" > gnulib-tests/test-parse-datetime.c 80 + echo "int main() { return 77; }" > gnulib-tests/test-getlogin.c 81 + '' 82 + ]); 83 + 84 + outputs = [ "out" "info" ]; 85 + 86 + nativeBuildInputs = [ perl xz.bin ] 87 + ++ optionals stdenv.hostPlatform.isCygwin [ autoreconfHook texinfo ]; # due to patch 88 + configureFlags = [ "--with-packager=https://NixOS.org" ] 89 + ++ optional (singleBinary != false) 90 + ("--enable-single-binary" + optionalString (isString singleBinary) "=${singleBinary}") 91 + ++ optional withOpenssl "--with-openssl" 92 + ++ optional stdenv.hostPlatform.isSunOS "ac_cv_func_inotify_init=no" 93 + ++ optional withPrefix "--program-prefix=g" 94 + ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "glibc") [ 95 + # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I 96 + # don't know why it is not properly detected cross building with glibc. 97 + "fu_cv_sys_stat_statfs2_bsize=yes" 98 + ]; 99 + 100 + 101 + buildInputs = [ gmp ] 102 + ++ optional aclSupport acl 103 + ++ optional attrSupport attr 104 + ++ optional withOpenssl openssl 105 + ++ optionals selinuxSupport [ libselinux libsepol ] 106 + # TODO(@Ericson2314): Investigate whether Darwin could benefit too 107 + ++ optional (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc != "glibc") libiconv; 108 + 109 + # The tests are known broken on Cygwin 110 + # (http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/19025), 111 + # Darwin (http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/19351), 112 + # and {Open,Free}BSD. 113 + # With non-standard storeDir: https://github.com/NixOS/nix/issues/512 114 + doCheck = stdenv.hostPlatform == stdenv.buildPlatform 115 + && (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.isMusl) 116 + && !stdenv.isAarch32; 117 + 118 + # Prevents attempts of running 'help2man' on cross-built binaries. 119 + PERL = if stdenv.hostPlatform == stdenv.buildPlatform then null else "missing"; 120 + 121 + # Saw random failures like ‘help2man: can't get '--help' info from 122 + # man/sha512sum.td/sha512sum’. 123 + enableParallelBuilding = false; 124 + 125 + NIX_LDFLAGS = optionalString selinuxSupport "-lsepol"; 126 + FORCE_UNSAFE_CONFIGURE = optionalString stdenv.hostPlatform.isSunOS "1"; 127 + 128 + # Works around a bug with 8.26: 129 + # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop. 130 + preInstall = optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 131 + sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|' 132 + ''; 133 + 134 + postInstall = optionalString (stdenv.hostPlatform != stdenv.buildPlatform && !minimal) '' 135 + rm $out/share/man/man1/* 136 + cp ${buildPackages.coreutils-full}/share/man/man1/* $out/share/man/man1 137 + '' 138 + # du: 8.7 M locale + 0.4 M man pages 139 + + optionalString minimal '' 140 + rm -r "$out/share" 141 + ''; 142 + 143 + meta = { 144 + homepage = "https://www.gnu.org/software/coreutils/"; 145 + description = "The basic file, shell and text manipulation utilities of the GNU operating system"; 146 + longDescription = '' 147 + The GNU Core Utilities are the basic file, shell and text 148 + manipulation utilities of the GNU operating system. These are 149 + the core utilities which are expected to exist on every 150 + operating system. 151 + ''; 152 + license = licenses.gpl3Plus; 153 + platforms = platforms.unix ++ platforms.windows; 154 + priority = 10; 155 + maintainers = [ maintainers.eelco ]; 156 + }; 157 + } // optionalAttrs stdenv.hostPlatform.isMusl { 158 + # Work around a bogus warning in conjunction with musl. 159 + NIX_CFLAGS_COMPILE = "-Wno-error"; 160 + } // lib.optionalAttrs stdenv.hostPlatform.isAndroid { 161 + NIX_CFLAGS_COMPILE = "-D__USE_FORTIFY_LEVEL=0"; 162 + })
+100
pkgs/tools/misc/coreutils/sys-getdents-undeclared.patch
··· 1 + From 10fcb97bd728f09d4a027eddf8ad2900f0819b0a Mon Sep 17 00:00:00 2001 2 + From: Paul Eggert <eggert@cs.ucla.edu> 3 + Date: Thu, 5 Mar 2020 17:25:29 -0800 4 + Subject: ls: restore 8.31 behavior on removed directories 5 + 6 + * NEWS: Mention this. 7 + * src/ls.c: Do not include <sys/sycall.h> 8 + (print_dir): Don't worry about whether the directory is removed. 9 + * tests/ls/removed-directory.sh: Adjust to match new (i.e., old) 10 + behavior. 11 + --- 12 + NEWS (removed diff in nixpkgs)| 6 ++++++ 13 + src/ls.c | 22 ---------------------- 14 + tests/ls/removed-directory.sh | 10 ++-------- 15 + 3 files changed, 8 insertions(+), 30 deletions(-) 16 + 17 + diff --git a/src/ls.c b/src/ls.c 18 + index 24b983287..4acf5f44d 100644 19 + --- a/src/ls.c 20 + +++ b/src/ls.c 21 + @@ -49,10 +49,6 @@ 22 + # include <sys/ptem.h> 23 + #endif 24 + 25 + -#ifdef __linux__ 26 + -# include <sys/syscall.h> 27 + -#endif 28 + - 29 + #include <stdio.h> 30 + #include <assert.h> 31 + #include <setjmp.h> 32 + @@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) 33 + struct dirent *next; 34 + uintmax_t total_blocks = 0; 35 + static bool first = true; 36 + - bool found_any_entries = false; 37 + 38 + errno = 0; 39 + dirp = opendir (name); 40 + @@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) 41 + next = readdir (dirp); 42 + if (next) 43 + { 44 + - found_any_entries = true; 45 + if (! file_ignored (next->d_name)) 46 + { 47 + enum filetype type = unknown; 48 + @@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg) 49 + if (errno != EOVERFLOW) 50 + break; 51 + } 52 + -#ifdef __linux__ 53 + - else if (! found_any_entries) 54 + - { 55 + - /* If readdir finds no directory entries at all, not even "." or 56 + - "..", then double check that the directory exists. */ 57 + - if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1 58 + - && errno != EINVAL) 59 + - { 60 + - /* We exclude EINVAL as that pertains to buffer handling, 61 + - and we've passed NULL as the buffer for simplicity. 62 + - ENOENT is returned if appropriate before buffer handling. */ 63 + - file_failure (command_line_arg, _("reading directory %s"), name); 64 + - } 65 + - break; 66 + - } 67 + -#endif 68 + else 69 + break; 70 + 71 + diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh 72 + index e8c835dab..fe8f929a1 100755 73 + --- a/tests/ls/removed-directory.sh 74 + +++ b/tests/ls/removed-directory.sh 75 + @@ -26,20 +26,14 @@ case $host_triplet in 76 + *) skip_ 'non linux kernel' ;; 77 + esac 78 + 79 + -LS_FAILURE=2 80 + - 81 + -cat <<\EOF >exp-err || framework_failure_ 82 + -ls: reading directory '.': No such file or directory 83 + -EOF 84 + - 85 + cwd=$(pwd) 86 + mkdir d || framework_failure_ 87 + cd d || framework_failure_ 88 + rmdir ../d || framework_failure_ 89 + 90 + -returns_ $LS_FAILURE ls >../out 2>../err || fail=1 91 + +ls >../out 2>../err || fail=1 92 + cd "$cwd" || framework_failure_ 93 + compare /dev/null out || fail=1 94 + -compare exp-err err || fail=1 95 + +compare /dev/null err || fail=1 96 + 97 + Exit $fail 98 + -- 99 + cgit v1.2.1 100 +
+7 -1
pkgs/top-level/all-packages.nix
··· 4225 4225 4226 4226 cpcfs = callPackage ../tools/filesystems/cpcfs { }; 4227 4227 4228 - coreutils = callPackage ../tools/misc/coreutils { }; 4228 + # coreutils 9 messes up some binary format on darwin 4229 + # https://github.com/NixOS/nixpkgs/pull/141684 4230 + # test by trying to build alacritty for example 4231 + coreutils = if !stdenv.isDarwin then 4232 + callPackage ../tools/misc/coreutils { } 4233 + else 4234 + callPackage ../tools/misc/coreutils/8.nix { }; 4229 4235 coreutils-full = coreutils.override { minimal = false; }; 4230 4236 coreutils-prefixed = coreutils.override { withPrefix = true; singleBinary = false; }; 4231 4237