coreutils: 9.0 -> 9.1
This commit is contained in:
parent
b20b6fa0d8
commit
a891659902
4 changed files with 3 additions and 287 deletions
|
@ -22,22 +22,13 @@ with lib;
|
|||
|
||||
stdenv.mkDerivation (rec {
|
||||
pname = "coreutils${optionalString (!minimal) "-full"}";
|
||||
version = "9.0";
|
||||
version = "9.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/coreutils/coreutils-${version}.tar.xz";
|
||||
sha256 = "sha256-zjCs30pBvFuzDdlV6eqnX6IWtOPesIiJ7TJDPHs7l84=";
|
||||
sha256 = "sha256:08q4b0w7mwfxbqjs712l6wrwl2ijs7k50kssgbryg9wbsw8g98b1";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./fix-chmod-exit-code.patch
|
||||
# Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51433
|
||||
./disable-seek-hole.patch
|
||||
# Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52330
|
||||
# This patch can be dropped, once we upgrade to the next coreutils version after 9.0
|
||||
./fix-arm64-macos.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# The test tends to fail on btrfs,f2fs and maybe other unusual filesystems.
|
||||
sed '2i echo Skipping dd sparse test && exit 77' -i ./tests/dd/sparse.sh
|
||||
|
@ -154,7 +145,7 @@ stdenv.mkDerivation (rec {
|
|||
license = licenses.gpl3Plus;
|
||||
platforms = platforms.unix ++ platforms.windows;
|
||||
priority = 10;
|
||||
maintainers = [ maintainers.eelco maintainers.das_j ];
|
||||
maintainers = [ maintainers.das_j ];
|
||||
};
|
||||
} // optionalAttrs stdenv.hostPlatform.isMusl {
|
||||
# Work around a bogus warning in conjunction with musl.
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
diff --git a/src/copy.c b/src/copy.c
|
||||
index cb9018f93..2a4ccc061 100644
|
||||
--- a/src/copy.c
|
||||
+++ b/src/copy.c
|
||||
@@ -502,7 +502,7 @@ write_zeros (int fd, off_t n_bytes)
|
||||
return true;
|
||||
}
|
||||
|
||||
-#ifdef SEEK_HOLE
|
||||
+#if 0
|
||||
/* Perform an efficient extent copy, if possible. This avoids
|
||||
the overhead of detecting holes in hole-introducing/preserving
|
||||
copy, and thus makes copying sparse files much more efficient.
|
||||
@@ -1095,7 +1095,7 @@ infer_scantype (int fd, struct stat const *sb,
|
||||
&& ST_NBLOCKS (*sb) < sb->st_size / ST_NBLOCKSIZE))
|
||||
return PLAIN_SCANTYPE;
|
||||
|
||||
-#ifdef SEEK_HOLE
|
||||
+#if 0
|
||||
scan_inference->ext_start = lseek (fd, 0, SEEK_DATA);
|
||||
if (0 <= scan_inference->ext_start)
|
||||
return LSEEK_SCANTYPE;
|
||||
@@ -1377,7 +1377,7 @@ copy_reg (char const *src_name, char const *dst_name,
|
||||
off_t n_read;
|
||||
bool wrote_hole_at_eof = false;
|
||||
if (! (
|
||||
-#ifdef SEEK_HOLE
|
||||
+#if 0
|
||||
scantype == LSEEK_SCANTYPE
|
||||
? lseek_copy (source_desc, dest_desc, buf, buf_size, hole_size,
|
||||
scan_inference.ext_start, src_open_sb.st_size,
|
||||
diff --git a/tests/seek-data-capable b/tests/seek-data-capable
|
||||
index cc6372214..6e7a9ec1e 100644
|
||||
--- a/tests/seek-data-capable
|
||||
+++ b/tests/seek-data-capable
|
||||
@@ -1,5 +1,7 @@
|
||||
import sys, os, errno, platform
|
||||
|
||||
+sys.exit(1)
|
||||
+
|
||||
# Pass an _empty_ file
|
||||
if len(sys.argv) != 2:
|
||||
sys.exit(1)
|
|
@ -1,124 +0,0 @@
|
|||
diff --git a/src/uname.c b/src/uname.c
|
||||
index ae9b8e29d..e84fc477a 100644
|
||||
--- a/src/uname.c
|
||||
+++ b/src/uname.c
|
||||
@@ -27,7 +27,7 @@
|
||||
# include <sys/systeminfo.h>
|
||||
#endif
|
||||
|
||||
-#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__
|
||||
+#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__ && ! defined __APPLE__
|
||||
# if HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h> /* needed for OpenBSD 3.0 */
|
||||
# endif
|
||||
@@ -44,11 +44,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
-#ifdef __APPLE__
|
||||
-# include <mach/machine.h>
|
||||
-# include <mach-o/arch.h>
|
||||
-#endif
|
||||
-
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
@@ -167,6 +162,24 @@ print_element (char const *element)
|
||||
fputs (element, stdout);
|
||||
}
|
||||
|
||||
+/* Print ELEMENT, preceded by a space if something has already been
|
||||
+ printed. But if the environment variable ENVVAR is set, print its
|
||||
+ value instead of ELEMENT. */
|
||||
+
|
||||
+static void
|
||||
+print_element_env (char const *element, char const *envvar)
|
||||
+{
|
||||
+#ifdef __APPLE__
|
||||
+ if (envvar)
|
||||
+ {
|
||||
+ char const *val = getenv (envvar);
|
||||
+ if (val)
|
||||
+ element = val;
|
||||
+ }
|
||||
+#endif
|
||||
+ print_element (element);
|
||||
+}
|
||||
+
|
||||
|
||||
/* Set all the option flags according to the switches specified.
|
||||
Return the mask indicating which elements to print. */
|
||||
@@ -287,26 +300,36 @@ main (int argc, char **argv)
|
||||
die (EXIT_FAILURE, errno, _("cannot get system name"));
|
||||
|
||||
if (toprint & PRINT_KERNEL_NAME)
|
||||
- print_element (name.sysname);
|
||||
+ print_element_env (name.sysname, "UNAME_SYSNAME");
|
||||
if (toprint & PRINT_NODENAME)
|
||||
- print_element (name.nodename);
|
||||
+ print_element_env (name.nodename, "UNAME_NODENAME");
|
||||
if (toprint & PRINT_KERNEL_RELEASE)
|
||||
- print_element (name.release);
|
||||
+ print_element_env (name.release, "UNAME_RELEASE");
|
||||
if (toprint & PRINT_KERNEL_VERSION)
|
||||
- print_element (name.version);
|
||||
+ print_element_env (name.version, "UNAME_VERSION");
|
||||
if (toprint & PRINT_MACHINE)
|
||||
- print_element (name.machine);
|
||||
+ print_element_env (name.machine, "UNAME_MACHINE");
|
||||
}
|
||||
|
||||
if (toprint & PRINT_PROCESSOR)
|
||||
{
|
||||
char const *element = unknown;
|
||||
+#ifdef __APPLE__
|
||||
+# if defined __arm__ || defined __arm64__
|
||||
+ element = "arm";
|
||||
+# elif defined __i386__ || defined __x86_64__
|
||||
+ element = "i386";
|
||||
+# elif defined __ppc__ || defined __ppc64__
|
||||
+ element = "powerpc";
|
||||
+# endif
|
||||
+#endif
|
||||
#if HAVE_SYSINFO && defined SI_ARCHITECTURE
|
||||
- {
|
||||
- static char processor[257];
|
||||
- if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
|
||||
- element = processor;
|
||||
- }
|
||||
+ if (element == unknown)
|
||||
+ {
|
||||
+ static char processor[257];
|
||||
+ if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
|
||||
+ element = processor;
|
||||
+ }
|
||||
#endif
|
||||
#ifdef UNAME_PROCESSOR
|
||||
if (element == unknown)
|
||||
@@ -316,26 +339,6 @@ main (int argc, char **argv)
|
||||
static int mib[] = { CTL_HW, UNAME_PROCESSOR };
|
||||
if (sysctl (mib, 2, processor, &s, 0, 0) >= 0)
|
||||
element = processor;
|
||||
-
|
||||
-# ifdef __APPLE__
|
||||
- /* This kludge works around a bug in Mac OS X. */
|
||||
- if (element == unknown)
|
||||
- {
|
||||
- cpu_type_t cputype;
|
||||
- size_t cs = sizeof cputype;
|
||||
- NXArchInfo const *ai;
|
||||
- if (sysctlbyname ("hw.cputype", &cputype, &cs, NULL, 0) == 0
|
||||
- && (ai = NXGetArchInfoFromCpuType (cputype,
|
||||
- CPU_SUBTYPE_MULTIPLE))
|
||||
- != NULL)
|
||||
- element = ai->name;
|
||||
-
|
||||
- /* Hack "safely" around the ppc vs. powerpc return value. */
|
||||
- if (cputype == CPU_TYPE_POWERPC
|
||||
- && STRNCMP_LIT (element, "ppc") == 0)
|
||||
- element = "powerpc";
|
||||
- }
|
||||
-# endif
|
||||
}
|
||||
#endif
|
||||
if (! (toprint == UINT_MAX && element == unknown))
|
|
@ -1,108 +0,0 @@
|
|||
From e8b56ebd536e82b15542a00c888109471936bfda Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Fri, 24 Sep 2021 20:57:41 +0100
|
||||
Subject: [PATCH] chmod: fix exit status when ignoring symlinks
|
||||
|
||||
* src/chmod.c: Reorder enum so CH_NOT_APPLIED
|
||||
can be treated as a non error.
|
||||
* tests/chmod/ignore-symlink.sh: A new test.
|
||||
* tests/local.mk: Reference the new test.
|
||||
* NEWS: Mention the bug fix.
|
||||
Fixes https://bugs.gnu.org/50784
|
||||
---
|
||||
NEWS | 6 ++++++
|
||||
src/chmod.c | 4 ++--
|
||||
tests/chmod/ignore-symlink.sh | 31 +++++++++++++++++++++++++++++++
|
||||
tests/local.mk | 1 +
|
||||
4 files changed, 40 insertions(+), 2 deletions(-)
|
||||
create mode 100755 tests/chmod/ignore-symlink.sh
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index a1470a7d7..1cb3c28a1 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -2,6 +2,12 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
+** Bug fixes
|
||||
+
|
||||
+ chmod -R no longer exits with error status when encountering symlinks.
|
||||
+ All files would be processed correctly, but the exit status was incorrect.
|
||||
+ [bug introduced in coreutils-9.0]
|
||||
+
|
||||
|
||||
* Noteworthy changes in release 9.0 (2021-09-24) [stable]
|
||||
|
||||
diff --git a/src/chmod.c b/src/chmod.c
|
||||
index 37b04f500..57ac47f33 100644
|
||||
--- a/src/chmod.c
|
||||
+++ b/src/chmod.c
|
||||
@@ -44,8 +44,8 @@ struct change_status
|
||||
enum
|
||||
{
|
||||
CH_NO_STAT,
|
||||
- CH_NOT_APPLIED,
|
||||
CH_FAILED,
|
||||
+ CH_NOT_APPLIED,
|
||||
CH_NO_CHANGE_REQUESTED,
|
||||
CH_SUCCEEDED
|
||||
}
|
||||
@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent)
|
||||
if ( ! recurse)
|
||||
fts_set (fts, ent, FTS_SKIP);
|
||||
|
||||
- return CH_NO_CHANGE_REQUESTED <= ch.status;
|
||||
+ return CH_NOT_APPLIED <= ch.status;
|
||||
}
|
||||
|
||||
/* Recursively change the modes of the specified FILES (the last entry
|
||||
diff --git a/tests/chmod/ignore-symlink.sh b/tests/chmod/ignore-symlink.sh
|
||||
new file mode 100755
|
||||
index 000000000..5ce3de816
|
||||
--- /dev/null
|
||||
+++ b/tests/chmod/ignore-symlink.sh
|
||||
@@ -0,0 +1,31 @@
|
||||
+#!/bin/sh
|
||||
+# Test for proper exit code of chmod on a processed symlink.
|
||||
+
|
||||
+# Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software: you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation, either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ chmod
|
||||
+
|
||||
+mkdir dir || framework_failure_
|
||||
+touch dir/f || framework_failure_
|
||||
+ln -s f dir/l || framework_failure_
|
||||
+
|
||||
+# This operation ignores symlinks but should succeed.
|
||||
+chmod u+w -R dir 2> out || fail=1
|
||||
+
|
||||
+compare /dev/null out || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 228d0e368..b5b893fb7 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -456,6 +456,7 @@ all_tests = \
|
||||
tests/chmod/c-option.sh \
|
||||
tests/chmod/equal-x.sh \
|
||||
tests/chmod/equals.sh \
|
||||
+ tests/chmod/ignore-symlink.sh \
|
||||
tests/chmod/inaccessible.sh \
|
||||
tests/chmod/octal.sh \
|
||||
tests/chmod/setgid.sh \
|
Loading…
Reference in a new issue