lol

Merge #139541: coreutils: 8.32 -> 9.0 (into staging)

+119 -108
+11 -8
pkgs/tools/misc/coreutils/default.nix
··· 22 22 23 23 stdenv.mkDerivation (rec { 24 24 pname = "coreutils"; 25 - version = "8.32"; 25 + version = "9.0"; 26 26 27 27 src = fetchurl { 28 28 url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz"; 29 - sha256 = "sha256-RFjY3nhJ30TMqxXhaxVIsoUiTbul8I+sBwwcDgvMTPo="; 29 + sha256 = "sha256-zjCs30pBvFuzDdlV6eqnX6IWtOPesIiJ7TJDPHs7l84="; 30 30 }; 31 31 32 - patches = [ ./sys-getdents-undeclared.patch ] 32 + patches = [ ./fix-chmod-exit-code.patch ] 33 33 ++ optional stdenv.hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch 34 34 # fix gnulib tests on 32-bit ARM. Included on coreutils master. 35 35 # https://lists.gnu.org/r/bug-gnulib/2020-08/msg00225.html ··· 74 74 sed '2i print "Skipping id zero test"; exit 77' -i ./tests/id/zero.sh 75 75 sed '2i print "Skipping misc help-versiob test"; exit 77' -i ./tests/misc/help-version.sh 76 76 sed '2i print "Skipping chown separator test"; exit 77' -i ./tests/chown/separator.sh 77 - '' + optionalString (stdenv.hostPlatform.libc == "musl") (lib.concatStringsSep "\n" [ 77 + '' + (optionalString (stdenv.hostPlatform.libc == "musl") (lib.concatStringsSep "\n" [ 78 78 '' 79 79 echo "int main() { return 77; }" > gnulib-tests/test-parse-datetime.c 80 80 echo "int main() { return 77; }" > gnulib-tests/test-getlogin.c 81 81 '' 82 - ]); 82 + ])) + (optionalString stdenv.isAarch64 '' 83 + sed '2i print "Skipping tail assert test"; exit 77' -i ./tests/tail-2/assert.sh 84 + ''); 83 85 84 86 outputs = [ "out" "info" ]; 85 87 86 - nativeBuildInputs = [ perl xz.bin ] 87 - ++ optionals stdenv.hostPlatform.isCygwin [ autoreconfHook texinfo ]; # due to patch 88 + nativeBuildInputs = [ perl xz.bin autoreconfHook ] # autoreconfHook is due to patch, normally only needed for cygwin 89 + ++ optionals stdenv.hostPlatform.isCygwin [ texinfo ]; # due to patch 88 90 configureFlags = [ "--with-packager=https://NixOS.org" ] 89 91 ++ optional (singleBinary != false) 90 92 ("--enable-single-binary" + optionalString (isString singleBinary) "=${singleBinary}") 91 93 ++ optional withOpenssl "--with-openssl" 92 94 ++ optional stdenv.hostPlatform.isSunOS "ac_cv_func_inotify_init=no" 93 95 ++ optional withPrefix "--program-prefix=g" 96 + ++ optional stdenv.isDarwin "--disable-nls" # the shipped configure script doesn't enable nls, but using autoreconfHook does so which breaks the build 94 97 ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "glibc") [ 95 98 # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I 96 99 # don't know why it is not properly detected cross building with glibc. ··· 152 155 license = licenses.gpl3Plus; 153 156 platforms = platforms.unix ++ platforms.windows; 154 157 priority = 10; 155 - maintainers = [ maintainers.eelco ]; 158 + maintainers = [ maintainers.eelco maintainers.das_j ]; 156 159 }; 157 160 } // optionalAttrs stdenv.hostPlatform.isMusl { 158 161 # Work around a bogus warning in conjunction with musl.
+108
pkgs/tools/misc/coreutils/fix-chmod-exit-code.patch
··· 1 + From e8b56ebd536e82b15542a00c888109471936bfda Mon Sep 17 00:00:00 2001 2 + From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com> 3 + Date: Fri, 24 Sep 2021 20:57:41 +0100 4 + Subject: [PATCH] chmod: fix exit status when ignoring symlinks 5 + 6 + * src/chmod.c: Reorder enum so CH_NOT_APPLIED 7 + can be treated as a non error. 8 + * tests/chmod/ignore-symlink.sh: A new test. 9 + * tests/local.mk: Reference the new test. 10 + * NEWS: Mention the bug fix. 11 + Fixes https://bugs.gnu.org/50784 12 + --- 13 + NEWS | 6 ++++++ 14 + src/chmod.c | 4 ++-- 15 + tests/chmod/ignore-symlink.sh | 31 +++++++++++++++++++++++++++++++ 16 + tests/local.mk | 1 + 17 + 4 files changed, 40 insertions(+), 2 deletions(-) 18 + create mode 100755 tests/chmod/ignore-symlink.sh 19 + 20 + diff --git a/NEWS b/NEWS 21 + index a1470a7d7..1cb3c28a1 100644 22 + --- a/NEWS 23 + +++ b/NEWS 24 + @@ -2,6 +2,12 @@ GNU coreutils NEWS -*- outline -*- 25 + 26 + * Noteworthy changes in release ?.? (????-??-??) [?] 27 + 28 + +** Bug fixes 29 + + 30 + + chmod -R no longer exits with error status when encountering symlinks. 31 + + All files would be processed correctly, but the exit status was incorrect. 32 + + [bug introduced in coreutils-9.0] 33 + + 34 + 35 + * Noteworthy changes in release 9.0 (2021-09-24) [stable] 36 + 37 + diff --git a/src/chmod.c b/src/chmod.c 38 + index 37b04f500..57ac47f33 100644 39 + --- a/src/chmod.c 40 + +++ b/src/chmod.c 41 + @@ -44,8 +44,8 @@ struct change_status 42 + enum 43 + { 44 + CH_NO_STAT, 45 + - CH_NOT_APPLIED, 46 + CH_FAILED, 47 + + CH_NOT_APPLIED, 48 + CH_NO_CHANGE_REQUESTED, 49 + CH_SUCCEEDED 50 + } 51 + @@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent) 52 + if ( ! recurse) 53 + fts_set (fts, ent, FTS_SKIP); 54 + 55 + - return CH_NO_CHANGE_REQUESTED <= ch.status; 56 + + return CH_NOT_APPLIED <= ch.status; 57 + } 58 + 59 + /* Recursively change the modes of the specified FILES (the last entry 60 + diff --git a/tests/chmod/ignore-symlink.sh b/tests/chmod/ignore-symlink.sh 61 + new file mode 100755 62 + index 000000000..5ce3de816 63 + --- /dev/null 64 + +++ b/tests/chmod/ignore-symlink.sh 65 + @@ -0,0 +1,31 @@ 66 + +#!/bin/sh 67 + +# Test for proper exit code of chmod on a processed symlink. 68 + + 69 + +# Copyright (C) 2021 Free Software Foundation, Inc. 70 + + 71 + +# This program is free software: you can redistribute it and/or modify 72 + +# it under the terms of the GNU General Public License as published by 73 + +# the Free Software Foundation, either version 3 of the License, or 74 + +# (at your option) any later version. 75 + + 76 + +# This program is distributed in the hope that it will be useful, 77 + +# but WITHOUT ANY WARRANTY; without even the implied warranty of 78 + +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 79 + +# GNU General Public License for more details. 80 + + 81 + +# You should have received a copy of the GNU General Public License 82 + +# along with this program. If not, see <https://www.gnu.org/licenses/>. 83 + + 84 + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 85 + +print_ver_ chmod 86 + + 87 + +mkdir dir || framework_failure_ 88 + +touch dir/f || framework_failure_ 89 + +ln -s f dir/l || framework_failure_ 90 + + 91 + +# This operation ignores symlinks but should succeed. 92 + +chmod u+w -R dir 2> out || fail=1 93 + + 94 + +compare /dev/null out || fail=1 95 + + 96 + +Exit $fail 97 + diff --git a/tests/local.mk b/tests/local.mk 98 + index 228d0e368..b5b893fb7 100644 99 + --- a/tests/local.mk 100 + +++ b/tests/local.mk 101 + @@ -456,6 +456,7 @@ all_tests = \ 102 + tests/chmod/c-option.sh \ 103 + tests/chmod/equal-x.sh \ 104 + tests/chmod/equals.sh \ 105 + + tests/chmod/ignore-symlink.sh \ 106 + tests/chmod/inaccessible.sh \ 107 + tests/chmod/octal.sh \ 108 + tests/chmod/setgid.sh \
-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 -