From 39d32b358ad5177bca181db4ece7a36e83ccab3cd7b9c0443a13786bec8613e1 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 21 Apr 2022 21:12:05 +0000 Subject: [PATCH 1/2] - update to 9.1: * chmod -R no longer exits with error status when encountering symlinks. All files would be processed correctly, but the exit status was incorrect. * If 'cp -Z A B' checks B's status and some other process then removes B, cp no longer creates B with a too-generous SELinux security context before adjusting it to the correct value. * 'cp --preserve=ownership A B' no longer ignores the umask when creating B. Also, 'cp --preserve-xattr A B' is less likely to temporarily chmod u+w B. * 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid. * 'ls -v' and 'sort -V' no longer mishandle corner cases like "a..a" vs "a.+" or lines containing NULs. Their behavior now matches the documentation for file names like ".m4" that consist entirely of an extension, and the documentation has been clarified for unusual cases. * 'mv -T --backup=numbered A B/' no longer miscalculates the backup number for B when A is a directory, possibly inflooping. * cat now uses the copy_file_range syscall if available, when doing simple copies between regular files. This may be more efficient, by avoiding user space copies, and possibly employing copy offloading or reflinking. * chown and chroot now warn about usages like "chown root.root f", which have the nonstandard and long-obsolete "." separator that causes problems on platforms where user names contain ".". Applications should use ":" instead of ".". * cksum no longer allows abbreviated algorithm names, so that forward compatibility and robustness is improved. * date +'%-N' now suppresses excess trailing digits, instead of always padding them with zeros to 9 digits. It uses clock_getres and clock_gettime to infer the clock resolution. * dd conv=fsync now synchronizes output even after a write error, and similarly for dd conv=fdatasync. * dd now counts bytes instead of blocks if a block count ends in "B". OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=325 --- coreutils-9.0.tar.xz | 3 - coreutils-9.0.tar.xz.sig | 16 - coreutils-9.1.tar.xz | 3 + coreutils-9.1.tar.xz.sig | 16 + ...s-chmod-fix-exit-status-ign-symlinks.patch | 119 --- coreutils-disable_tests.patch | 2 +- coreutils-i18n.patch | 754 +++++++++++------- coreutils-skip-gnulib-test-tls.patch | 2 +- coreutils-sysinfo.patch | 6 +- ...s-tests-shorten-extreme-factor-tests.patch | 2 +- coreutils.changes | 71 ++ coreutils.spec | 21 +- 12 files changed, 560 insertions(+), 455 deletions(-) delete mode 100644 coreutils-9.0.tar.xz delete mode 100644 coreutils-9.0.tar.xz.sig create mode 100644 coreutils-9.1.tar.xz create mode 100644 coreutils-9.1.tar.xz.sig delete mode 100644 coreutils-chmod-fix-exit-status-ign-symlinks.patch diff --git a/coreutils-9.0.tar.xz b/coreutils-9.0.tar.xz deleted file mode 100644 index e65a07f..0000000 --- a/coreutils-9.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce -size 5612752 diff --git a/coreutils-9.0.tar.xz.sig b/coreutils-9.0.tar.xz.sig deleted file mode 100644 index 8fe032e..0000000 --- a/coreutils-9.0.tar.xz.sig +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmFN1c4ACgkQ32/ZcTBg -N9mtfw/8D8BJrt2Ver2xdPfow5FYHT/zakUQ2b3ZIHP0Es62W56+pWtGombphrZu -4PkI1x6i4S8z06O9rWPIDGMPjyPV9UJbzAiGC7Px6tW6RFHZx0M+GNsKfcjmhtf7 -0v3jFF0g1IdrikFG1aYCAHZHy7n+yOm7xsfSmlYVlKcOVbCFN92ZBw0IohOSriSq -nJN6IOY8I3frhuI5kchY4wM6RMQ+ztNtG8odNvJI3kWCCL9pQFxzD8uorrvTiAcp -Qdbfz5TDnlVcXKR1gu6AAP+XThUYuxG5t/2Kghlril1zxnbDBZJsGteevyHsS7kY -grAWY4XqSvKVURGaKSSUhXlriQilPknBaichwEhAXvrUk1giviAzZ8CXB6WzzTvn -E9+ofC8RqTu345+ixkdZZu0TauOZWYIUVzKsD7W0ooQOT7OZeIQfb3+pbves/I+k -ZyiRLxfiUkAkKMUDrMr+okhqFA9fo/GCkFmHWj9m2NAc15kifEpSiCktfgoChbeG -ZiQFXQz090P+L1pk82qBXVgTjUyS5VEnXZoIkTWGzkHKySwreiaIjPQhS3cU2xAm -24i53zidj84Ib62Xa4jwxX7BzZqYRdbWAa/BUUNMov75W4dfkPlZ6qbRXtKnoOZf -u0ok3fgFvopGzwbw3l/HFp58jpaYL5S28gy10PpdOnxeO54XBn0= -=3TCC ------END PGP SIGNATURE----- diff --git a/coreutils-9.1.tar.xz b/coreutils-9.1.tar.xz new file mode 100644 index 0000000..734640d --- /dev/null +++ b/coreutils-9.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61a1f410d78ba7e7f37a5a4f50e6d1320aca33375484a3255eddf17a38580423 +size 5712104 diff --git a/coreutils-9.1.tar.xz.sig b/coreutils-9.1.tar.xz.sig new file mode 100644 index 0000000..3ce7c5d --- /dev/null +++ b/coreutils-9.1.tar.xz.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmJZ7qQACgkQ32/ZcTBg +N9mseQ/9HIe1s2ZCGOonUKI7HPp/x/qZXrq2R2/BL8+m9dMPfoIXa42DKu/LMpCK +amMuDIgfDbVp2Zky1cQ80d/lvYmkZXAIwUl0POrQiQkZ8fBsmZjQPKs4hTE4RmkX +7Y4n+KbOYPVkT+ROSq8O2fOL4++1kPoLFC6rkgylAR1t4836WzcNM33QCloyQlFU +CYQe57uSPfabDhswIQFraEPhIH0ZRQLAmcT2xuvlrbD8Uy9uakFrM8CFBVA9TpNu +KC7dShDErrTxfxlNfWLMD8vJu140if3hgGD45tNEM2VFSOhvQ07uoexwhLVSa+fw +cl114IAwAeBtz6ssE80vku8+pWmsAgfeqncn8DtEZ87Fa56N8u2QKuMZ/FjrxYwS +X9gHANJg5dzvVUB8ICvopGIs5iWXY5GhwaCuutSy/tsLp32Ytzv0FMtiKI1a6Msf +p8ojsFGnzQ2e4QRUBPKB2yxAZIlUvArFpsnebEPC47UBWbh4q/q6GA8omdLTF7N+ +xQsaCyUCcRov3S8lD/4p/r0NfYnL2Tnjq39v6dH8gAQpDB/xDCnP3jG6mufKp7tu +mf0Q/Jws+4FKs7yVyq6DCOtFiJnx410fMhsHpDnzEegldWD1K9TIjDEW4E3yotwt +I8mGBRbgYc19TEUmTIr40MLc0vE3up7pY5/TY1kRdsYFlOPLbiA= +=Npyd +-----END PGP SIGNATURE----- diff --git a/coreutils-chmod-fix-exit-status-ign-symlinks.patch b/coreutils-chmod-fix-exit-status-ign-symlinks.patch deleted file mode 100644 index 0f458cd..0000000 --- a/coreutils-chmod-fix-exit-status-ign-symlinks.patch +++ /dev/null @@ -1,119 +0,0 @@ -Upstream patch - remove with version >9.0: -chmod: fix exit status when ignoring symlinks - -As a deviation from the upstream patch, the entry in the NEWS files uses a -different section header. - -------------------------------------------------------------------- -Upstream patch: - https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=e8b56ebd5 - -From e8b56ebd536e82b15542a00c888109471936bfda Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?P=C3=A1draig=20Brady?= -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 | 9 +++++++++ - src/chmod.c | 4 ++-- - tests/chmod/ignore-symlink.sh | 31 +++++++++++++++++++++++++++++++ - tests/local.mk | 1 + - 4 files changed, 43 insertions(+), 2 deletions(-) - -Index: NEWS -=================================================================== ---- NEWS.orig -+++ NEWS -@@ -1,5 +1,14 @@ - GNU coreutils NEWS -*- outline -*- - -+* Noteworthy downstream changes on top of release 9.0 -+ -+** 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] - - ** Bug fixes -Index: src/chmod.c -=================================================================== ---- src/chmod.c.orig -+++ 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 -Index: tests/chmod/ignore-symlink.sh -=================================================================== ---- /dev/null -+++ 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 . -+ -+. "${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 -Index: tests/local.mk -=================================================================== ---- tests/local.mk.orig -+++ tests/local.mk -@@ -458,6 +458,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 \ diff --git a/coreutils-disable_tests.patch b/coreutils-disable_tests.patch index 111ae6a..a087dc1 100644 --- a/coreutils-disable_tests.patch +++ b/coreutils-disable_tests.patch @@ -6,7 +6,7 @@ Index: gnulib-tests/gnulib.mk =================================================================== --- gnulib-tests/gnulib.mk.orig +++ gnulib-tests/gnulib.mk -@@ -1035,10 +1035,10 @@ EXTRA_DIST += test-getloadavg.c signatur +@@ -1073,10 +1073,10 @@ EXTRA_DIST += test-getloadavg.c signatur ## begin gnulib module getlogin-tests diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 6e54250..059f254 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,48 +1,48 @@ - bootstrap.conf | 1 - configure.ac | 2 - lib/linebuffer.h | 8 - lib/mbfile.c | 3 - lib/mbfile.h | 255 ++++++++++++++ - m4/mbfile.m4 | 14 - src/cut.c | 441 ++++++++++++++++++++++++- - src/expand-common.c | 114 ++++++ - src/expand-common.h | 12 - src/expand.c | 90 ++++- - src/fold.c | 312 ++++++++++++++++- - src/join.c | 359 +++++++++++++++++--- - src/local.mk | 4 - src/pr.c | 443 ++++++++++++++++++++++--- - src/sort.c | 772 +++++++++++++++++++++++++++++++++++++++++--- - src/unexpand.c | 101 ++++- - src/uniq.c | 119 ++++++ - tests/Coreutils.pm | 3 - tests/expand/mb.sh | 183 ++++++++++ - tests/i18n/sort.sh | 29 + - tests/local.mk | 4 - tests/misc/expand.pl | 42 ++ - tests/misc/fold.pl | 50 ++ - tests/misc/join.pl | 50 ++ - tests/misc/sort-mb-tests.sh | 45 ++ - tests/misc/sort-merge.pl | 42 ++ - tests/misc/sort.pl | 40 ++ - tests/misc/unexpand.pl | 39 ++ - tests/misc/uniq.pl | 55 +++ - tests/pr/pr-tests.pl | 49 ++ - tests/unexpand/mb.sh | 172 +++++++++ - 31 files changed, 3640 insertions(+), 213 deletions(-) + bootstrap.conf | 1 + + configure.ac | 2 + + lib/linebuffer.h | 8 + + lib/mbfile.c | 3 + + lib/mbfile.h | 255 ++++++++++++ + m4/mbfile.m4 | 14 + + src/cut.c | 508 +++++++++++++++++++++-- + src/expand-common.c | 114 ++++++ + src/expand-common.h | 12 + + src/expand.c | 90 +++- + src/fold.c | 312 ++++++++++++-- + src/join.c | 359 ++++++++++++++-- + src/local.mk | 4 +- + src/pr.c | 443 ++++++++++++++++++-- + src/sort.c | 792 +++++++++++++++++++++++++++++++++--- + src/unexpand.c | 101 ++++- + src/uniq.c | 119 +++++- + tests/Coreutils.pm | 3 + + tests/expand/mb.sh | 183 +++++++++ + tests/i18n/sort.sh | 29 ++ + tests/local.mk | 4 + + tests/misc/expand.pl | 42 ++ + tests/misc/fold.pl | 50 ++- + tests/misc/join.pl | 50 +++ + tests/misc/sort-mb-tests.sh | 45 ++ + tests/misc/sort-merge.pl | 42 ++ + tests/misc/sort.pl | 40 +- + tests/misc/unexpand.pl | 39 ++ + tests/misc/uniq.pl | 55 +++ + tests/pr/pr-tests.pl | 49 +++ + tests/unexpand/mb.sh | 172 ++++++++ + 31 files changed, 3698 insertions(+), 242 deletions(-) create mode 100644 lib/mbfile.c create mode 100644 lib/mbfile.h create mode 100644 m4/mbfile.m4 - create mode 100644 tests/expand/mb.sh - create mode 100644 tests/i18n/sort.sh - create mode 100644 tests/misc/sort-mb-tests.sh - create mode 100644 tests/unexpand/mb.sh + create mode 100755 tests/expand/mb.sh + create mode 100755 tests/i18n/sort.sh + create mode 100755 tests/misc/sort-mb-tests.sh + create mode 100755 tests/unexpand/mb.sh -Index: bootstrap.conf -=================================================================== ---- bootstrap.conf.orig -+++ bootstrap.conf -@@ -156,6 +156,7 @@ gnulib_modules=" +diff --git a/bootstrap.conf b/bootstrap.conf +index c1399e3..60b39cf 100644 +--- a/bootstrap.conf ++++ b/bootstrap.conf +@@ -162,6 +162,7 @@ gnulib_modules=" maintainer-makefile malloc-gnu manywarnings @@ -50,11 +50,11 @@ Index: bootstrap.conf mbrlen mbrtowc mbsalign -Index: configure.ac -=================================================================== ---- configure.ac.orig -+++ configure.ac -@@ -457,6 +457,8 @@ fi +diff --git a/configure.ac b/configure.ac +index 7e4afc9..4656a35 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -476,6 +476,8 @@ fi # I'm leaving it here for now. This whole thing needs to be modernized... gl_WINSIZE_IN_PTEM @@ -63,10 +63,10 @@ Index: configure.ac gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no && \ -Index: lib/linebuffer.h -=================================================================== ---- lib/linebuffer.h.orig -+++ lib/linebuffer.h +diff --git a/lib/linebuffer.h b/lib/linebuffer.h +index 07d45ca..af62e6c 100644 +--- a/lib/linebuffer.h ++++ b/lib/linebuffer.h @@ -22,6 +22,11 @@ # include "idx.h" # include @@ -89,18 +89,20 @@ Index: lib/linebuffer.h }; /* Initialize linebuffer LINEBUFFER for use. */ -Index: lib/mbfile.c -=================================================================== +diff --git a/lib/mbfile.c b/lib/mbfile.c +new file mode 100644 +index 0000000..b0a468e --- /dev/null -+++ lib/mbfile.c ++++ b/lib/mbfile.c @@ -0,0 +1,3 @@ +#include +#define MBFILE_INLINE _GL_EXTERN_INLINE +#include "mbfile.h" -Index: lib/mbfile.h -=================================================================== +diff --git a/lib/mbfile.h b/lib/mbfile.h +new file mode 100644 +index 0000000..11f1b12 --- /dev/null -+++ lib/mbfile.h ++++ b/lib/mbfile.h @@ -0,0 +1,255 @@ +/* Multibyte character I/O: macros for multi-byte encodings. + Copyright (C) 2001, 2005, 2009-2015 Free Software Foundation, Inc. @@ -357,10 +359,11 @@ Index: lib/mbfile.h +_GL_INLINE_HEADER_BEGIN + +#endif /* _MBFILE_H */ -Index: m4/mbfile.m4 -=================================================================== +diff --git a/m4/mbfile.m4 b/m4/mbfile.m4 +new file mode 100644 +index 0000000..8589902 --- /dev/null -+++ m4/mbfile.m4 ++++ b/m4/mbfile.m4 @@ -0,0 +1,14 @@ +# mbfile.m4 serial 7 +dnl Copyright (C) 2005, 2008-2015 Free Software Foundation, Inc. @@ -376,10 +379,10 @@ Index: m4/mbfile.m4 + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) -Index: src/cut.c -=================================================================== ---- src/cut.c.orig -+++ src/cut.c +diff --git a/src/cut.c b/src/cut.c +index 6fd8978..faef877 100644 +--- a/src/cut.c ++++ b/src/cut.c @@ -28,6 +28,11 @@ #include #include @@ -474,23 +477,26 @@ Index: src/cut.c /* This buffer is used to support the semantics of the -s option (or lack of same) when the specified field list includes (does not include) the first field. In both of those cases, the entire -@@ -76,15 +142,25 @@ enum operating_mode - { - undefined_mode, +@@ -72,6 +138,29 @@ static char *field_1_buffer; + /* The number of bytes allocated for FIELD_1_BUFFER. */ + static size_t field_1_bufsize; -- /* Output characters that are in the given bytes. */ ++enum operating_mode ++ { ++ undefined_mode, ++ + /* Output bytes that are at the given positions. */ - byte_mode, - ++ byte_mode, ++ + /* Output characters that are at the given positions. */ + character_mode, + - /* Output the given delimiter-separated fields. */ - field_mode - }; - - static enum operating_mode operating_mode; - ++ /* Output the given delimiter-separated fields. */ ++ field_mode ++ }; ++ ++static enum operating_mode operating_mode; ++ +/* If nonzero, when in byte mode, don't split multibyte characters. */ +static int byte_mode_character_aware; + @@ -501,7 +507,7 @@ Index: src/cut.c /* If true do not output lines containing no delimiter characters. Otherwise, all such lines are printed. This option is valid only with field mode. */ -@@ -96,6 +172,9 @@ static bool complement; +@@ -83,10 +172,16 @@ static bool complement; /* The delimiter character for field mode. */ static unsigned char delim; @@ -511,7 +517,24 @@ Index: src/cut.c /* The delimiter for each line/record. */ static unsigned char line_delim = '\n'; -@@ -163,7 +242,7 @@ Print selected parts of lines from each + ++/* True if the --output-delimiter=STRING option was specified. */ ++static bool output_delimiter_specified; ++ + /* The length of output_delimiter_string. */ + static size_t output_delimiter_length; + +@@ -94,9 +189,6 @@ static size_t output_delimiter_length; + string consisting of the input delimiter. */ + static char *output_delimiter_string; + +-/* The output delimiter string contents, if the default. */ +-static char output_delimiter_default[1]; +- + /* True if we have ever read standard input. */ + static bool have_read_stdin; + +@@ -150,7 +242,7 @@ Print selected parts of lines from each FILE to standard output.\n\ -f, --fields=LIST select only these fields; also print any line\n\ that contains no delimiter character, unless\n\ the -s option is specified\n\ @@ -520,7 +543,16 @@ Index: src/cut.c "), stdout); fputs (_("\ --complement complement the set of selected bytes, characters\n\ -@@ -279,6 +358,82 @@ cut_bytes (FILE *stream) +@@ -250,7 +342,7 @@ cut_bytes (FILE *stream) + next_item (&byte_idx); + if (print_kth (byte_idx)) + { +- if (output_delimiter_string != output_delimiter_default) ++ if (output_delimiter_specified) + { + if (print_delimiter && is_range_start_index (byte_idx)) + { +@@ -266,6 +358,82 @@ cut_bytes (FILE *stream) } } @@ -603,10 +635,11 @@ Index: src/cut.c /* Read from stream STREAM, printing to standard output any selected fields. */ static void -@@ -424,13 +579,211 @@ cut_fields (FILE *stream) +@@ -411,11 +579,218 @@ cut_fields (FILE *stream) } } +-/* Process file FILE to standard output, using CUT_STREAM. +#if HAVE_MBRTOWC +static void +cut_fields_mb (FILE *stream) @@ -764,11 +797,9 @@ Index: src/cut.c +} +#endif + - static void - cut_stream (FILE *stream) - { -- if (operating_mode == byte_mode) -- cut_bytes (stream); ++static void ++cut_stream (FILE *stream) ++{ +#if HAVE_MBRTOWC + if (MB_CUR_MAX > 1 && !force_singlebyte_mode) + { @@ -806,8 +837,7 @@ Index: src/cut.c + abort (); + } + } - else -- cut_fields (stream); ++ else +#endif + { + if (operating_mode == field_mode) @@ -815,29 +845,51 @@ Index: src/cut.c + else + cut_bytes (stream); + } - } ++} ++ ++/* Process file FILE to standard output. + Return true if successful. */ - /* Process file FILE to standard output. -@@ -482,6 +835,7 @@ main (int argc, char **argv) + static bool +-cut_file (char const *file, void (*cut_stream) (FILE *)) ++cut_file (char const *file) + { + FILE *stream; + +@@ -459,8 +834,8 @@ main (int argc, char **argv) + int optc; bool ok; bool delim_specified = false; - char *spec_list_string IF_LINT ( = NULL); +- bool byte_mode = false; +- char *spec_list_string = NULL; ++ char *spec_list_string IF_LINT ( = NULL); + char mbdelim[MB_LEN_MAX + 1]; initialize_main (&argc, &argv); set_program_name (argv[0]); -@@ -504,7 +858,6 @@ main (int argc, char **argv) +@@ -470,6 +845,8 @@ main (int argc, char **argv) + + atexit (close_stdout); + ++ operating_mode = undefined_mode; ++ + /* By default, all non-delimited lines are printed. */ + suppress_non_delimited = false; + +@@ -481,35 +858,77 @@ main (int argc, char **argv) switch (optc) { case 'b': - case 'c': /* Build the byte list. */ - if (operating_mode != undefined_mode) - FATAL_ERROR (_("only one type of list may be specified")); -@@ -512,6 +865,14 @@ main (int argc, char **argv) - spec_list_string = optarg; - break; - +- byte_mode = true; +- FALLTHROUGH; ++ if (operating_mode != undefined_mode) ++ FATAL_ERROR (_("only one type of list may be specified")); ++ operating_mode = byte_mode; ++ spec_list_string = optarg; ++ break; ++ + case 'c': + /* Build the character list. */ + if (operating_mode != undefined_mode) @@ -848,8 +900,14 @@ Index: src/cut.c + case 'f': /* Build the field list. */ - if (operating_mode != undefined_mode) -@@ -523,10 +884,38 @@ main (int argc, char **argv) +- if (spec_list_string) +- FATAL_ERROR (_("only one list may be specified")); ++ if (operating_mode != undefined_mode) ++ FATAL_ERROR (_("only one type of list may be specified")); ++ operating_mode = field_mode; + spec_list_string = optarg; + break; + case 'd': /* New delimiter. */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ @@ -892,7 +950,13 @@ Index: src/cut.c break; case OUTPUT_DELIMITER_OPTION: -@@ -539,6 +928,7 @@ main (int argc, char **argv) ++ output_delimiter_specified = true; + /* Interpret --output-delimiter='' to mean + 'use the NUL byte as the delimiter.' */ + output_delimiter_length = (optarg[0] == '\0' + ? 1 : strlen (optarg)); +- output_delimiter_string = optarg; ++ output_delimiter_string = xstrdup (optarg); break; case 'n': @@ -900,8 +964,34 @@ Index: src/cut.c break; case 's': -@@ -578,15 +968,34 @@ main (int argc, char **argv) - | (complement ? SETFLD_COMPLEMENT : 0) ); +@@ -533,40 +952,57 @@ main (int argc, char **argv) + } + } + +- if (!spec_list_string) ++ if (operating_mode == undefined_mode) + FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); + +- if (byte_mode) +- { +- if (delim_specified) +- FATAL_ERROR (_("an input delimiter may be specified only\ ++ if (delim_specified && operating_mode != field_mode) ++ FATAL_ERROR (_("an input delimiter may be specified only\ + when operating on fields")); + +- if (suppress_non_delimited) +- FATAL_ERROR (_("suppressing non-delimited lines makes sense\n\ ++ if (suppress_non_delimited && operating_mode != field_mode) ++ FATAL_ERROR (_("suppressing non-delimited lines makes sense\n\ + \tonly when operating on fields")); +- } + + set_fields (spec_list_string, +- ((byte_mode ? SETFLD_ERRMSG_USE_POS : 0) +- | (complement ? SETFLD_COMPLEMENT : 0))); ++ ( (operating_mode == field_mode) ? 0 : SETFLD_ERRMSG_USE_POS) ++ | (complement ? SETFLD_COMPLEMENT : 0) ); if (!delim_specified) - delim = '\t'; @@ -917,10 +1007,8 @@ Index: src/cut.c if (output_delimiter_string == NULL) { -- static char dummy[2]; -- dummy[0] = delim; -- dummy[1] = '\0'; -- output_delimiter_string = dummy; +- output_delimiter_default[0] = delim; +- output_delimiter_string = output_delimiter_default; - output_delimiter_length = 1; +#ifdef HAVE_MBRTOWC + if (MB_CUR_MAX > 1 && !force_singlebyte_mode) @@ -940,11 +1028,21 @@ Index: src/cut.c + } } +- void (*cut_stream) (FILE *) = byte_mode ? cut_bytes : cut_fields; if (optind == argc) -Index: src/expand-common.c -=================================================================== ---- src/expand-common.c.orig -+++ src/expand-common.c +- ok = cut_file ("-", cut_stream); ++ ok = cut_file ("-"); + else + for (ok = true; optind < argc; optind++) +- ok &= cut_file (argv[optind], cut_stream); ++ ok &= cut_file (argv[optind]); + + + if (have_read_stdin && fclose (stdin) == EOF) +diff --git a/src/expand-common.c b/src/expand-common.c +index deec1bd..b39f740 100644 +--- a/src/expand-common.c ++++ b/src/expand-common.c @@ -19,6 +19,7 @@ #include #include @@ -1073,10 +1171,10 @@ Index: src/expand-common.c /* Add the comma or blank separated list of tab stops STOPS to the list of tab stops. */ extern void -Index: src/expand-common.h -=================================================================== ---- src/expand-common.h.orig -+++ src/expand-common.h +diff --git a/src/expand-common.h b/src/expand-common.h +index 5f59a0e..835b9d5 100644 +--- a/src/expand-common.h ++++ b/src/expand-common.h @@ -25,6 +25,18 @@ extern size_t max_column_width; /* The desired exit status. */ extern int exit_status; @@ -1096,10 +1194,10 @@ Index: src/expand-common.h /* Add tab stop TABVAL to the end of 'tab_list'. */ extern void add_tab_stop (uintmax_t tabval); -Index: src/expand.c -=================================================================== ---- src/expand.c.orig -+++ src/expand.c +diff --git a/src/expand.c b/src/expand.c +index ed78ca8..a4cefa1 100644 +--- a/src/expand.c ++++ b/src/expand.c @@ -37,6 +37,9 @@ #include #include @@ -1141,12 +1239,12 @@ Index: src/expand.c + } + } + - ++ + if (found_bom == true) + { + print_bom(); + } -+ + + while (true) + { /* If true, perform translations. */ @@ -1252,10 +1350,10 @@ Index: src/expand.c } } -Index: src/fold.c -=================================================================== ---- src/fold.c.orig -+++ src/fold.c +diff --git a/src/fold.c b/src/fold.c +index f07a90b..d32dbfd 100644 +--- a/src/fold.c ++++ b/src/fold.c @@ -22,12 +22,34 @@ #include #include @@ -1337,7 +1435,7 @@ Index: src/fold.c {"spaces", no_argument, NULL, 's'}, {"width", required_argument, NULL, 'w'}, {GETOPT_HELP_OPTION_DECL}, -@@ -76,6 +119,7 @@ Wrap input lines in each FILE, writing t +@@ -76,6 +119,7 @@ Wrap input lines in each FILE, writing to standard output.\n\ fputs (_("\ -b, --bytes count bytes rather than columns\n\ @@ -1345,7 +1443,7 @@ Index: src/fold.c -s, --spaces break at spaces\n\ -w, --width=WIDTH use WIDTH columns instead of 80\n\ "), stdout); -@@ -93,7 +137,7 @@ Wrap input lines in each FILE, writing t +@@ -93,7 +137,7 @@ Wrap input lines in each FILE, writing to standard output.\n\ static size_t adjust_column (size_t column, char c) { @@ -1387,7 +1485,7 @@ Index: src/fold.c fadvise (istream, FADVISE_SEQUENTIAL); -@@ -169,6 +197,15 @@ fold_file (char const *filename, size_t +@@ -169,6 +197,15 @@ fold_file (char const *filename, size_t width) bool found_blank = false; size_t logical_end = offset_out; @@ -1403,7 +1501,7 @@ Index: src/fold.c /* Look for the last blank. */ while (logical_end) { -@@ -215,13 +252,225 @@ fold_file (char const *filename, size_t +@@ -215,13 +252,225 @@ fold_file (char const *filename, size_t width) line_out[offset_out++] = c; } @@ -1658,10 +1756,10 @@ Index: src/fold.c break; case 's': /* Break at word boundaries. */ -Index: src/join.c -=================================================================== ---- src/join.c.orig -+++ src/join.c +diff --git a/src/join.c b/src/join.c +index f2fd172..6c7d1ed 100644 +--- a/src/join.c ++++ b/src/join.c @@ -22,19 +22,33 @@ #include #include @@ -1714,7 +1812,7 @@ Index: src/join.c /* If nonzero, check that the input is correctly ordered. */ static enum -@@ -276,13 +292,14 @@ xfields (struct line *line) +@@ -280,13 +296,14 @@ xfields (struct line *line) if (ptr == lim) return; @@ -1732,7 +1830,7 @@ Index: src/join.c { /* Skip leading blanks before the first field. */ while (field_sep (*ptr)) -@@ -306,6 +323,147 @@ xfields (struct line *line) +@@ -310,6 +327,147 @@ xfields (struct line *line) extract_field (line, ptr, lim - ptr); } @@ -1880,7 +1978,7 @@ Index: src/join.c static void freeline (struct line *line) { -@@ -327,56 +485,133 @@ keycmp (struct line const *line1, struct +@@ -331,56 +489,133 @@ keycmp (struct line const *line1, struct line const *line2, size_t jf_1, size_t jf_2) { /* Start of field to compare in each file. */ @@ -2037,7 +2135,7 @@ Index: src/join.c } /* Check that successive input lines PREV and CURRENT from input file -@@ -468,6 +703,11 @@ get_line (FILE *fp, struct line **linep, +@@ -472,6 +707,11 @@ get_line (FILE *fp, struct line **linep, int which) } ++line_no[which - 1]; @@ -2049,7 +2147,7 @@ Index: src/join.c xfields (line); if (prevline[which - 1]) -@@ -563,21 +803,28 @@ prfield (size_t n, struct line const *li +@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *line) /* Output all the fields in line, other than the join field. */ @@ -2081,7 +2179,7 @@ Index: src/join.c prfield (i, line); } } -@@ -588,7 +835,6 @@ static void +@@ -592,7 +839,6 @@ static void prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; @@ -2089,7 +2187,7 @@ Index: src/join.c size_t field; struct line const *line; -@@ -622,7 +868,7 @@ prjoin (struct line const *line1, struct +@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct line const *line2) o = o->next; if (o == NULL) break; @@ -2098,7 +2196,7 @@ Index: src/join.c } putchar (eolchar); } -@@ -1098,20 +1344,43 @@ main (int argc, char **argv) +@@ -1102,20 +1348,43 @@ main (int argc, char **argv) case 't': { @@ -2151,10 +2249,25 @@ Index: src/join.c } break; -Index: src/pr.c -=================================================================== ---- src/pr.c.orig -+++ src/pr.c +diff --git a/src/local.mk b/src/local.mk +index e1d15ce..1a5ffaa 100644 +--- a/src/local.mk ++++ b/src/local.mk +@@ -434,8 +434,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS) + src_basenc_SOURCES = src/basenc.c + src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS) + +-src_expand_SOURCES = src/expand.c src/expand-common.c +-src_unexpand_SOURCES = src/unexpand.c src/expand-common.c ++src_expand_SOURCES = src/expand.c src/expand-common.c lib/mbfile.c ++src_unexpand_SOURCES = src/unexpand.c src/expand-common.c lib/mbfile.c + + src_wc_SOURCES = src/wc.c + if USE_AVX2_WC_LINECOUNT +diff --git a/src/pr.c b/src/pr.c +index 4c17c00..b4fab1c 100644 +--- a/src/pr.c ++++ b/src/pr.c @@ -311,6 +311,24 @@ #include @@ -2290,7 +2403,7 @@ Index: src/pr.c static char *column_separator = (char *) " "; static char *line_separator = (char *) "\t"; -@@ -852,6 +905,13 @@ separator_string (char const *optarg_S) +@@ -853,6 +906,13 @@ separator_string (char const *optarg_S) integer_overflow (); col_sep_length = len; col_sep_string = optarg_S; @@ -2304,7 +2417,7 @@ Index: src/pr.c } int -@@ -876,6 +936,21 @@ main (int argc, char **argv) +@@ -877,6 +937,21 @@ main (int argc, char **argv) atexit (close_stdout); @@ -2326,7 +2439,7 @@ Index: src/pr.c n_files = 0; file_names = (argc > 1 ? xnmalloc (argc - 1, sizeof (char *)) -@@ -952,8 +1027,12 @@ main (int argc, char **argv) +@@ -953,8 +1028,12 @@ main (int argc, char **argv) break; case 'e': if (optarg) @@ -2341,7 +2454,7 @@ Index: src/pr.c /* Could check tab width > 0. */ untabify_input = true; break; -@@ -966,8 +1045,12 @@ main (int argc, char **argv) +@@ -967,8 +1046,12 @@ main (int argc, char **argv) break; case 'i': if (optarg) @@ -2356,7 +2469,7 @@ Index: src/pr.c /* Could check tab width > 0. */ tabify_output = true; break; -@@ -985,8 +1068,8 @@ main (int argc, char **argv) +@@ -986,8 +1069,8 @@ main (int argc, char **argv) case 'n': numbered_lines = true; if (optarg) @@ -2367,7 +2480,7 @@ Index: src/pr.c break; case 'N': skip_count = false; -@@ -1011,6 +1094,7 @@ main (int argc, char **argv) +@@ -1012,6 +1095,7 @@ main (int argc, char **argv) /* Reset an additional input of -s, -S dominates -s */ col_sep_string = ""; col_sep_length = 0; @@ -2375,7 +2488,7 @@ Index: src/pr.c use_col_separator = true; if (optarg) separator_string (optarg); -@@ -1166,10 +1250,45 @@ getoptnum (char const *n_str, int min, i +@@ -1166,10 +1250,45 @@ getoptnum (char const *n_str, int min, int *num, char const *err) a number. */ static void @@ -2593,7 +2706,7 @@ Index: src/pr.c /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2284,7 +2415,7 @@ print_clump (COLUMN *p, int n, char *clu +@@ -2284,7 +2415,7 @@ print_clump (COLUMN *p, int n, char *clump) required number of tabs and spaces. */ static void @@ -2917,10 +3030,10 @@ Index: src/pr.c /* We've just printed some files and need to clean up things before looking for more options and printing the next batch of files. -Index: src/sort.c -=================================================================== ---- src/sort.c.orig -+++ src/sort.c +diff --git a/src/sort.c b/src/sort.c +index 3b775d6..a0ba243 100644 +--- a/src/sort.c ++++ b/src/sort.c @@ -29,6 +29,14 @@ #include #include @@ -2936,9 +3049,9 @@ Index: src/sort.c #include "system.h" #include "argmatch.h" #include "die.h" -@@ -157,14 +165,39 @@ static int decimal_point; - /* Thousands separator; if -1, then there isn't one. */ - static int thousands_sep; +@@ -159,14 +167,39 @@ static int thousands_sep; + /* We currently ignore multi-byte grouping chars. */ + static bool thousands_sep_ignored; +/* True if -f is specified. */ +static bool folding; @@ -2977,9 +3090,9 @@ Index: src/sort.c /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; -@@ -338,13 +371,11 @@ static bool reverse; - they were read if all keys compare equal. */ - static bool stable; +@@ -343,13 +376,11 @@ static bool stable; + /* An int value outside char range. */ + enum { NON_CHAR = CHAR_MAX + 1 }; -/* If TAB has this value, blanks separate fields. */ -enum { TAB_DEFAULT = CHAR_MAX + 1 }; @@ -2994,7 +3107,7 @@ Index: src/sort.c /* Flag to remove consecutive duplicate lines from the output. Only the last of a sequence of equal lines will be output. */ -@@ -802,6 +833,46 @@ reap_all (void) +@@ -805,6 +836,46 @@ reap_all (void) reap (-1); } @@ -3041,7 +3154,7 @@ Index: src/sort.c /* Clean up any remaining temporary files. */ static void -@@ -1269,7 +1340,7 @@ zaptemp (char const *name) +@@ -1272,7 +1343,7 @@ zaptemp (char const *name) free (node); } @@ -3050,7 +3163,7 @@ Index: src/sort.c static int struct_month_cmp (void const *m1, void const *m2) -@@ -1284,7 +1355,7 @@ struct_month_cmp (void const *m1, void c +@@ -1287,7 +1358,7 @@ struct_month_cmp (void const *m1, void const *m2) /* Initialize the character class tables. */ static void @@ -3059,7 +3172,7 @@ Index: src/sort.c { size_t i; -@@ -1296,7 +1367,7 @@ inittables (void) +@@ -1299,7 +1370,7 @@ inittables (void) fold_toupper[i] = toupper (i); } @@ -3068,7 +3181,7 @@ Index: src/sort.c /* If we're not in the "C" locale, read different names for months. */ if (hard_LC_TIME) { -@@ -1378,6 +1449,84 @@ specify_nmerge (int oi, char c, char con +@@ -1381,6 +1452,84 @@ specify_nmerge (int oi, char c, char const *s) xstrtol_fatal (e, oi, c, long_options, s); } @@ -3153,7 +3266,7 @@ Index: src/sort.c /* Specify the amount of main memory to use when sorting. */ static void specify_sort_size (int oi, char c, char const *s) -@@ -1609,7 +1758,7 @@ buffer_linelim (struct buffer const *buf +@@ -1612,7 +1761,7 @@ buffer_linelim (struct buffer const *buf) by KEY in LINE. */ static char * @@ -3162,7 +3275,7 @@ Index: src/sort.c { char *ptr = line->text, *lim = ptr + line->length - 1; size_t sword = key->sword; -@@ -1618,10 +1767,10 @@ begfield (struct line const *line, struc +@@ -1621,10 +1770,10 @@ begfield (struct line const *line, struct keyfield const *key) /* The leading field separator itself is included in a field when -t is absent. */ @@ -3175,7 +3288,7 @@ Index: src/sort.c ++ptr; if (ptr < lim) ++ptr; -@@ -1647,11 +1796,70 @@ begfield (struct line const *line, struc +@@ -1650,12 +1799,71 @@ begfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -3241,13 +3354,14 @@ Index: src/sort.c /* Return the limit of (a pointer to the first character after) the field in LINE specified by KEY. */ - static char * _GL_ATTRIBUTE_PURE + ATTRIBUTE_PURE + static char * -limfield (struct line const *line, struct keyfield const *key) +limfield_uni (struct line const *line, struct keyfield const *key) { char *ptr = line->text, *lim = ptr + line->length - 1; size_t eword = key->eword, echar = key->echar; -@@ -1666,10 +1874,10 @@ limfield (struct line const *line, struc +@@ -1670,10 +1878,10 @@ limfield (struct line const *line, struct keyfield const *key) 'beginning' is the first character following the delimiting TAB. Otherwise, leave PTR pointing at the first 'blank' character after the preceding field. */ @@ -3260,7 +3374,7 @@ Index: src/sort.c ++ptr; if (ptr < lim && (eword || echar)) ++ptr; -@@ -1715,10 +1923,10 @@ limfield (struct line const *line, struc +@@ -1719,10 +1927,10 @@ limfield (struct line const *line, struct keyfield const *key) */ /* Make LIM point to the end of (one byte past) the current field. */ @@ -3273,7 +3387,7 @@ Index: src/sort.c if (newlim) lim = newlim; } -@@ -1749,6 +1957,130 @@ limfield (struct line const *line, struc +@@ -1753,6 +1961,130 @@ limfield (struct line const *line, struct keyfield const *key) return ptr; } @@ -3404,7 +3518,7 @@ Index: src/sort.c /* Fill BUF reading from FP, moving buf->left bytes from the end of buf->buf to the beginning first. If EOF is reached and the file wasn't terminated by a newline, supply one. Set up BUF's line -@@ -1835,8 +2167,22 @@ fillbuf (struct buffer *buf, FILE *fp, c +@@ -1839,8 +2171,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file) else { if (key->skipsblanks) @@ -3429,9 +3543,9 @@ Index: src/sort.c line->keybeg = line_start; } } -@@ -1970,12 +2316,10 @@ find_unit_order (char const *number) - < K/k < M < G < T < P < E < Z < Y */ +@@ -1976,12 +2322,10 @@ find_unit_order (char const *number) + ATTRIBUTE_PURE static int -human_numcompare (char const *a, char const *b) +human_numcompare (char *a, char *b) @@ -3445,16 +3559,16 @@ Index: src/sort.c int diff = find_unit_order (a) - find_unit_order (b); return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); -@@ -1986,7 +2330,7 @@ human_numcompare (char const *a, char co - hideously fast. */ +@@ -1993,7 +2337,7 @@ human_numcompare (char const *a, char const *b) + ATTRIBUTE_PURE static int -numcompare (char const *a, char const *b) +numcompare_uni (const char *a, const char *b) { while (blanks[to_uchar (*a)]) a++; -@@ -1996,6 +2340,25 @@ numcompare (char const *a, char const *b +@@ -2003,6 +2347,25 @@ numcompare (char const *a, char const *b) return strnumcmp (a, b, decimal_point, thousands_sep); } @@ -3480,7 +3594,7 @@ Index: src/sort.c /* Work around a problem whereby the long double value returned by glibc's strtold ("NaN", ...) contains uninitialized bits: clear all bytes of A and B before calling strtold. FIXME: remove this function if -@@ -2046,7 +2409,7 @@ general_numcompare (char const *sa, char +@@ -2053,7 +2416,7 @@ general_numcompare (char const *sa, char const *sb) Return 0 if the name in S is not recognized. */ static int @@ -3489,7 +3603,7 @@ Index: src/sort.c { size_t lo = 0; size_t hi = MONTHS_PER_YEAR; -@@ -2322,15 +2685,14 @@ debug_key (struct line const *line, stru +@@ -2329,15 +2692,14 @@ debug_key (struct line const *line, struct keyfield const *key) char saved = *lim; *lim = '\0'; @@ -3507,7 +3621,7 @@ Index: src/sort.c else if (key->general_numeric) ignore_value (strtold (beg, &tighter_lim)); else if (key->numeric || key->human_numeric) -@@ -2464,7 +2826,7 @@ key_warnings (struct keyfield const *gke +@@ -2483,7 +2845,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) /* Warn about significant leading blanks. */ bool implicit_skip = key_numeric (key) || key->month; bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ @@ -3516,7 +3630,66 @@ Index: src/sort.c && ((!key->skipsblanks && !implicit_skip) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) -@@ -2522,11 +2884,87 @@ key_warnings (struct keyfield const *gke +@@ -2531,9 +2893,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + bool number_locale_warned = false; + if (basic_numeric_field_span) + { +- if (tab == TAB_DEFAULT +- ? thousands_sep != NON_CHAR && (isblank (to_uchar (thousands_sep))) +- : tab == thousands_sep) ++ if (tab_length ++ ? tab[0] == thousands_sep ++ : thousands_sep != NON_CHAR && (isblank (to_uchar (thousands_sep)))) + { + error (0, 0, + _("field separator %s is treated as a " +@@ -2544,9 +2906,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + } + if (basic_numeric_field_span || general_numeric_field_span) + { +- if (tab == TAB_DEFAULT +- ? thousands_sep != NON_CHAR && (isblank (to_uchar (decimal_point))) +- : tab == decimal_point) ++ if (tab_length ++ ? tab[0] == decimal_point ++ : thousands_sep != NON_CHAR && (isblank (to_uchar (decimal_point)))) + { + error (0, 0, + _("field separator %s is treated as a " +@@ -2554,19 +2916,19 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + quote (((char []) {decimal_point, 0}))); + number_locale_warned = true; + } +- else if (tab == '-') ++ else if (tab_length && tab[0] == '-') + { + error (0, 0, + _("field separator %s is treated as a " + "minus sign in numbers"), +- quote (((char []) {tab, 0}))); ++ quote (((char []) {tab[0], 0}))); + } +- else if (general_numeric_field_span && tab == '+') ++ else if (general_numeric_field_span && tab_length && tab[0] == '+') + { + error (0, 0, + _("field separator %s is treated as a " + "plus sign in numbers"), +- quote (((char []) {tab, 0}))); ++ quote (((char []) {tab[0], 0}))); + } + } + +@@ -2577,7 +2939,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + { + error (0, 0, + _("%snumbers use %s as a decimal point in this locale"), +- tab == decimal_point ? "" : _("note "), ++ (tab_length && tab[0] == decimal_point) ? "" : _("note "), + quote (((char []) {decimal_point, 0}))); + + } +@@ -2610,11 +2972,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) error (0, 0, _("option '-r' only applies to last-resort comparison")); } @@ -3605,7 +3778,7 @@ Index: src/sort.c { struct keyfield *key = keylist; -@@ -2611,7 +3049,7 @@ keycompare (struct line const *a, struct +@@ -2699,7 +3137,7 @@ keycompare (struct line const *a, struct line const *b) else if (key->human_numeric) diff = human_numcompare (ta, tb); else if (key->month) @@ -3614,7 +3787,7 @@ Index: src/sort.c else if (key->random) diff = compare_random (ta, tlena, tb, tlenb); else if (key->version) -@@ -2727,6 +3165,211 @@ keycompare (struct line const *a, struct +@@ -2815,6 +3253,211 @@ keycompare (struct line const *a, struct line const *b) return key->reverse ? -diff : diff; } @@ -3826,7 +3999,7 @@ Index: src/sort.c /* Compare two lines A and B, returning negative, zero, or positive depending on whether A compares less than, equal to, or greater than B. */ -@@ -2754,7 +3397,7 @@ compare (struct line const *a, struct li +@@ -2842,7 +3485,7 @@ compare (struct line const *a, struct line const *b) diff = - NONZERO (blen); else if (blen == 0) diff = 1; @@ -3835,7 +4008,7 @@ Index: src/sort.c { /* xmemcoll0 is a performance enhancement as it will not unconditionally write '\0' after the -@@ -4144,6 +4787,7 @@ set_ordering (char const *s, struct keyf +@@ -4226,6 +4869,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype) break; case 'f': key->translate = fold_toupper; @@ -3843,7 +4016,7 @@ Index: src/sort.c break; case 'g': key->general_numeric = true; -@@ -4223,7 +4867,7 @@ main (int argc, char **argv) +@@ -4305,7 +4949,7 @@ main (int argc, char **argv) initialize_exit_failure (SORT_FAILURE); hard_LC_COLLATE = hard_locale (LC_COLLATE); @@ -3852,8 +4025,8 @@ Index: src/sort.c hard_LC_TIME = hard_locale (LC_TIME); #endif -@@ -4244,6 +4888,29 @@ main (int argc, char **argv) - thousands_sep = -1; +@@ -4328,6 +4972,29 @@ main (int argc, char **argv) + thousands_sep = NON_CHAR; } +#if HAVE_MBRTOWC @@ -3882,7 +4055,7 @@ Index: src/sort.c have_read_stdin = false; inittables (); -@@ -4518,13 +5185,34 @@ main (int argc, char **argv) +@@ -4602,13 +5269,34 @@ main (int argc, char **argv) case 't': { @@ -3921,7 +4094,7 @@ Index: src/sort.c else { /* Provoke with 'sort -txx'. Complain about -@@ -4535,9 +5223,11 @@ main (int argc, char **argv) +@@ -4619,9 +5307,11 @@ main (int argc, char **argv) quote (optarg)); } } @@ -3935,23 +4108,10 @@ Index: src/sort.c } break; -@@ -4766,12 +5456,10 @@ main (int argc, char **argv) - sort (files, nfiles, outfile, nthreads); - } - --#ifdef lint - if (files_from) - readtokens0_free (&tok); - else - free (files); --#endif - - if (have_read_stdin && fclose (stdin) == EOF) - sort_die (_("close failed"), "-"); -Index: src/unexpand.c -=================================================================== ---- src/unexpand.c.orig -+++ src/unexpand.c +diff --git a/src/unexpand.c b/src/unexpand.c +index 7d6100f..04cd646 100644 +--- a/src/unexpand.c ++++ b/src/unexpand.c @@ -38,6 +38,9 @@ #include #include @@ -3984,11 +4144,11 @@ Index: src/unexpand.c return; + mbf_init (mbf, fp); + found_bom=check_bom(fp,&mbf); - ++ + if (using_utf_locale == false && found_bom == true) + { + /*try using some predefined locale */ -+ + + if (set_utf_locale () != 0) + { + error (EXIT_FAILURE, errno, _("cannot set UTF-8 locale")); @@ -4154,10 +4314,10 @@ Index: src/unexpand.c } } -Index: src/uniq.c -=================================================================== ---- src/uniq.c.orig -+++ src/uniq.c +diff --git a/src/uniq.c b/src/uniq.c +index e5996f0..871d47c 100644 +--- a/src/uniq.c ++++ b/src/uniq.c @@ -21,6 +21,17 @@ #include #include @@ -4206,16 +4366,16 @@ Index: src/uniq.c static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -253,7 +280,7 @@ size_opt (char const *opt, char const *m - return a pointer to the beginning of the line's field to be compared. */ +@@ -254,7 +281,7 @@ size_opt (char const *opt, char const *msgid) - static char * _GL_ATTRIBUTE_PURE + ATTRIBUTE_PURE + static char * -find_field (struct linebuffer const *line) +find_field_uni (struct linebuffer *line) { size_t count; char const *lp = line->buffer; -@@ -273,6 +300,83 @@ find_field (struct linebuffer const *lin +@@ -274,6 +301,83 @@ find_field (struct linebuffer const *line) return line->buffer + i; } @@ -4299,7 +4459,7 @@ Index: src/uniq.c /* Return false if two strings OLD and NEW match, true if not. OLD and NEW point not to the beginnings of the lines but rather to the beginnings of the fields to compare. -@@ -493,6 +597,19 @@ main (int argc, char **argv) +@@ -494,6 +598,19 @@ main (int argc, char **argv) atexit (close_stdout); @@ -4319,10 +4479,25 @@ Index: src/uniq.c skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; -Index: tests/expand/mb.sh -=================================================================== +diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm +index fad7ab9..c9021a6 100644 +--- a/tests/Coreutils.pm ++++ b/tests/Coreutils.pm +@@ -264,6 +264,9 @@ sub run_tests ($$$$$) + # Yes, this is an arbitrary limit. If it causes trouble, + # consider removing it. + my $max = 30; ++ # The downstream i18n multi-byte tests have a "-mb" suffix. ++ # Therefore add 3 to the maximum test name length. ++ $max += 3; + if ($max < length $test_name) + { + warn "$program_name: $test_name: test name is too long (> $max)\n"; +diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh +new file mode 100755 +index 0000000..dd6007c --- /dev/null -+++ tests/expand/mb.sh ++++ b/tests/expand/mb.sh @@ -0,0 +1,183 @@ +#!/bin/sh + @@ -4507,10 +4682,11 @@ Index: tests/expand/mb.sh +compare exp out > /dev/null 2>&1 || fail=1 + +exit $fail -Index: tests/i18n/sort.sh -=================================================================== +diff --git a/tests/i18n/sort.sh b/tests/i18n/sort.sh +new file mode 100755 +index 0000000..26c95de --- /dev/null -+++ tests/i18n/sort.sh ++++ b/tests/i18n/sort.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4541,11 +4717,11 @@ Index: tests/i18n/sort.sh + + +Exit $fail -Index: tests/local.mk -=================================================================== ---- tests/local.mk.orig -+++ tests/local.mk -@@ -375,6 +375,8 @@ all_tests = \ +diff --git a/tests/local.mk b/tests/local.mk +index 0f77786..dbe1843 100644 +--- a/tests/local.mk ++++ b/tests/local.mk +@@ -377,6 +377,8 @@ all_tests = \ tests/misc/sort-discrim.sh \ tests/misc/sort-files0-from.pl \ tests/misc/sort-float.sh \ @@ -4554,7 +4730,7 @@ Index: tests/local.mk tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ -@@ -573,6 +575,7 @@ all_tests = \ +@@ -576,6 +578,7 @@ all_tests = \ tests/du/threshold.sh \ tests/du/trailing-slash.sh \ tests/du/two-args.sh \ @@ -4562,7 +4738,7 @@ Index: tests/local.mk tests/id/gnu-zero-uids.sh \ tests/id/no-context.sh \ tests/id/context.sh \ -@@ -724,6 +727,7 @@ all_tests = \ +@@ -727,6 +730,7 @@ all_tests = \ tests/touch/read-only.sh \ tests/touch/relative.sh \ tests/touch/trailing-slash.sh \ @@ -4570,10 +4746,10 @@ Index: tests/local.mk $(all_root_tests) # See tests/factor/create-test.sh. -Index: tests/misc/expand.pl -=================================================================== ---- tests/misc/expand.pl.orig -+++ tests/misc/expand.pl +diff --git a/tests/misc/expand.pl b/tests/misc/expand.pl +index 7a77e6f..27f6652 100755 +--- a/tests/misc/expand.pl ++++ b/tests/misc/expand.pl @@ -27,6 +27,15 @@ my $prog = 'expand'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4637,10 +4813,10 @@ Index: tests/misc/expand.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/misc/fold.pl -=================================================================== ---- tests/misc/fold.pl.orig -+++ tests/misc/fold.pl +diff --git a/tests/misc/fold.pl b/tests/misc/fold.pl +index 2834f92..bc1616a 100755 +--- a/tests/misc/fold.pl ++++ b/tests/misc/fold.pl @@ -20,9 +20,18 @@ use strict; (my $program_name = $0) =~ s|.*/||; @@ -4710,10 +4886,10 @@ Index: tests/misc/fold.pl -my $prog = 'fold'; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; -Index: tests/misc/join.pl -=================================================================== ---- tests/misc/join.pl.orig -+++ tests/misc/join.pl +diff --git a/tests/misc/join.pl b/tests/misc/join.pl +index 06ad777..be40204 100755 +--- a/tests/misc/join.pl ++++ b/tests/misc/join.pl @@ -25,6 +25,15 @@ my $limits = getlimits (); my $prog = 'join'; @@ -4780,10 +4956,11 @@ Index: tests/misc/join.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/misc/sort-mb-tests.sh -=================================================================== +diff --git a/tests/misc/sort-mb-tests.sh b/tests/misc/sort-mb-tests.sh +new file mode 100755 +index 0000000..11836ba --- /dev/null -+++ tests/misc/sort-mb-tests.sh ++++ b/tests/misc/sort-mb-tests.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# Verify sort's multi-byte support. @@ -4830,10 +5007,10 @@ Index: tests/misc/sort-mb-tests.sh +compare exp out || { fail=1; cat out; } + +Exit $fail -Index: tests/misc/sort-merge.pl -=================================================================== ---- tests/misc/sort-merge.pl.orig -+++ tests/misc/sort-merge.pl +diff --git a/tests/misc/sort-merge.pl b/tests/misc/sort-merge.pl +index 7eb4574..eda884c 100755 +--- a/tests/misc/sort-merge.pl ++++ b/tests/misc/sort-merge.pl @@ -26,6 +26,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4890,10 +5067,10 @@ Index: tests/misc/sort-merge.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/misc/sort.pl -=================================================================== ---- tests/misc/sort.pl.orig -+++ tests/misc/sort.pl +diff --git a/tests/misc/sort.pl b/tests/misc/sort.pl +index 0b0adca..fd27821 100755 +--- a/tests/misc/sort.pl ++++ b/tests/misc/sort.pl @@ -24,10 +24,15 @@ my $prog = 'sort'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; @@ -4958,10 +5135,10 @@ Index: tests/misc/sort.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/misc/unexpand.pl -=================================================================== ---- tests/misc/unexpand.pl.orig -+++ tests/misc/unexpand.pl +diff --git a/tests/misc/unexpand.pl b/tests/misc/unexpand.pl +index 2e1906f..fe66012 100755 +--- a/tests/misc/unexpand.pl ++++ b/tests/misc/unexpand.pl @@ -27,6 +27,14 @@ my $limits = getlimits (); my $prog = 'unexpand'; @@ -5015,10 +5192,10 @@ Index: tests/misc/unexpand.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/misc/uniq.pl -=================================================================== ---- tests/misc/uniq.pl.orig -+++ tests/misc/uniq.pl +diff --git a/tests/misc/uniq.pl b/tests/misc/uniq.pl +index aa163cd..91d617d 100755 +--- a/tests/misc/uniq.pl ++++ b/tests/misc/uniq.pl @@ -23,9 +23,17 @@ my $limits = getlimits (); my $prog = 'uniq'; my $try = "Try '$prog --help' for more information.\n"; @@ -5091,10 +5268,10 @@ Index: tests/misc/uniq.pl @Tests = add_z_variants \@Tests; @Tests = triple_test \@Tests; -Index: tests/pr/pr-tests.pl -=================================================================== ---- tests/pr/pr-tests.pl.orig -+++ tests/pr/pr-tests.pl +diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl +index 7ac6d4c..ae6cc35 100755 +--- a/tests/pr/pr-tests.pl ++++ b/tests/pr/pr-tests.pl @@ -24,6 +24,15 @@ use strict; my $prog = 'pr'; my $normalize_strerror = "s/': .*/'/"; @@ -5160,10 +5337,11 @@ Index: tests/pr/pr-tests.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -Index: tests/unexpand/mb.sh -=================================================================== +diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh +new file mode 100755 +index 0000000..8a82d74 --- /dev/null -+++ tests/unexpand/mb.sh ++++ b/tests/unexpand/mb.sh @@ -0,0 +1,172 @@ +#!/bin/sh + @@ -5337,32 +5515,6 @@ Index: tests/unexpand/mb.sh + +LC_ALL=C unexpand in in > out || fail=1 +compare exp out > /dev/null 2>&1 || fail=1 -Index: tests/Coreutils.pm -=================================================================== ---- tests/Coreutils.pm.orig -+++ tests/Coreutils.pm -@@ -264,6 +264,9 @@ sub run_tests ($$$$$) - # Yes, this is an arbitrary limit. If it causes trouble, - # consider removing it. - my $max = 30; -+ # The downstream i18n multi-byte tests have a "-mb" suffix. -+ # Therefore add 3 to the maximum test name length. -+ $max += 3; - if ($max < length $test_name) - { - warn "$program_name: $test_name: test name is too long (> $max)\n"; -Index: src/local.mk -=================================================================== ---- src/local.mk.orig -+++ src/local.mk -@@ -429,8 +429,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(A - src_basenc_SOURCES = src/basenc.c - src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS) - --src_expand_SOURCES = src/expand.c src/expand-common.c --src_unexpand_SOURCES = src/unexpand.c src/expand-common.c -+src_expand_SOURCES = src/expand.c src/expand-common.c lib/mbfile.c -+src_unexpand_SOURCES = src/unexpand.c src/expand-common.c lib/mbfile.c - - src_wc_SOURCES = src/wc.c - if USE_AVX2_WC_LINECOUNT +-- +2.34.1 + diff --git a/coreutils-skip-gnulib-test-tls.patch b/coreutils-skip-gnulib-test-tls.patch index b166d4c..4474006 100644 --- a/coreutils-skip-gnulib-test-tls.patch +++ b/coreutils-skip-gnulib-test-tls.patch @@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk =================================================================== --- gnulib-tests/gnulib.mk.orig +++ gnulib-tests/gnulib.mk -@@ -2615,9 +2615,10 @@ EXTRA_DIST += test-timespec.c macros.h +@@ -2676,9 +2676,10 @@ EXTRA_DIST += test-timespec.c macros.h ## begin gnulib module tls-tests diff --git a/coreutils-sysinfo.patch b/coreutils-sysinfo.patch index c3fbb74..0d80ce9 100644 --- a/coreutils-sysinfo.patch +++ b/coreutils-sysinfo.patch @@ -6,8 +6,8 @@ Index: src/uname.c =================================================================== --- src/uname.c.orig +++ src/uname.c -@@ -338,6 +338,36 @@ main (int argc, char **argv) - # endif +@@ -341,6 +341,36 @@ main (int argc, char **argv) + element = processor; } #endif + if (element == unknown) @@ -43,7 +43,7 @@ Index: src/uname.c if (! (toprint == UINT_MAX && element == unknown)) print_element (element); } -@@ -363,6 +393,18 @@ main (int argc, char **argv) +@@ -366,6 +396,18 @@ main (int argc, char **argv) element = hardware_platform; } #endif diff --git a/coreutils-tests-shorten-extreme-factor-tests.patch b/coreutils-tests-shorten-extreme-factor-tests.patch index 17f1e38..1461d65 100644 --- a/coreutils-tests-shorten-extreme-factor-tests.patch +++ b/coreutils-tests-shorten-extreme-factor-tests.patch @@ -16,7 +16,7 @@ Index: tests/local.mk =================================================================== --- tests/local.mk.orig +++ tests/local.mk -@@ -733,14 +733,9 @@ all_tests = \ +@@ -736,14 +736,9 @@ all_tests = \ # See tests/factor/create-test.sh. tf = tests/factor factor_tests = \ diff --git a/coreutils.changes b/coreutils.changes index 3203727..890ff20 100644 --- a/coreutils.changes +++ b/coreutils.changes @@ -1,3 +1,74 @@ +------------------------------------------------------------------- +Thu Apr 21 20:58:30 UTC 2022 - Dirk Müller + +- update to 9.1: + * chmod -R no longer exits with error status when encountering symlinks. + All files would be processed correctly, but the exit status was incorrect. + * If 'cp -Z A B' checks B's status and some other process then removes B, + cp no longer creates B with a too-generous SELinux security context + before adjusting it to the correct value. + * 'cp --preserve=ownership A B' no longer ignores the umask when creating B. + Also, 'cp --preserve-xattr A B' is less likely to temporarily chmod u+w B. + * 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid. + * 'ls -v' and 'sort -V' no longer mishandle corner cases like "a..a" vs "a.+" + or lines containing NULs. Their behavior now matches the documentation + for file names like ".m4" that consist entirely of an extension, + and the documentation has been clarified for unusual cases. + * 'mv -T --backup=numbered A B/' no longer miscalculates the backup number + for B when A is a directory, possibly inflooping. + * cat now uses the copy_file_range syscall if available, when doing + simple copies between regular files. This may be more efficient, by avoiding + user space copies, and possibly employing copy offloading or reflinking. + * chown and chroot now warn about usages like "chown root.root f", + which have the nonstandard and long-obsolete "." separator that + causes problems on platforms where user names contain ".". + Applications should use ":" instead of ".". + * cksum no longer allows abbreviated algorithm names, + so that forward compatibility and robustness is improved. + * date +'%-N' now suppresses excess trailing digits, instead of always + padding them with zeros to 9 digits. It uses clock_getres and + clock_gettime to infer the clock resolution. + * dd conv=fsync now synchronizes output even after a write error, + and similarly for dd conv=fdatasync. + * dd now counts bytes instead of blocks if a block count ends in "B". + For example, 'dd count=100KiB' now copies 100 KiB of data, not + 102,400 blocks of data. The flags count_bytes, skip_bytes and + seek_bytes are therefore obsolescent and are no longer documented, + though they still work. + * ls no longer colors files with capabilities by default, as file-based + capabilties are very rarely used, and lookup increases processing per file by + about 30%. It's best to use getcap [-r] to identify files with capabilities. + * ls no longer tries to automount files, reverting to the behavior + before the statx() call was introduced in coreutils-8.32. + * stat no longer tries to automount files by default, reverting to the + behavior before the statx() call was introduced in coreutils-8.32. + Only `stat --cached=never` will continue to automount files. + * timeout --foreground --kill-after=... will now exit with status 137 + if the kill signal was sent, which is consistent with the behavior + when the --foreground option is not specified. This allows users to + distinguish if the command was more forcefully terminated. + * dd now supports the aliases iseek=N for skip=N, and oseek=N for seek=N, + like FreeBSD and other operating systems. + * dircolors takes a new --print-ls-colors option to display LS_COLORS + entries, on separate lines, colored according to the entry color code. + * dircolors will now also match COLORTERM in addition to TERM environment + variables. The default config will apply colors with any COLORTERM set. + * cp, mv, and install now use openat-like syscalls when copying to a directory. + * This avoids some race conditions and should be more efficient. + * The new 'date' option --resolution outputs the timestamp resolution. + * With conv=fdatasync or conv=fsync, dd status=progress now reports + any extra final progress just before synchronizing output data, + since synchronizing can take a long time. + * printf now supports printing the numeric value of multi-byte characters. + * sort --debug now diagnoses issues with --field-separator characters + that conflict with characters possibly used in numbers. + * 'tail -f file | filter' now exits on Solaris when filter exits. + * root invoked coreutils, that are built and run in single binary mode, + now adjust /proc/$pid/cmdline to be more specific to the utility + being run, rather than using the general "coreutils" binary name. +- coreutils-i18n.patch: Re-sync the patch with Fedora. +- drop coreutils-chmod-fix-exit-status-ign-symlinks.patch (upstream) + ------------------------------------------------------------------- Mon Oct 4 22:15:01 UTC 2021 - Bernhard Voelker diff --git a/coreutils.spec b/coreutils.spec index 2f819e9..8fd48da 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,16 +19,20 @@ # there are more fancy ways to define a package name using magic # macros but OBS and the bots that rely on parser information from # OBS can't deal with all of them -%define flavor @BUILD_FLAVOR@%{nil} +%global flavor @BUILD_FLAVOR@%{nil} + %bcond_with ringdisabled -%if "%{flavor}" != "" -%define name_suffix -%{flavor} %if %{with ringdisabled} ExclusiveArch: do_not_build %endif + +%if "%{flavor}" != "" +%define psuffix -%{flavor} +%else +%define psuffix %{nil} %endif -Name: coreutils%{?name_suffix} -Version: 9.0 +Name: coreutils%{psuffix} +Version: 9.1 Release: 0 Summary: GNU Core Utilities License: GPL-3.0-or-later @@ -60,8 +64,6 @@ Patch304: coreutils-use-python3.patch Patch500: coreutils-disable_tests.patch Patch501: coreutils-test_without_valgrind.patch # Upstream patch - remove with version >9.0: -# chmod: fix exit status when ignoring symlinks -Patch800: coreutils-chmod-fix-exit-status-ign-symlinks.patch # tests: skip tests/rm/ext3-perf.sh temporarily as it hangs on OBS. Patch810: coreutils-skip-tests-rm-ext3-perf.patch BuildRequires: automake @@ -134,7 +136,7 @@ This package contains the documentation for the GNU Core Utilities. %prep %setup -q -n coreutils-%{version} -%patch4 +%patch4 -p1 %patch1 %patch3 %patch8 @@ -157,7 +159,6 @@ This package contains the documentation for the GNU Core Utilities. %patch500 %patch501 -%patch800 %patch810 # ================================================ From e526ac1db99d0980f7bd1e09a768b1c1c9bc1fd0beece7e5929a1f2759dfbaef Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 25 Apr 2022 08:23:28 +0000 Subject: [PATCH 2/2] Accepting request 972387 from home:berny:branches:Base:System - gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct directory; broken in 9.1. See https://bugs.gnu.org/55029 OBS-URL: https://build.opensuse.org/request/show/972387 OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=326 --- coreutils.changes | 6 +++ coreutils.spec | 8 ++- gnulib-simple-backup-fix.patch | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 gnulib-simple-backup-fix.patch diff --git a/coreutils.changes b/coreutils.changes index 890ff20..2764b89 100644 --- a/coreutils.changes +++ b/coreutils.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Apr 24 09:49:04 UTC 2022 - Bernhard Voelker + +- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct + directory; broken in 9.1. See https://bugs.gnu.org/55029 + ------------------------------------------------------------------- Thu Apr 21 20:58:30 UTC 2022 - Dirk Müller diff --git a/coreutils.spec b/coreutils.spec index 8fd48da..b816c65 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -63,9 +63,14 @@ Patch303: coreutils-tests-shorten-extreme-factor-tests.patch Patch304: coreutils-use-python3.patch Patch500: coreutils-disable_tests.patch Patch501: coreutils-test_without_valgrind.patch -# Upstream patch - remove with version >9.0: + +# Downstream patch to skip a test failing on OBS. # tests: skip tests/rm/ext3-perf.sh temporarily as it hangs on OBS. Patch810: coreutils-skip-tests-rm-ext3-perf.patch + +# Upstream patch - remove with version >9.1: +Patch850: gnulib-simple-backup-fix.patch + BuildRequires: automake BuildRequires: gmp-devel BuildRequires: libacl-devel @@ -160,6 +165,7 @@ This package contains the documentation for the GNU Core Utilities. %patch501 %patch810 +%patch850 # ================================================ %build diff --git a/gnulib-simple-backup-fix.patch b/gnulib-simple-backup-fix.patch new file mode 100644 index 0000000..aa70c2d --- /dev/null +++ b/gnulib-simple-backup-fix.patch @@ -0,0 +1,93 @@ +Upstream patch on top of coreutils-9.1; remove with >9.1. +Fixes: https://bugs.gnu.org/55029 + +Two commits: + +* https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=e087525091b + + commit e087525091b8f0a15eb2354f71032597d5271599 + Author: Paul Eggert + Date: Wed Apr 20 19:44:56 2022 -0700 + + mv: test Bug#55029 + + * tests/mv/backup-dir.sh: New test for Bug#55029, + reported by Steve Ward. + +* https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=7347caeb9d90 + + commit 7347caeb9d902d3fca2c11f69a55a3e578d93bfe + Author: Paul Eggert + Date: Wed Apr 20 19:34:57 2022 -0700 + + backupfile: fix bug when renaming simple backups + + * lib/backupfile.c (backupfile_internal): Fix bug when RENAME + and when doing simple backups. Problem reported by Steve Ward in: + https://bugs.gnu.org/55029 + +--- + NEWS | 8 ++++++++ + lib/backupfile.c | 7 +++---- + tests/mv/backup-dir.sh | 6 ++++++ + 3 files changed, 17 insertions(+), 4 deletions(-) + +Index: lib/backupfile.c +=================================================================== +--- lib/backupfile.c.orig ++++ lib/backupfile.c +@@ -332,7 +332,7 @@ backupfile_internal (int dir_fd, char co + return s; + + DIR *dirp = NULL; +- int sdir = AT_FDCWD; ++ int sdir = dir_fd; + idx_t base_max = 0; + while (true) + { +@@ -371,10 +371,9 @@ backupfile_internal (int dir_fd, char co + if (! rename) + break; + +- int olddirfd = sdir < 0 ? dir_fd : sdir; +- idx_t offset = sdir < 0 ? 0 : base_offset; ++ idx_t offset = backup_type == simple_backups ? 0 : base_offset; + unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE; +- if (renameatu (olddirfd, file + offset, sdir, s + offset, flags) == 0) ++ if (renameatu (sdir, file + offset, sdir, s + offset, flags) == 0) + break; + int e = errno; + if (! (e == EEXIST && extended)) +Index: tests/mv/backup-dir.sh +=================================================================== +--- tests/mv/backup-dir.sh.orig ++++ tests/mv/backup-dir.sh +@@ -36,4 +36,10 @@ mkdir C D E || framework_failure_ + mv -T --backup=numbered C E/ || fail=1 + mv -T --backup=numbered D E/ || fail=1 + ++# Bug#55029 ++mkdir F && echo 1 >1 && echo 2 >2 && cp 1 F/X && cp 2 X || framework_failure_ ++mv --backup=simple X F/ || fail=1 ++compare 1 F/X~ || fail=1 ++compare 2 F/X || fail=1 ++ + Exit $fail +Index: NEWS +=================================================================== +--- NEWS.orig ++++ NEWS +@@ -1,5 +1,13 @@ + GNU coreutils NEWS -*- outline -*- + ++* Downstream changes on top of release 9.1 ++ ++** Bug fixes ++ ++ 'mv --backup=simple f d/' no longer mistakenly backs up d/f to f~. ++ [bug introduced in coreutils-9.1] ++ ++ + * Noteworthy changes in release 9.1 (2022-04-15) [stable] + + ** Bug fixes