SHA256
1
0
forked from pool/coreutils

Accepting request 930890 from openSUSE:Factory

QA issues found/fixed

OBS-URL: https://build.opensuse.org/request/show/930890
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=142
This commit is contained in:
Dominique Leuenberger 2021-11-11 20:36:23 +00:00 committed by Git OBS Bridge
commit aa26895bf4
21 changed files with 554 additions and 587 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa
size 5547836

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAl5hC5MACgkQ32/ZcTBg
N9n92Q//Td2GE1f8AZKkxCNI76Q/TqbxAwhjbkR+KdzvsyMePmgHcMgHG6sO2MNF
g6DIBmHpO3vWGzvUxUZRRhuW5QBOnMxHb/WXZ0p/g45d5MQdn4i0dA0wUJgByOqn
/WVfygNg9mrWFx/uTeCdhrwL11m71C7j/eQVu7Wr5DIb20VJ8+nVC2IWW33ZvxRj
Goa0wwDpeeD9qYe/Y+E5ZyhDYHJGRmNAlS03SXLO3+RfsbZFwdQEtzvr+v1VN6/S
9OsoI/GLdRjY1tByppaoZ63ZybB6iF5zZfJiWDF7Nw4MduJpjZQDSywiNleJ9vOi
fwR1180PjMV6aTXvPwqbqQxZjDl7nqvO36ghlTvErJbqdJVIYxmUGNjeJyjqI85l
Lhckh0GWos9K/kl13Ry9KWsxNQgfjNhtgjXGh+W47ojrho2kCiK5BTwDFeVU0jtU
H/1EePSGAIUF/Sfjz3rmGgLaaBwPiRiyzEIuZMyd4NCJWwfOTqgOshOYw15GCWYq
wGesN/4LWzEja7Au5lHP7imXjP0bp4qE/sYrOb4WzVVLCn+z2hu6SEIzjJzSm+D+
8Wv3Ia1/ypVpR+Z7gUt7VtEvI8zAwlySd/6Jw5U7TL0rzvZsTVWmCvEjPp+o3jCB
Fy/4ybao1gowBFtT1AtPMmxmiJ41KWCxLFrTuGJpFYCGvBH2y8s=
=yHV6
-----END PGP SIGNATURE-----

3
coreutils-9.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce
size 5612752

16
coreutils-9.0.tar.xz.sig Normal file
View File

@ -0,0 +1,16 @@
-----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-----

View File

@ -0,0 +1,119 @@
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?= <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 | 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 <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
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 \

View File

@ -6,7 +6,7 @@ Index: gnulib-tests/gnulib.mk
=================================================================== ===================================================================
--- gnulib-tests/gnulib.mk.orig --- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk +++ gnulib-tests/gnulib.mk
@@ -951,10 +951,10 @@ EXTRA_DIST += test-getloadavg.c signatur @@ -1035,10 +1035,10 @@ EXTRA_DIST += test-getloadavg.c signatur
## begin gnulib module getlogin-tests ## begin gnulib module getlogin-tests

View File

@ -1,25 +0,0 @@
Disable gnulib test 'test-float' temporarily as it fails on ppc and ppc64le.
* gnulib-tests/gnulib.mk: Comment lines related to 'test-float'.
---
gnulib-tests/gnulib.mk | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -635,9 +635,10 @@ EXTRA_DIST += test-filevercmp.c macros.h
## begin gnulib module float-tests
-TESTS += test-float
-check_PROGRAMS += test-float
-EXTRA_DIST += test-float.c macros.h
+# Test fails with GCC-10 on ppc and ppc64le.
+#TESTS += test-float
+#check_PROGRAMS += test-float
+#EXTRA_DIST += test-float.c macros.h
## end gnulib module float-tests

View File

@ -8,12 +8,14 @@
src/expand-common.c | 114 ++++++ src/expand-common.c | 114 ++++++
src/expand-common.h | 12 src/expand-common.h | 12
src/expand.c | 90 ++++- src/expand.c | 90 ++++-
src/fold.c | 308 ++++++++++++++++- src/fold.c | 312 ++++++++++++++++-
src/join.c | 359 +++++++++++++++++--- src/join.c | 359 +++++++++++++++++---
src/local.mk | 4
src/pr.c | 443 ++++++++++++++++++++++--- src/pr.c | 443 ++++++++++++++++++++++---
src/sort.c | 772 +++++++++++++++++++++++++++++++++++++++++--- src/sort.c | 772 +++++++++++++++++++++++++++++++++++++++++---
src/unexpand.c | 101 ++++- src/unexpand.c | 101 ++++-
src/uniq.c | 119 ++++++ src/uniq.c | 119 ++++++
tests/Coreutils.pm | 3
tests/expand/mb.sh | 183 ++++++++++ tests/expand/mb.sh | 183 ++++++++++
tests/i18n/sort.sh | 29 + tests/i18n/sort.sh | 29 +
tests/local.mk | 4 tests/local.mk | 4
@ -27,7 +29,7 @@
tests/misc/uniq.pl | 55 +++ tests/misc/uniq.pl | 55 +++
tests/pr/pr-tests.pl | 49 ++ tests/pr/pr-tests.pl | 49 ++
tests/unexpand/mb.sh | 172 +++++++++ tests/unexpand/mb.sh | 172 +++++++++
29 files changed, 3632 insertions(+), 210 deletions(-) 31 files changed, 3640 insertions(+), 213 deletions(-)
create mode 100644 lib/mbfile.c create mode 100644 lib/mbfile.c
create mode 100644 lib/mbfile.h create mode 100644 lib/mbfile.h
create mode 100644 m4/mbfile.m4 create mode 100644 m4/mbfile.m4
@ -40,7 +42,7 @@ Index: bootstrap.conf
=================================================================== ===================================================================
--- bootstrap.conf.orig --- bootstrap.conf.orig
+++ bootstrap.conf +++ bootstrap.conf
@@ -154,6 +154,7 @@ gnulib_modules=" @@ -156,6 +156,7 @@ gnulib_modules="
maintainer-makefile maintainer-makefile
malloc-gnu malloc-gnu
manywarnings manywarnings
@ -52,7 +54,7 @@ Index: configure.ac
=================================================================== ===================================================================
--- configure.ac.orig --- configure.ac.orig
+++ configure.ac +++ configure.ac
@@ -446,6 +446,8 @@ fi @@ -457,6 +457,8 @@ fi
# I'm leaving it here for now. This whole thing needs to be modernized... # I'm leaving it here for now. This whole thing needs to be modernized...
gl_WINSIZE_IN_PTEM gl_WINSIZE_IN_PTEM
@ -65,8 +67,8 @@ Index: lib/linebuffer.h
=================================================================== ===================================================================
--- lib/linebuffer.h.orig --- lib/linebuffer.h.orig
+++ lib/linebuffer.h +++ lib/linebuffer.h
@@ -21,6 +21,11 @@ @@ -22,6 +22,11 @@
# include "idx.h"
# include <stdio.h> # include <stdio.h>
+/* Get mbstate_t. */ +/* Get mbstate_t. */
@ -77,9 +79,9 @@ Index: lib/linebuffer.h
/* A 'struct linebuffer' holds a line of text. */ /* A 'struct linebuffer' holds a line of text. */
struct linebuffer struct linebuffer
@@ -28,6 +33,9 @@ struct linebuffer @@ -29,6 +34,9 @@ struct linebuffer
size_t size; /* Allocated. */ idx_t size; /* Allocated. */
size_t length; /* Used. */ idx_t length; /* Used. */
char *buffer; char *buffer;
+# if HAVE_WCHAR_H +# if HAVE_WCHAR_H
+ mbstate_t state; + mbstate_t state;
@ -390,7 +392,7 @@ Index: src/cut.c
#include "system.h" #include "system.h"
#include "error.h" #include "error.h"
@@ -38,6 +43,18 @@ @@ -37,6 +42,18 @@
#include "set-fields.h" #include "set-fields.h"
@ -409,7 +411,7 @@ Index: src/cut.c
/* The official name of this program (e.g., no 'g' prefix). */ /* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "cut" #define PROGRAM_NAME "cut"
@@ -54,6 +71,52 @@ @@ -53,6 +70,52 @@
} \ } \
while (0) while (0)
@ -462,7 +464,7 @@ Index: src/cut.c
/* Pointer inside RP. When checking if a byte or field is selected /* Pointer inside RP. When checking if a byte or field is selected
by a finite range, we check if it is between CURRENT_RP.LO by a finite range, we check if it is between CURRENT_RP.LO
@@ -61,6 +124,9 @@ @@ -60,6 +123,9 @@
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */ CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
static struct field_range_pair *current_rp; static struct field_range_pair *current_rp;
@ -472,7 +474,7 @@ Index: src/cut.c
/* This buffer is used to support the semantics of the -s option /* This buffer is used to support the semantics of the -s option
(or lack of same) when the specified field list includes (does (or lack of same) when the specified field list includes (does
not include) the first field. In both of those cases, the entire not include) the first field. In both of those cases, the entire
@@ -77,15 +143,25 @@ enum operating_mode @@ -76,15 +142,25 @@ enum operating_mode
{ {
undefined_mode, undefined_mode,
@ -499,7 +501,7 @@ Index: src/cut.c
/* If true do not output lines containing no delimiter characters. /* If true do not output lines containing no delimiter characters.
Otherwise, all such lines are printed. This option is valid only Otherwise, all such lines are printed. This option is valid only
with field mode. */ with field mode. */
@@ -97,6 +173,9 @@ static bool complement; @@ -96,6 +172,9 @@ static bool complement;
/* The delimiter character for field mode. */ /* The delimiter character for field mode. */
static unsigned char delim; static unsigned char delim;
@ -509,7 +511,7 @@ Index: src/cut.c
/* The delimiter for each line/record. */ /* The delimiter for each line/record. */
static unsigned char line_delim = '\n'; static unsigned char line_delim = '\n';
@@ -164,7 +243,7 @@ Print selected parts of lines from each @@ -163,7 +242,7 @@ Print selected parts of lines from each
-f, --fields=LIST select only these fields; also print any line\n\ -f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\ that contains no delimiter character, unless\n\
the -s option is specified\n\ the -s option is specified\n\
@ -518,7 +520,7 @@ Index: src/cut.c
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
--complement complement the set of selected bytes, characters\n\ --complement complement the set of selected bytes, characters\n\
@@ -280,6 +359,82 @@ cut_bytes (FILE *stream) @@ -279,6 +358,82 @@ cut_bytes (FILE *stream)
} }
} }
@ -601,7 +603,7 @@ Index: src/cut.c
/* Read from stream STREAM, printing to standard output any selected fields. */ /* Read from stream STREAM, printing to standard output any selected fields. */
static void static void
@@ -425,13 +580,211 @@ cut_fields (FILE *stream) @@ -424,13 +579,211 @@ cut_fields (FILE *stream)
} }
} }
@ -816,7 +818,7 @@ Index: src/cut.c
} }
/* Process file FILE to standard output. /* Process file FILE to standard output.
@@ -483,6 +836,7 @@ main (int argc, char **argv) @@ -482,6 +835,7 @@ main (int argc, char **argv)
bool ok; bool ok;
bool delim_specified = false; bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL); char *spec_list_string IF_LINT ( = NULL);
@ -824,7 +826,7 @@ Index: src/cut.c
initialize_main (&argc, &argv); initialize_main (&argc, &argv);
set_program_name (argv[0]); set_program_name (argv[0]);
@@ -505,7 +859,6 @@ main (int argc, char **argv) @@ -504,7 +858,6 @@ main (int argc, char **argv)
switch (optc) switch (optc)
{ {
case 'b': case 'b':
@ -832,7 +834,7 @@ Index: src/cut.c
/* Build the byte list. */ /* Build the byte list. */
if (operating_mode != undefined_mode) if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified")); FATAL_ERROR (_("only one type of list may be specified"));
@@ -513,6 +866,14 @@ main (int argc, char **argv) @@ -512,6 +865,14 @@ main (int argc, char **argv)
spec_list_string = optarg; spec_list_string = optarg;
break; break;
@ -847,7 +849,7 @@ Index: src/cut.c
case 'f': case 'f':
/* Build the field list. */ /* Build the field list. */
if (operating_mode != undefined_mode) if (operating_mode != undefined_mode)
@@ -524,10 +885,38 @@ main (int argc, char **argv) @@ -523,10 +884,38 @@ main (int argc, char **argv)
case 'd': case 'd':
/* New delimiter. */ /* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */ /* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
@ -890,7 +892,7 @@ Index: src/cut.c
break; break;
case OUTPUT_DELIMITER_OPTION: case OUTPUT_DELIMITER_OPTION:
@@ -540,6 +929,7 @@ main (int argc, char **argv) @@ -539,6 +928,7 @@ main (int argc, char **argv)
break; break;
case 'n': case 'n':
@ -898,7 +900,7 @@ Index: src/cut.c
break; break;
case 's': case 's':
@@ -579,15 +969,34 @@ main (int argc, char **argv) @@ -578,15 +968,34 @@ main (int argc, char **argv)
| (complement ? SETFLD_COMPLEMENT : 0) ); | (complement ? SETFLD_COMPLEMENT : 0) );
if (!delim_specified) if (!delim_specified)
@ -951,7 +953,7 @@ Index: src/expand-common.c
#include "system.h" #include "system.h"
#include "die.h" #include "die.h"
#include "error.h" #include "error.h"
@@ -126,6 +127,119 @@ set_increment_size (uintmax_t tabval) @@ -125,6 +126,119 @@ set_increment_size (uintmax_t tabval)
return ok; return ok;
} }
@ -1075,7 +1077,7 @@ Index: src/expand-common.h
=================================================================== ===================================================================
--- src/expand-common.h.orig --- src/expand-common.h.orig
+++ src/expand-common.h +++ src/expand-common.h
@@ -34,6 +34,18 @@ extern size_t max_column_width; @@ -25,6 +25,18 @@ extern size_t max_column_width;
/* The desired exit status. */ /* The desired exit status. */
extern int exit_status; extern int exit_status;
@ -1107,8 +1109,8 @@ Index: src/expand.c
+ +
#include "system.h" #include "system.h"
#include "die.h" #include "die.h"
#include "xstrndup.h"
@@ -98,19 +101,41 @@ expand (void) @@ -97,19 +100,41 @@ expand (void)
{ {
/* Input stream. */ /* Input stream. */
FILE *fp = next_file (NULL); FILE *fp = next_file (NULL);
@ -1154,7 +1156,7 @@ Index: src/expand.c
/* The following variables have valid values only when CONVERT /* The following variables have valid values only when CONVERT
is true: */ is true: */
@@ -120,17 +145,48 @@ expand (void) @@ -119,17 +144,48 @@ expand (void)
/* Index in TAB_LIST of next tab stop to examine. */ /* Index in TAB_LIST of next tab stop to examine. */
size_t tab_index = 0; size_t tab_index = 0;
@ -1207,7 +1209,7 @@ Index: src/expand.c
{ {
/* Column the next input tab stop is on. */ /* Column the next input tab stop is on. */
uintmax_t next_tab_column; uintmax_t next_tab_column;
@@ -149,32 +205,34 @@ expand (void) @@ -148,32 +204,34 @@ expand (void)
if (putchar (' ') < 0) if (putchar (' ') < 0)
die (EXIT_FAILURE, errno, _("write error")); die (EXIT_FAILURE, errno, _("write error"));
@ -1401,12 +1403,15 @@ Index: src/fold.c
/* Look for the last blank. */ /* Look for the last blank. */
while (logical_end) while (logical_end)
{ {
@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t @@ -215,13 +252,225 @@ fold_file (char const *filename, size_t
line_out[offset_out++] = c; line_out[offset_out++] = c;
} }
- saved_errno = errno; - saved_errno = errno;
+ *saved_errno = errno; + *saved_errno = errno;
if (!ferror (istream))
- saved_errno = 0;
+ *saved_errno = 0;
if (offset_out) if (offset_out)
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
@ -1582,6 +1587,8 @@ Index: src/fold.c
+ } + }
+ +
+ *saved_errno = errno; + *saved_errno = errno;
+ if (!ferror (istream))
+ *saved_errno = 0;
+ +
+ if (offset_out) + if (offset_out)
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); + fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
@ -1621,10 +1628,10 @@ Index: src/fold.c
+#endif +#endif
+ fold_text (istream, width, &saved_errno); + fold_text (istream, width, &saved_errno);
+ +
if (ferror (istream)) if (STREQ (filename, "-"))
{ clearerr (istream);
error (0, saved_errno, "%s", quotef (filename)); else if (fclose (istream) != 0 && !saved_errno)
@@ -252,7 +499,8 @@ main (int argc, char **argv) @@ -252,7 +501,8 @@ main (int argc, char **argv)
atexit (close_stdout); atexit (close_stdout);
@ -1634,7 +1641,7 @@ Index: src/fold.c
while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
{ {
@@ -261,7 +509,15 @@ main (int argc, char **argv) @@ -261,7 +511,15 @@ main (int argc, char **argv)
switch (optc) switch (optc)
{ {
case 'b': /* Count bytes rather than columns. */ case 'b': /* Count bytes rather than columns. */
@ -2215,8 +2222,8 @@ Index: src/pr.c
static bool print_page (void); static bool print_page (void);
static bool print_stored (COLUMN *p); static bool print_stored (COLUMN *p);
@@ -429,6 +472,7 @@ static void add_line_number (COLUMN *p); @@ -429,6 +472,7 @@ static void add_line_number (COLUMN *p);
static void getoptnum (const char *n_str, int min, int *num, static void getoptnum (char const *n_str, int min, int *num,
const char *errfmt); char const *errfmt);
static void getoptarg (char *arg, char switch_char, char *character, static void getoptarg (char *arg, char switch_char, char *character,
+ int *character_length, int *character_width, + int *character_length, int *character_width,
int *number); int *number);
@ -2229,7 +2236,7 @@ Index: src/pr.c
-static void print_char (char c); -static void print_char (char c);
static void cleanup (void); static void cleanup (void);
static void print_sep_string (void); static void print_sep_string (void);
static void separator_string (const char *optarg_S); static void separator_string (char const *optarg_S);
@@ -454,7 +497,7 @@ static COLUMN *column_vector; @@ -454,7 +497,7 @@ static COLUMN *column_vector;
we store the leftmost columns contiguously in buff. we store the leftmost columns contiguously in buff.
To print a line from buff, get the index of the first character To print a line from buff, get the index of the first character
@ -2283,7 +2290,7 @@ Index: src/pr.c
static char *column_separator = (char *) " "; static char *column_separator = (char *) " ";
static char *line_separator = (char *) "\t"; static char *line_separator = (char *) "\t";
@@ -852,6 +905,13 @@ separator_string (const char *optarg_S) @@ -852,6 +905,13 @@ separator_string (char const *optarg_S)
integer_overflow (); integer_overflow ();
col_sep_length = len; col_sep_length = len;
col_sep_string = optarg_S; col_sep_string = optarg_S;
@ -2368,7 +2375,7 @@ Index: src/pr.c
use_col_separator = true; use_col_separator = true;
if (optarg) if (optarg)
separator_string (optarg); separator_string (optarg);
@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, i @@ -1166,10 +1250,45 @@ getoptnum (char const *n_str, int min, i
a number. */ a number. */
static void static void
@ -2437,7 +2444,7 @@ Index: src/pr.c
use_col_separator = true; use_col_separator = true;
} }
/* It's rather pointless to define a TAB separator with column /* It's rather pointless to define a TAB separator with column
@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files) @@ -1260,11 +1384,11 @@ init_parameters (int number_of_files)
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */ + TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */ /* Estimate chars_per_text without any margin and keep it constant. */
@ -2451,7 +2458,7 @@ Index: src/pr.c
/* The number is part of the column width unless we are /* The number is part of the column width unless we are
printing files in parallel. */ printing files in parallel. */
@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files) @@ -1273,7 +1397,7 @@ init_parameters (int number_of_files)
} }
int sep_chars, useful_chars; int sep_chars, useful_chars;
@ -2460,7 +2467,7 @@ Index: src/pr.c
sep_chars = INT_MAX; sep_chars = INT_MAX;
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars, if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
&useful_chars)) &useful_chars))
@@ -1294,7 +1418,7 @@ init_parameters (int number_of_files) @@ -1296,7 +1420,7 @@ init_parameters (int number_of_files)
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8 We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
to expand a tab which is not an input_tab-char. */ to expand a tab which is not an input_tab-char. */
free (clump_buff); free (clump_buff);
@ -2469,7 +2476,7 @@ Index: src/pr.c
} }
/* Open the necessary files, /* Open the necessary files,
@@ -1400,7 +1524,7 @@ init_funcs (void) @@ -1402,7 +1526,7 @@ init_funcs (void)
/* Enlarge p->start_position of first column to use the same form of /* Enlarge p->start_position of first column to use the same form of
padding_not_printed with all columns. */ padding_not_printed with all columns. */
@ -2478,7 +2485,7 @@ Index: src/pr.c
/* This loop takes care of all but the rightmost column. */ /* This loop takes care of all but the rightmost column. */
@@ -1434,7 +1558,7 @@ init_funcs (void) @@ -1436,7 +1560,7 @@ init_funcs (void)
} }
else else
{ {
@ -2487,7 +2494,7 @@ Index: src/pr.c
h_next = h + chars_per_column; h_next = h + chars_per_column;
} }
} }
@@ -1725,9 +1849,9 @@ static void @@ -1733,9 +1857,9 @@ static void
align_column (COLUMN *p) align_column (COLUMN *p)
{ {
padding_not_printed = p->start_position; padding_not_printed = p->start_position;
@ -2499,7 +2506,7 @@ Index: src/pr.c
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2002,13 +2126,13 @@ store_char (char c) @@ -2010,13 +2134,13 @@ store_char (char c)
/* May be too generous. */ /* May be too generous. */
buff = X2REALLOC (buff, &buff_allocated); buff = X2REALLOC (buff, &buff_allocated);
} }
@ -2515,7 +2522,7 @@ Index: src/pr.c
char *s; char *s;
int num_width; int num_width;
@@ -2025,22 +2149,24 @@ add_line_number (COLUMN *p) @@ -2033,22 +2157,24 @@ add_line_number (COLUMN *p)
/* Tabification is assumed for multiple columns, also for n-separators, /* Tabification is assumed for multiple columns, also for n-separators,
but 'default n-separator = TAB' hasn't been given priority over but 'default n-separator = TAB' hasn't been given priority over
equal column_width also specified by POSIX. */ equal column_width also specified by POSIX. */
@ -2544,7 +2551,7 @@ Index: src/pr.c
output_position = POS_AFTER_TAB (chars_per_output_tab, output_position = POS_AFTER_TAB (chars_per_output_tab,
output_position); output_position);
} }
@@ -2199,7 +2325,7 @@ print_white_space (void) @@ -2207,7 +2333,7 @@ print_white_space (void)
while (goal - h_old > 1 while (goal - h_old > 1
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{ {
@ -2553,7 +2560,7 @@ Index: src/pr.c
h_old = h_new; h_old = h_new;
} }
while (++h_old <= goal) while (++h_old <= goal)
@@ -2219,6 +2345,7 @@ print_sep_string (void) @@ -2227,6 +2353,7 @@ print_sep_string (void)
{ {
char const *s = col_sep_string; char const *s = col_sep_string;
int l = col_sep_length; int l = col_sep_length;
@ -2561,7 +2568,7 @@ Index: src/pr.c
if (separators_not_printed <= 0) if (separators_not_printed <= 0)
{ {
@@ -2230,6 +2357,7 @@ print_sep_string (void) @@ -2238,6 +2365,7 @@ print_sep_string (void)
{ {
for (; separators_not_printed > 0; --separators_not_printed) for (; separators_not_printed > 0; --separators_not_printed)
{ {
@ -2569,7 +2576,7 @@ Index: src/pr.c
while (l-- > 0) while (l-- > 0)
{ {
/* 3 types of sep_strings: spaces only, spaces and chars, /* 3 types of sep_strings: spaces only, spaces and chars,
@@ -2243,12 +2371,15 @@ print_sep_string (void) @@ -2251,12 +2379,15 @@ print_sep_string (void)
} }
else else
{ {
@ -2586,7 +2593,7 @@ Index: src/pr.c
/* sep_string ends with some spaces */ /* sep_string ends with some spaces */
if (spaces_not_printed > 0) if (spaces_not_printed > 0)
print_white_space (); print_white_space ();
@@ -2276,7 +2407,7 @@ print_clump (COLUMN *p, int n, char *clu @@ -2284,7 +2415,7 @@ print_clump (COLUMN *p, int n, char *clu
required number of tabs and spaces. */ required number of tabs and spaces. */
static void static void
@ -2595,7 +2602,7 @@ Index: src/pr.c
{ {
if (tabify_output) if (tabify_output)
{ {
@@ -2300,6 +2431,74 @@ print_char (char c) @@ -2308,6 +2439,74 @@ print_char (char c)
putchar (c); putchar (c);
} }
@ -2670,7 +2677,7 @@ Index: src/pr.c
/* Skip to page PAGE before printing. /* Skip to page PAGE before printing.
PAGE may be larger than total number of pages. */ PAGE may be larger than total number of pages. */
@@ -2477,9 +2676,9 @@ read_line (COLUMN *p) @@ -2485,9 +2684,9 @@ read_line (COLUMN *p)
align_empty_cols = false; align_empty_cols = false;
} }
@ -2682,7 +2689,7 @@ Index: src/pr.c
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2548,7 +2747,7 @@ print_stored (COLUMN *p) @@ -2556,7 +2755,7 @@ print_stored (COLUMN *p)
COLUMN *q; COLUMN *q;
int line = p->current_line++; int line = p->current_line++;
@ -2691,7 +2698,7 @@ Index: src/pr.c
/* FIXME /* FIXME
UMR: Uninitialized memory read: UMR: Uninitialized memory read:
* This is occurring while in: * This is occurring while in:
@@ -2560,7 +2759,7 @@ print_stored (COLUMN *p) @@ -2568,7 +2767,7 @@ print_stored (COLUMN *p)
xmalloc [xmalloc.c:94] xmalloc [xmalloc.c:94]
init_store_cols [pr.c:1648] init_store_cols [pr.c:1648]
*/ */
@ -2700,7 +2707,7 @@ Index: src/pr.c
pad_vertically = true; pad_vertically = true;
@@ -2580,9 +2779,9 @@ print_stored (COLUMN *p) @@ -2588,9 +2787,9 @@ print_stored (COLUMN *p)
} }
} }
@ -2712,7 +2719,7 @@ Index: src/pr.c
padding_not_printed = ANYWHERE; padding_not_printed = ANYWHERE;
} }
@@ -2595,8 +2794,8 @@ print_stored (COLUMN *p) @@ -2603,8 +2802,8 @@ print_stored (COLUMN *p)
if (spaces_not_printed == 0) if (spaces_not_printed == 0)
{ {
output_position = p->start_position + end_vector[line]; output_position = p->start_position + end_vector[line];
@ -2723,7 +2730,7 @@ Index: src/pr.c
} }
return true; return true;
@@ -2615,7 +2814,7 @@ print_stored (COLUMN *p) @@ -2623,7 +2822,7 @@ print_stored (COLUMN *p)
number of characters is 1.) */ number of characters is 1.) */
static int static int
@ -2732,7 +2739,7 @@ Index: src/pr.c
{ {
unsigned char uc = c; unsigned char uc = c;
char *s = clump_buff; char *s = clump_buff;
@@ -2625,10 +2824,10 @@ char_to_clump (char c) @@ -2633,10 +2832,10 @@ char_to_clump (char c)
int chars; int chars;
int chars_per_c = 8; int chars_per_c = 8;
@ -2745,7 +2752,7 @@ Index: src/pr.c
{ {
width = TAB_WIDTH (chars_per_c, input_position); width = TAB_WIDTH (chars_per_c, input_position);
@@ -2709,6 +2908,164 @@ char_to_clump (char c) @@ -2717,6 +2916,164 @@ char_to_clump (char c)
return chars; return chars;
} }
@ -3034,7 +3041,7 @@ Index: src/sort.c
/* Clean up any remaining temporary files. */ /* Clean up any remaining temporary files. */
static void static void
@@ -1270,7 +1341,7 @@ zaptemp (char const *name) @@ -1269,7 +1340,7 @@ zaptemp (char const *name)
free (node); free (node);
} }
@ -3043,7 +3050,7 @@ Index: src/sort.c
static int static int
struct_month_cmp (void const *m1, void const *m2) struct_month_cmp (void const *m1, void const *m2)
@@ -1285,7 +1356,7 @@ struct_month_cmp (void const *m1, void c @@ -1284,7 +1355,7 @@ struct_month_cmp (void const *m1, void c
/* Initialize the character class tables. */ /* Initialize the character class tables. */
static void static void
@ -3052,7 +3059,7 @@ Index: src/sort.c
{ {
size_t i; size_t i;
@@ -1297,7 +1368,7 @@ inittables (void) @@ -1296,7 +1367,7 @@ inittables (void)
fold_toupper[i] = toupper (i); fold_toupper[i] = toupper (i);
} }
@ -3061,7 +3068,7 @@ Index: src/sort.c
/* If we're not in the "C" locale, read different names for months. */ /* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME) if (hard_LC_TIME)
{ {
@@ -1379,6 +1450,84 @@ specify_nmerge (int oi, char c, char con @@ -1378,6 +1449,84 @@ specify_nmerge (int oi, char c, char con
xstrtol_fatal (e, oi, c, long_options, s); xstrtol_fatal (e, oi, c, long_options, s);
} }
@ -3146,7 +3153,7 @@ Index: src/sort.c
/* Specify the amount of main memory to use when sorting. */ /* Specify the amount of main memory to use when sorting. */
static void static void
specify_sort_size (int oi, char c, char const *s) specify_sort_size (int oi, char c, char const *s)
@@ -1610,7 +1759,7 @@ buffer_linelim (struct buffer const *buf @@ -1609,7 +1758,7 @@ buffer_linelim (struct buffer const *buf
by KEY in LINE. */ by KEY in LINE. */
static char * static char *
@ -3155,7 +3162,7 @@ Index: src/sort.c
{ {
char *ptr = line->text, *lim = ptr + line->length - 1; char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword; size_t sword = key->sword;
@@ -1619,10 +1768,10 @@ begfield (struct line const *line, struc @@ -1618,10 +1767,10 @@ begfield (struct line const *line, struc
/* The leading field separator itself is included in a field when -t /* The leading field separator itself is included in a field when -t
is absent. */ is absent. */
@ -3168,7 +3175,7 @@ Index: src/sort.c
++ptr; ++ptr;
if (ptr < lim) if (ptr < lim)
++ptr; ++ptr;
@@ -1648,11 +1797,70 @@ begfield (struct line const *line, struc @@ -1647,11 +1796,70 @@ begfield (struct line const *line, struc
return ptr; return ptr;
} }
@ -3234,13 +3241,13 @@ Index: src/sort.c
/* Return the limit of (a pointer to the first character after) the field /* Return the limit of (a pointer to the first character after) the field
in LINE specified by KEY. */ in LINE specified by KEY. */
static char * static char * _GL_ATTRIBUTE_PURE
-limfield (struct line const *line, struct keyfield const *key) -limfield (struct line const *line, struct keyfield const *key)
+limfield_uni (const struct line *line, const struct keyfield *key) +limfield_uni (struct line const *line, struct keyfield const *key)
{ {
char *ptr = line->text, *lim = ptr + line->length - 1; char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar; size_t eword = key->eword, echar = key->echar;
@@ -1667,10 +1875,10 @@ limfield (struct line const *line, struc @@ -1666,10 +1874,10 @@ limfield (struct line const *line, struc
'beginning' is the first character following the delimiting TAB. 'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */ the preceding field. */
@ -3253,7 +3260,7 @@ Index: src/sort.c
++ptr; ++ptr;
if (ptr < lim && (eword || echar)) if (ptr < lim && (eword || echar))
++ptr; ++ptr;
@@ -1716,10 +1924,10 @@ limfield (struct line const *line, struc @@ -1715,10 +1923,10 @@ limfield (struct line const *line, struc
*/ */
/* Make LIM point to the end of (one byte past) the current field. */ /* Make LIM point to the end of (one byte past) the current field. */
@ -3266,12 +3273,12 @@ Index: src/sort.c
if (newlim) if (newlim)
lim = newlim; lim = newlim;
} }
@@ -1750,6 +1958,130 @@ limfield (struct line const *line, struc @@ -1749,6 +1957,130 @@ limfield (struct line const *line, struc
return ptr; return ptr;
} }
+#if HAVE_MBRTOWC +#if HAVE_MBRTOWC
+static char * +static char * _GL_ATTRIBUTE_PURE
+limfield_mb (const struct line *line, const struct keyfield *key) +limfield_mb (const struct line *line, const struct keyfield *key)
+{ +{
+ char *ptr = line->text, *lim = ptr + line->length - 1; + char *ptr = line->text, *lim = ptr + line->length - 1;
@ -3397,7 +3404,7 @@ Index: src/sort.c
/* Fill BUF reading from FP, moving buf->left bytes from the end /* 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 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 file wasn't terminated by a newline, supply one. Set up BUF's line
@@ -1836,8 +2168,22 @@ fillbuf (struct buffer *buf, FILE *fp, c @@ -1835,8 +2167,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
else else
{ {
if (key->skipsblanks) if (key->skipsblanks)
@ -3422,7 +3429,7 @@ Index: src/sort.c
line->keybeg = line_start; line->keybeg = line_start;
} }
} }
@@ -1971,12 +2317,10 @@ find_unit_order (char const *number) @@ -1970,12 +2316,10 @@ find_unit_order (char const *number)
<none/unknown> < K/k < M < G < T < P < E < Z < Y */ <none/unknown> < K/k < M < G < T < P < E < Z < Y */
static int static int
@ -3438,7 +3445,7 @@ Index: src/sort.c
int diff = find_unit_order (a) - find_unit_order (b); int diff = find_unit_order (a) - find_unit_order (b);
return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
@@ -1987,7 +2331,7 @@ human_numcompare (char const *a, char co @@ -1986,7 +2330,7 @@ human_numcompare (char const *a, char co
hideously fast. */ hideously fast. */
static int static int
@ -3447,7 +3454,7 @@ Index: src/sort.c
{ {
while (blanks[to_uchar (*a)]) while (blanks[to_uchar (*a)])
a++; a++;
@@ -1997,6 +2341,25 @@ numcompare (char const *a, char const *b @@ -1996,6 +2340,25 @@ numcompare (char const *a, char const *b
return strnumcmp (a, b, decimal_point, thousands_sep); return strnumcmp (a, b, decimal_point, thousands_sep);
} }
@ -3473,7 +3480,7 @@ Index: src/sort.c
/* Work around a problem whereby the long double value returned by glibc's /* Work around a problem whereby the long double value returned by glibc's
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
A and B before calling strtold. FIXME: remove this function if A and B before calling strtold. FIXME: remove this function if
@@ -2047,7 +2410,7 @@ general_numcompare (char const *sa, char @@ -2046,7 +2409,7 @@ general_numcompare (char const *sa, char
Return 0 if the name in S is not recognized. */ Return 0 if the name in S is not recognized. */
static int static int
@ -3482,7 +3489,7 @@ Index: src/sort.c
{ {
size_t lo = 0; size_t lo = 0;
size_t hi = MONTHS_PER_YEAR; size_t hi = MONTHS_PER_YEAR;
@@ -2323,15 +2686,14 @@ debug_key (struct line const *line, stru @@ -2322,15 +2685,14 @@ debug_key (struct line const *line, stru
char saved = *lim; char saved = *lim;
*lim = '\0'; *lim = '\0';
@ -3500,7 +3507,7 @@ Index: src/sort.c
else if (key->general_numeric) else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim)); ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric) else if (key->numeric || key->human_numeric)
@@ -2465,7 +2827,7 @@ key_warnings (struct keyfield const *gke @@ -2464,7 +2826,7 @@ key_warnings (struct keyfield const *gke
/* Warn about significant leading blanks. */ /* Warn about significant leading blanks. */
bool implicit_skip = key_numeric (key) || key->month; bool implicit_skip = key_numeric (key) || key->month;
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
@ -3509,7 +3516,7 @@ Index: src/sort.c
&& ((!key->skipsblanks && !implicit_skip) && ((!key->skipsblanks && !implicit_skip)
|| (!key->skipsblanks && key->schar) || (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar))) || (!key->skipeblanks && key->echar)))
@@ -2523,11 +2885,87 @@ key_warnings (struct keyfield const *gke @@ -2522,11 +2884,87 @@ key_warnings (struct keyfield const *gke
error (0, 0, _("option '-r' only applies to last-resort comparison")); error (0, 0, _("option '-r' only applies to last-resort comparison"));
} }
@ -3598,7 +3605,7 @@ Index: src/sort.c
{ {
struct keyfield *key = keylist; struct keyfield *key = keylist;
@@ -2612,7 +3050,7 @@ keycompare (struct line const *a, struct @@ -2611,7 +3049,7 @@ keycompare (struct line const *a, struct
else if (key->human_numeric) else if (key->human_numeric)
diff = human_numcompare (ta, tb); diff = human_numcompare (ta, tb);
else if (key->month) else if (key->month)
@ -3607,7 +3614,7 @@ Index: src/sort.c
else if (key->random) else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb); diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version) else if (key->version)
@@ -2728,6 +3166,211 @@ keycompare (struct line const *a, struct @@ -2727,6 +3165,211 @@ keycompare (struct line const *a, struct
return key->reverse ? -diff : diff; return key->reverse ? -diff : diff;
} }
@ -3819,7 +3826,7 @@ Index: src/sort.c
/* Compare two lines A and B, returning negative, zero, or positive /* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */ depending on whether A compares less than, equal to, or greater than B. */
@@ -2755,7 +3398,7 @@ compare (struct line const *a, struct li @@ -2754,7 +3397,7 @@ compare (struct line const *a, struct li
diff = - NONZERO (blen); diff = - NONZERO (blen);
else if (blen == 0) else if (blen == 0)
diff = 1; diff = 1;
@ -3828,7 +3835,7 @@ Index: src/sort.c
{ {
/* xmemcoll0 is a performance enhancement as /* xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the it will not unconditionally write '\0' after the
@@ -4145,6 +4788,7 @@ set_ordering (char const *s, struct keyf @@ -4144,6 +4787,7 @@ set_ordering (char const *s, struct keyf
break; break;
case 'f': case 'f':
key->translate = fold_toupper; key->translate = fold_toupper;
@ -3836,7 +3843,7 @@ Index: src/sort.c
break; break;
case 'g': case 'g':
key->general_numeric = true; key->general_numeric = true;
@@ -4224,7 +4868,7 @@ main (int argc, char **argv) @@ -4223,7 +4867,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE); initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE); hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3845,7 +3852,7 @@ Index: src/sort.c
hard_LC_TIME = hard_locale (LC_TIME); hard_LC_TIME = hard_locale (LC_TIME);
#endif #endif
@@ -4245,6 +4889,29 @@ main (int argc, char **argv) @@ -4244,6 +4888,29 @@ main (int argc, char **argv)
thousands_sep = -1; thousands_sep = -1;
} }
@ -3875,7 +3882,7 @@ Index: src/sort.c
have_read_stdin = false; have_read_stdin = false;
inittables (); inittables ();
@@ -4519,13 +5186,34 @@ main (int argc, char **argv) @@ -4518,13 +5185,34 @@ main (int argc, char **argv)
case 't': case 't':
{ {
@ -3914,7 +3921,7 @@ Index: src/sort.c
else else
{ {
/* Provoke with 'sort -txx'. Complain about /* Provoke with 'sort -txx'. Complain about
@@ -4536,9 +5224,11 @@ main (int argc, char **argv) @@ -4535,9 +5223,11 @@ main (int argc, char **argv)
quote (optarg)); quote (optarg));
} }
} }
@ -3928,7 +3935,7 @@ Index: src/sort.c
} }
break; break;
@@ -4767,12 +5457,10 @@ main (int argc, char **argv) @@ -4766,12 +5456,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads); sort (files, nfiles, outfile, nthreads);
} }
@ -3954,8 +3961,8 @@ Index: src/unexpand.c
+ +
#include "system.h" #include "system.h"
#include "die.h" #include "die.h"
#include "xstrndup.h"
@@ -107,24 +110,47 @@ unexpand (void) @@ -106,24 +109,47 @@ unexpand (void)
{ {
/* Input stream. */ /* Input stream. */
FILE *fp = next_file (NULL); FILE *fp = next_file (NULL);
@ -4006,7 +4013,7 @@ Index: src/unexpand.c
/* If true, perform translations. */ /* If true, perform translations. */
bool convert = true; bool convert = true;
@@ -158,12 +184,44 @@ unexpand (void) @@ -157,12 +183,44 @@ unexpand (void)
do do
{ {
@ -4054,7 +4061,7 @@ Index: src/unexpand.c
if (blank) if (blank)
{ {
@@ -180,16 +238,16 @@ unexpand (void) @@ -179,16 +237,16 @@ unexpand (void)
if (next_tab_column < column) if (next_tab_column < column)
die (EXIT_FAILURE, 0, _("input line is too long")); die (EXIT_FAILURE, 0, _("input line is too long"));
@ -4074,7 +4081,7 @@ Index: src/unexpand.c
if (! (prev_blank && column == next_tab_column)) if (! (prev_blank && column == next_tab_column))
{ {
@@ -197,13 +255,14 @@ unexpand (void) @@ -196,13 +254,14 @@ unexpand (void)
will be replaced by tabs. */ will be replaced by tabs. */
if (column == next_tab_column) if (column == next_tab_column)
one_blank_before_tab_stop = true; one_blank_before_tab_stop = true;
@ -4091,7 +4098,7 @@ Index: src/unexpand.c
} }
/* Discard pending blanks, unless it was a single /* Discard pending blanks, unless it was a single
@@ -211,7 +270,7 @@ unexpand (void) @@ -210,7 +269,7 @@ unexpand (void)
pending = one_blank_before_tab_stop; pending = one_blank_before_tab_stop;
} }
} }
@ -4100,7 +4107,7 @@ Index: src/unexpand.c
{ {
/* Go back one column, and force recalculation of the /* Go back one column, and force recalculation of the
next tab stop. */ next tab stop. */
@@ -219,9 +278,9 @@ unexpand (void) @@ -218,9 +277,9 @@ unexpand (void)
next_tab_column = column; next_tab_column = column;
tab_index -= !!tab_index; tab_index -= !!tab_index;
} }
@ -4112,7 +4119,7 @@ Index: src/unexpand.c
if (!column) if (!column)
die (EXIT_FAILURE, 0, _("input line is too long")); die (EXIT_FAILURE, 0, _("input line is too long"));
} }
@@ -229,8 +288,11 @@ unexpand (void) @@ -228,8 +287,11 @@ unexpand (void)
if (pending) if (pending)
{ {
if (pending > 1 && one_blank_before_tab_stop) if (pending > 1 && one_blank_before_tab_stop)
@ -4126,7 +4133,7 @@ Index: src/unexpand.c
die (EXIT_FAILURE, errno, _("write error")); die (EXIT_FAILURE, errno, _("write error"));
pending = 0; pending = 0;
one_blank_before_tab_stop = false; one_blank_before_tab_stop = false;
@@ -240,16 +302,17 @@ unexpand (void) @@ -239,16 +301,17 @@ unexpand (void)
convert &= convert_entire_line || blank; convert &= convert_entire_line || blank;
} }
@ -4538,7 +4545,7 @@ Index: tests/local.mk
=================================================================== ===================================================================
--- tests/local.mk.orig --- tests/local.mk.orig
+++ tests/local.mk +++ tests/local.mk
@@ -369,6 +369,8 @@ all_tests = \ @@ -375,6 +375,8 @@ all_tests = \
tests/misc/sort-discrim.sh \ tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \ tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \ tests/misc/sort-float.sh \
@ -4547,7 +4554,7 @@ Index: tests/local.mk
tests/misc/sort-h-thousands-sep.sh \ tests/misc/sort-h-thousands-sep.sh \
tests/misc/sort-merge.pl \ tests/misc/sort-merge.pl \
tests/misc/sort-merge-fdlimit.sh \ tests/misc/sort-merge-fdlimit.sh \
@@ -567,6 +569,7 @@ all_tests = \ @@ -573,6 +575,7 @@ all_tests = \
tests/du/threshold.sh \ tests/du/threshold.sh \
tests/du/trailing-slash.sh \ tests/du/trailing-slash.sh \
tests/du/two-args.sh \ tests/du/two-args.sh \
@ -4555,7 +4562,7 @@ Index: tests/local.mk
tests/id/gnu-zero-uids.sh \ tests/id/gnu-zero-uids.sh \
tests/id/no-context.sh \ tests/id/no-context.sh \
tests/id/context.sh \ tests/id/context.sh \
@@ -714,6 +717,7 @@ all_tests = \ @@ -724,6 +727,7 @@ all_tests = \
tests/touch/read-only.sh \ tests/touch/read-only.sh \
tests/touch/relative.sh \ tests/touch/relative.sh \
tests/touch/trailing-slash.sh \ tests/touch/trailing-slash.sh \
@ -5104,9 +5111,9 @@ Index: tests/pr/pr-tests.pl
my @tv = ( my @tv = (
# -b option is no longer an official option. But it's still working to # -b option is no longer an official option. But it's still working to
@@ -474,8 +483,48 @@ push @Tests, @@ -512,8 +521,48 @@ push @Tests,
{IN=>{2=>"a\n"}}, {IN=>"x\tx\tx\tx\tx\nx\tx\tx\tx\tx\n"},
{OUT=>"a\t\t\t\t \t\t\ta\n"} ]; {OUT=>"x\tx\tx\tx\tx\tx\tx\tx\tx\tx\n"} ];
+# Add _POSIX2_VERSION=199209 to the environment of each test +# Add _POSIX2_VERSION=199209 to the environment of each test
+# that uses an old-style option like +1. +# that uses an old-style option like +1.
@ -5330,3 +5337,32 @@ Index: tests/unexpand/mb.sh
+ +
+LC_ALL=C unexpand in in > out || fail=1 +LC_ALL=C unexpand in in > out || fail=1
+compare exp out > /dev/null 2>&1 || 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

View File

@ -19,7 +19,7 @@ Index: src/chgrp.c
=================================================================== ===================================================================
--- src/chgrp.c.orig --- src/chgrp.c.orig
+++ src/chgrp.c +++ src/chgrp.c
@@ -89,7 +89,7 @@ parse_group (const char *name) @@ -89,7 +89,7 @@ parse_group (char const *name)
{ {
uintmax_t tmp; uintmax_t tmp;
if (! (xstrtoumax (name, NULL, 10, &tmp, "") == LONGINT_OK if (! (xstrtoumax (name, NULL, 10, &tmp, "") == LONGINT_OK

View File

@ -1,156 +0,0 @@
Upstream commits (squashed) after the release of coreutils-8.32:
[PATCH 1/2] ls: restore 8.31 behavior on removed directories
[PATCH 2/2] ls: improve removed-directory test
Remove this patch with the next coreutils release.
Discussed at:
https://lists.gnu.org/archive/html/bug-coreutils/2020-03/msg00008.html
Upstream commits:
https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=10fcb97
https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=672819c
commit 672819c73f2e94e61386dc0584bddf9da860cc26 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat Mar 7 10:29:51 2020 -0800
ls: improve removed-directory test
* tests/ls/removed-directory.sh: Remove host_triplet test.
Skip this test if one cannot remove the working directory.
From a suggestion by Bernhard Voelker (Bug#39929).
commit 10fcb97bd728f09d4a027eddf8ad2900f0819b0a
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu Mar 5 17:25:29 2020 -0800
ls: restore 8.31 behavior on removed directories
* NEWS: Mention this.
* src/ls.c: Do not include <sys/sycall.h>
(print_dir): Don't worry about whether the directory is removed.
* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
behavior.
---
NEWS | 9 +++++++++
src/ls.c | 22 ----------------------
tests/ls/removed-directory.sh | 23 ++++++-----------------
3 files changed, 15 insertions(+), 39 deletions(-)
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -1,5 +1,14 @@
GNU coreutils NEWS -*- outline -*-
+* Noteworthy downstream changes (on top of upstream coreutils-8.32)
+
+** Changes in behavior
+
+ On GNU/Linux systems, ls no longer issues an error message on
+ directory merely because it was removed. This reverts a change
+ that was made in release 8.32.
+
+
* Noteworthy changes in release 8.32 (2020-03-05) [stable]
** Bug fixes
Index: src/ls.c
===================================================================
--- src/ls.c.orig
+++ src/ls.c
@@ -49,10 +49,6 @@
# include <sys/ptem.h>
#endif
-#ifdef __linux__
-# include <sys/syscall.h>
-#endif
-
#include <stdio.h>
#include <assert.h>
#include <setjmp.h>
@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const
struct dirent *next;
uintmax_t total_blocks = 0;
static bool first = true;
- bool found_any_entries = false;
errno = 0;
dirp = opendir (name);
@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const
next = readdir (dirp);
if (next)
{
- found_any_entries = true;
if (! file_ignored (next->d_name))
{
enum filetype type = unknown;
@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const
if (errno != EOVERFLOW)
break;
}
-#ifdef __linux__
- else if (! found_any_entries)
- {
- /* If readdir finds no directory entries at all, not even "." or
- "..", then double check that the directory exists. */
- if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
- && errno != EINVAL)
- {
- /* We exclude EINVAL as that pertains to buffer handling,
- and we've passed NULL as the buffer for simplicity.
- ENOENT is returned if appropriate before buffer handling. */
- file_failure (command_line_arg, _("reading directory %s"), name);
- }
- break;
- }
-#endif
else
break;
Index: tests/ls/removed-directory.sh
===================================================================
--- tests/ls/removed-directory.sh.orig
+++ tests/ls/removed-directory.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# If ls is asked to list a removed directory (e.g. the parent process's
-# current working directory that has been removed by another process), it
-# emits an error message.
+# If ls is asked to list a removed directory (e.g., the parent process's
+# current working directory has been removed by another process), it
+# should not emit an error message merely because the directory is removed.
# Copyright (C) 2020 Free Software Foundation, Inc.
@@ -21,25 +21,14 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ ls
-case $host_triplet in
- *linux*) ;;
- *) skip_ 'non linux kernel' ;;
-esac
-
-LS_FAILURE=2
-
-cat <<\EOF >exp-err || framework_failure_
-ls: reading directory '.': No such file or directory
-EOF
-
cwd=$(pwd)
mkdir d || framework_failure_
cd d || framework_failure_
-rmdir ../d || framework_failure_
+rmdir ../d || skip_ "can't remove working directory on this platform"
-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
+ls >../out 2>../err || fail=1
cd "$cwd" || framework_failure_
compare /dev/null out || fail=1
-compare exp-err err || fail=1
+compare /dev/null err || fail=1
Exit $fail

View File

@ -37,7 +37,7 @@ Index: tests/misc/help-version.sh
=================================================================== ===================================================================
--- tests/misc/help-version.sh.orig --- tests/misc/help-version.sh.orig
+++ tests/misc/help-version.sh +++ tests/misc/help-version.sh
@@ -239,6 +239,7 @@ parted_setup () { args="-s $tmp_in mklab @@ -240,6 +240,7 @@ parted_setup () { args="-s $tmp_in mklab
for i in $built_programs; do for i in $built_programs; do
# Skip these. # Skip these.
case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac
@ -58,4 +58,4 @@ Index: tests/other-fs-tmpdir
+ +
if test -z "$other_partition_tmpdir"; then if test -z "$other_partition_tmpdir"; then
skip_ \ skip_ \
"requires a writable directory on a different disk partition, "requires a writable directory on a different file system,

View File

@ -31,7 +31,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier * hostid invocation:: Print numeric host identifier
* uptime invocation:: Print system uptime and load * uptime invocation:: Print system uptime and load
@@ -15761,7 +15759,6 @@ information. @@ -15947,7 +15945,6 @@ information.
* arch invocation:: Print machine hardware name. * arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors. * nproc invocation:: Print the number of processors.
* uname invocation:: Print system information. * uname invocation:: Print system information.
@ -39,7 +39,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier. * hostid invocation:: Print numeric host identifier.
* uptime invocation:: Print system uptime and load. * uptime invocation:: Print system uptime and load.
@end menu @end menu
@@ -16623,15 +16620,6 @@ Note this is non-portable (even across G @@ -16804,15 +16801,6 @@ Note this is non-portable (even across G
Print the machine hardware name (sometimes called the hardware class Print the machine hardware name (sometimes called the hardware class
or hardware type). or hardware type).
@ -55,7 +55,7 @@ Index: doc/coreutils.texi
@item -p @item -p
@itemx --processor @itemx --processor
@opindex -p @opindex -p
@@ -16685,34 +16673,6 @@ Print the kernel version. @@ -16866,34 +16854,6 @@ Print the kernel version.
@exitstatus @exitstatus

View File

@ -33,9 +33,9 @@ Index: doc/coreutils.texi
Delaying Delaying
* sleep invocation:: Delay for a specified time * sleep invocation:: Delay for a specified time
@@ -18089,90 +18083,6 @@ the exit status of @var{command} otherwi @@ -18310,90 +18304,6 @@ timeout -s INT 5s env --ignore-signal=IN
@end display timeout -s INT -k 3s 5s env --ignore-signal=INT sleep 20
@end example
-@node Process control -@node Process control
-@chapter Process control -@chapter Process control

View File

@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk
=================================================================== ===================================================================
--- gnulib-tests/gnulib.mk.orig --- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk +++ gnulib-tests/gnulib.mk
@@ -2485,9 +2485,10 @@ EXTRA_DIST += test-timespec.c macros.h @@ -2615,9 +2615,10 @@ EXTRA_DIST += test-timespec.c macros.h
## begin gnulib module tls-tests ## begin gnulib module tls-tests

View File

@ -0,0 +1,23 @@
# Downstream patch to skip a test failing on OBS.
# tests: skip tests/rm/ext3-perf.sh temporarily as it hangs on OBS
# (but otherwise is known to work locally).
---
tests/rm/ext3-perf.sh | 5 +++++
1 file changed, 5 insertions(+)
Index: tests/rm/ext3-perf.sh
===================================================================
--- tests/rm/ext3-perf.sh.orig
+++ tests/rm/ext3-perf.sh
@@ -19,6 +19,11 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
+# Skip this test: it's known to work locally (and it was working for a long
+# time on OBS), but it started to fail in Sep 2021 on OBS - seemingly on all
+# platforms (i586, x84_64, ppc64le, ppc64, aarch64, s390x).
+skip_ "SUSE: disabled for now as known to be failing on OBS"
+
very_expensive_
# In a circa 2008 benchmark, using rm -rf to remove a 400k-entry directory took:

View File

@ -1,46 +0,0 @@
Upstream patch to avoid FP in testsuite.
Remove with coreutils version > 8.32.
Discussed at:
https://lists.gnu.org/r/coreutils/2021-04/msg00050.html
Upstream patch:
https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=b7091093bb
From b7091093bb6505c33279f9bc940b2e94763a6e5d Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 21 Apr 2021 00:12:00 +0200
Subject: [PATCH] tests: fix FP in ls/stat-free-color.sh
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
newfstatat(STDOUT_FILENO, ...), but only when there is something to
output.
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
of ls, thus enforcing something gets output.
---
tests/ls/stat-free-color.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: tests/ls/stat-free-color.sh
===================================================================
--- tests/ls/stat-free-color.sh.orig
+++ tests/ls/stat-free-color.sh
@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat)
# The system may perform additional stat-like calls before main.
# Furthermore, underlying library functions may also implicitly
# add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d.
-# To avoid counting those, first get a baseline count for running
-# ls with one empty directory argument. Then, compare that with the
-# invocation under test.
+# Finally, ls(1) makes a stat call for stdout, but only in the case
+# when there is something to output.
+# To get the comparison right, first get a baseline count for running
+# 'ls -a' with one empty directory argument. Then, compare that with
+# the invocation under test.
mkdir d || framework_failure_
-strace -q -o log1 -e $stats ls --color=always d || fail=1
+strace -q -o log1 -e $stats ls -a --color=always d || fail=1
n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
test $n_stat1 = 0 \

View File

@ -16,7 +16,7 @@ Index: tests/local.mk
=================================================================== ===================================================================
--- tests/local.mk.orig --- tests/local.mk.orig
+++ tests/local.mk +++ tests/local.mk
@@ -723,14 +723,9 @@ all_tests = \ @@ -733,14 +733,9 @@ all_tests = \
# See tests/factor/create-test.sh. # See tests/factor/create-test.sh.
tf = tests/factor tf = tests/factor
factor_tests = \ factor_tests = \

View File

@ -1,4 +1,6 @@
--- tests/du/move-dir-while-traversing.sh Index: tests/du/move-dir-while-traversing.sh
===================================================================
--- tests/du/move-dir-while-traversing.sh.orig
+++ tests/du/move-dir-while-traversing.sh +++ tests/du/move-dir-while-traversing.sh
@@ -20,9 +20,9 @@ @@ -20,9 +20,9 @@
print_ver_ du print_ver_ du
@ -13,7 +15,7 @@
# Move a directory "up" while du is processing its sub-directories. # Move a directory "up" while du is processing its sub-directories.
# While du is processing a hierarchy .../B/C/D/... this script # While du is processing a hierarchy .../B/C/D/... this script
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@ python -m pyinotify -h > /dev/null \
# rename syscall before du finishes processing the subtree under D/. # rename syscall before du finishes processing the subtree under D/.
cat <<'EOF' > inotify-watch-for-dir-access.py cat <<'EOF' > inotify-watch-for-dir-access.py

View File

@ -1,3 +1,187 @@
-------------------------------------------------------------------
Mon Oct 4 22:15:01 UTC 2021 - Bernhard Voelker <mail@bernhard-voelker.de>
- coreutils-i18n.patch: Re-sync the patch with Fedora.
Refresh the patch, adding a hunk to link the expand+unexpand tools
against lib/mbfile.c, thus fixing build problems with clang
(see https://src.fedoraproject.org/rpms/coreutils/c/f4a53e34).
-------------------------------------------------------------------
Fri Oct 1 19:38:16 UTC 2021 - Dirk Müller <dmueller@suse.com>
- spec file cleanups (spec-cleaner run)
-------------------------------------------------------------------
Thu Sep 30 18:41:30 UTC 2021 - Bernhard Voelker <mail@bernhard-voelker.de>
- coreutils-skip-tests-rm-ext3-perf.patch: Add patch to skip the test
'tests/rm/ext3-perf.sh' temporarily as it hangs on OBS.
-------------------------------------------------------------------
Sun Sep 26 15:15:00 UTC 2021 - Bernhard Voelker <mail@bernhard-voelker.de>
- Update to 9.0:
* Noteworthy changes in release 9.0 (2021-09-24) [stable]
** Bug fixes
chmod -v no longer misreports modes of dangling symlinks.
[bug introduced in coreutils-5.3.0]
cp -a --attributes-only now never removes destination files,
even if the destination files are hardlinked, or the source
is a non regular file.
[bug introduced in coreutils-8.6]
csplit --suppress-matched now elides the last matched line
when a specific number of pattern matches are performed.
[bug introduced with the --suppress-matched feature in coreutils-8.22]
df no longer outputs duplicate remote mounts in the presence of bind mounts.
[bug introduced in coreutils-8.26]
df no longer mishandles command-line args that it pre-mounts
[bug introduced in coreutils-8.29]
du no longer crashes on XFS file systems when the directory hierarchy is
heavily changed during the run.
[bug introduced in coreutils-8.25]
env -S no longer crashes when given unusual whitespace characters
[bug introduced in coreutils-8.30]
expr no longer mishandles unmatched \(...\) in regular expressions.
[bug introduced in coreutils-6.0]
ls no longer crashes when printing the SELinux context for unstatable files.
[bug introduced in coreutils-6.9.91]
mkdir -m no longer mishandles modes more generous than the umask.
[bug introduced in coreutils-8.22]
nl now handles single character --section-delimiter arguments,
by assuming a second ':' character has been specified, as specified by POSIX.
[This bug was present in "the beginning".]
pr again adjusts tabs in input, to maintain alignment in multi column output.
[bug introduced in coreutils-6.9]
rm no longer skips an extra file when the removal of an empty directory fails.
[bug introduced by the rewrite to use fts in coreutils-8.0]
split --number=K/N will again correctly split chunk K of N to stdout.
Previously a chunk starting after 128KiB, output the wrong part of the file.
[bug introduced in coreutils-8.26]
tail -f no longer overruns a stack buffer when given too many files
to follow and ulimit -n exceeds 1024.
[bug introduced in coreutils-7.5]
tr no longer crashes when using --complement with certain
invalid combinations of case character classes.
[bug introduced in coreutils-8.6]
basenc --base64 --decode no longer silently discards decoded characters
on (1024*5) buffer boundaries
[bug introduced in coreutils-8.31]
** Changes in behavior
cp and install now default to copy-on-write (COW) if available.
cp, install and mv now use the copy_file_range syscall if available.
Also, they use lseek+SEEK_HOLE rather than ioctl+FS_IOC_FIEMAP on sparse
files, as lseek is simpler and more portable.
On GNU/Linux systems, ls no longer issues an error message on a
directory merely because it was removed. This reverts a change
that was made in release 8.32.
ptx -T no longer attempts to substitute old-fashioned TeX escapes
for 8-bit non-ASCII alphabetic characters. TeX indexes should
instead use '\usepackage[latin1]{inputenc}' or equivalent.
stat will use decomposed (major,minor) device numbers in its default format.
This is less ambiguous, and more consistent with ls.
sum [-r] will output a file name, even if only a single name is passed.
This is consistent with sum -s, cksum, and other sum(1) implementations.
** New Features
cksum now supports the -a (--algorithm) option to select any
of the existing sum, md5sum, b2sum, sha*sum implementations etc.
cksum now subsumes all of these programs, and coreutils
will introduce no future standalone checksum utility.
cksum -a now supports the 'sm3' argument, to use the SM3 digest algorithm.
cksum --check now supports auto detecting the digest type to use,
when verifying tagged format checksums.
expr and factor now support bignums on all platforms.
ls --classify now supports the "always", "auto", or "never" flags,
to support only outputting classifier characters if connected to a tty.
ls now accepts the --sort=width option, to sort by file name width.
This is useful to more compactly organize the default vertical column output.
ls now accepts the --zero option, to terminate each output line with
NUL instead of newline.
nl --line-increment can now take a negative number to decrement the count.
stat supports more formats for representing decomposed device numbers.
%Hd,%Ld and %Hr,%Lr will output major,minor device numbers and device types
respectively. %d corresponds to st_dev and %r to std_rdev.
** Improvements
cat --show-ends will now show \r\n as ^M$. Previously the \r was taken
literally, thus overwriting the first character in the line with '$'.
cksum [-a crc] is now up to 4 times faster by using a slice by 8 algorithm,
and at least 8 times faster where pclmul instructions are supported.
A new --debug option will indicate if pclmul is being used.
md5sum --check now supports checksum files with CRLF line endings.
This also applies to cksum, sha*sum, and b2sum.
df now recognizes these file systems as remote:
acfs, coda, fhgfs, gpfs, ibrix, ocfs2, and vxfs.
rmdir now clarifies the error if a symlink_to_dir/ has not been traversed.
This is the case on GNU/Linux systems, where the trailing slash is ignored.
stat and tail now know about the "devmem", "exfat", "secretmem", "vboxsf",
and "zonefs" file system types. stat -f -c%T now reports the file system
type, and tail -f uses polling for "vboxsf" and inotify for the others.
timeout now supports sub-second timeouts on macOS.
wc is up to 5 times faster when counting only new line characters,
where avx2 instructions are supported.
A new --debug option will indicate if avx2 is being used.
- Remove patches which are included in the new upstream version now:
* coreutils-gnulib-disable-test-float.patch
* coreutils-ls-restore-8.31-behavior-on-removed-dirs.patch
* coreutils-tests-fix-FP-in-ls-stat-free-color.patch
* gnulib-test-avoid-FP-perror-strerror.patch
- coreutils-i18n.patch: Refresh patch. Also patch 'tests/Coreutils.pm' used
by perl-based tests to allow longer test names ... which the i18n tests with
their "-mb" suffix have.
- coreutils-chmod-fix-exit-status-ign-symlinks.patch: Add upstream patch to
fix a regression with the exit code of chmod introduced in 9.0.
- coreutils.spec:
* Version: bump version.
* Remove the above removed patches.
* Reference the above new patch.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Apr 29 16:21:49 UTC 2021 - Callum Farmer <gmbr3@opensuse.org> Thu Apr 29 16:21:49 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -1,5 +1,5 @@
# #
# spec file for package coreutils%{?name_suffix} # spec file
# #
# Copyright (c) 2021 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
@ -16,27 +16,54 @@
# #
%bcond_with ringdisabled
# there are more fancy ways to define a package name using magic # there are more fancy ways to define a package name using magic
# macros but OBS and the bots that rely on parser information from # macros but OBS and the bots that rely on parser information from
# OBS can't deal with all of them # OBS can't deal with all of them
%define flavor @BUILD_FLAVOR@%{nil} %define flavor @BUILD_FLAVOR@%{nil}
%bcond_with ringdisabled
%if "%{flavor}" != "" %if "%{flavor}" != ""
%define name_suffix -%{flavor} %define name_suffix -%{flavor}
%if %{with ringdisabled} %if %{with ringdisabled}
ExclusiveArch: do_not_build ExclusiveArch: do_not_build
%endif %endif
%endif %endif
Name: coreutils%{?name_suffix} Name: coreutils%{?name_suffix}
Version: 9.0
Release: 0
Summary: GNU Core Utilities Summary: GNU Core Utilities
License: GPL-3.0-or-later License: GPL-3.0-or-later
Group: System/Base Group: System/Base
URL: https://www.gnu.org/software/coreutils/ URL: https://www.gnu.org/software/coreutils/
Version: 8.32 Source0: https://ftp.gnu.org/gnu/coreutils/coreutils-%{version}.tar.xz
Release: 0 Source1: https://ftp.gnu.org/gnu/coreutils/coreutils-%{version}.tar.xz.sig
Source2: https://savannah.gnu.org/project/release-gpgkeys.php?group=coreutils&download=1&file=./coreutils.keyring
Source3: baselibs.conf
Patch1: coreutils-remove_hostname_documentation.patch
Patch3: coreutils-remove_kill_documentation.patch
Patch4: coreutils-i18n.patch
Patch8: coreutils-sysinfo.patch
Patch16: coreutils-invalid-ids.patch
# OBS / RPMLINT require /usr/bin/timeout to be built with the -fpie option.
Patch100: coreutils-build-timeout-as-pie.patch
# There is no network in the build root so make the test succeed
Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
# a glibc issue in mkstemp.
Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
Patch301: coreutils-skip-gnulib-test-tls.patch
# tests: shorten extreme-expensive factor tests
Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
# Stop using Python 2.x
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 BuildRequires: automake
BuildRequires: gmp-devel BuildRequires: gmp-devel
BuildRequires: libacl-devel BuildRequires: libacl-devel
@ -46,7 +73,7 @@ BuildRequires: libselinux-devel
BuildRequires: makeinfo BuildRequires: makeinfo
BuildRequires: perl BuildRequires: perl
BuildRequires: xz BuildRequires: xz
%if %{suse_version} > 1320 %if 0%{?suse_version} > 1320
BuildRequires: gcc-PIE BuildRequires: gcc-PIE
%endif %endif
%if "%{name}" == "coreutils-testsuite" %if "%{name}" == "coreutils-testsuite"
@ -60,17 +87,13 @@ BuildRequires: strace
BuildRequires: timezone BuildRequires: timezone
# Some tests need the 'bin' user. # Some tests need the 'bin' user.
BuildRequires: user(bin) BuildRequires: user(bin)
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l armv7hl %ifarch %{ix86} x86_64 ppc ppc64 s390x armv7l armv7hl
BuildRequires: valgrind BuildRequires: valgrind
%endif %endif
%endif %endif
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single" %if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
Provides: fileutils = %{version} Provides: fileutils = %{version}
Provides: mktemp = %{version} Provides: mktemp = %{version}
%if 0%{?usrmerged}
Provides: /bin/mktemp
%endif
Provides: sh-utils = %{version} Provides: sh-utils = %{version}
Provides: stat = %{version} Provides: stat = %{version}
Provides: textutils = %{version} Provides: textutils = %{version}
@ -80,73 +103,6 @@ Provides: coreutils = %{version}-%{release}
%endif %endif
%endif %endif
# this will create a cycle, broken up randomly - coreutils is just
# too core to have other prerequisites.
#PreReq: permissions
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#cgit-URL: https://git.savannah.gnu.org/cgit/coreutils.git/
#Git-Clone: git://git.sv.gnu.org/coreutils
# For upgrading the upstream version, increase the version number (above),
# then remove the old tarball and signature files and let OSC download
# those files of the new version:
# osc rm coreutils-*.tar.xz coreutils-*.tar.xz.sig
# osc service localrun download_files
# osc addremove
# Then adjust the downstream patches (using quilt).
# Finally, add a changelog entry and commit:
# osc vc
# osc ci
Source0: https://ftp.gnu.org/gnu/coreutils/coreutils-%{version}.tar.xz
Source1: https://ftp.gnu.org/gnu/coreutils/coreutils-%{version}.tar.xz.sig
Source2: https://savannah.gnu.org/project/release-gpgkeys.php?group=coreutils&download=1&file=./coreutils.keyring
Source3: baselibs.conf
Patch1: coreutils-remove_hostname_documentation.patch
Patch3: coreutils-remove_kill_documentation.patch
Patch4: coreutils-i18n.patch
Patch8: coreutils-sysinfo.patch
Patch16: coreutils-invalid-ids.patch
# OBS / RPMLINT require /usr/bin/timeout to be built with the -fpie option.
Patch100: coreutils-build-timeout-as-pie.patch
# There is no network in the build root so make the test succeed
Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
# a glibc issue in mkstemp.
Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
Patch301: coreutils-skip-gnulib-test-tls.patch
# tests: shorten extreme-expensive factor tests
Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
# Stop using Python 2.x
Patch304: coreutils-use-python3.patch
Patch500: coreutils-disable_tests.patch
Patch501: coreutils-test_without_valgrind.patch
# Upstream commits (squashed) after the release of coreutils-8.32:
# [PATCH 1/2] ls: restore 8.31 behavior on removed directories
# [PATCH 2/2] ls: improve removed-directory test
# Remove this patch with the next coreutils release.
Patch800: coreutils-ls-restore-8.31-behavior-on-removed-dirs.patch
Patch820: coreutils-gnulib-disable-test-float.patch
# Avoid FP error in gnulib tests 'test-perror2' and 'test-strerror_r'.
Patch840: gnulib-test-avoid-FP-perror-strerror.patch
# Upstream patch - remove with version >8.32:
# avoid FP error in 'tests/ls/stat-free-color.sh'.
Patch860: coreutils-tests-fix-FP-in-ls-stat-free-color.patch
# ================================================ # ================================================
%description %description
These are the GNU core utilities. This package is the union of These are the GNU core utilities. This package is the union of
@ -165,9 +121,9 @@ the GNU fileutils, sh-utils, and textutils packages.
%package doc %package doc
Summary: Documentation for the GNU Core Utilities Summary: Documentation for the GNU Core Utilities
Group: Documentation/Man Group: Documentation/Man
Provides: coreutils:%{_infodir}/coreutils.info.gz
Supplements: (coreutils-single and patterns-base-documentation)
Supplements: (coreutils and patterns-base-documentation) Supplements: (coreutils and patterns-base-documentation)
Supplements: (coreutils-single and patterns-base-documentation)
Provides: coreutils:%{_infodir}/coreutils.info.gz
BuildArch: noarch BuildArch: noarch
%description doc %description doc
@ -184,7 +140,7 @@ This package contains the documentation for the GNU Core Utilities.
%patch8 %patch8
%patch16 %patch16
# #
%if %{suse_version} <= 1320 %if 0%{?suse_version} <= 1320
%patch100 %patch100
%endif %endif
%patch112 %patch112
@ -192,7 +148,7 @@ This package contains the documentation for the GNU Core Utilities.
%patch300 %patch300
%ifarch %ix86 x86_64 ppc ppc64 %ifarch %{ix86} x86_64 ppc ppc64
%patch301 %patch301
%endif %endif
@ -202,21 +158,14 @@ This package contains the documentation for the GNU Core Utilities.
%patch501 %patch501
%patch800 %patch800
%patch810
%ifarch ppc ppc64le
# Disable gnulib test 'test-float' temporarily as it fails on ppc and ppc64le.
%patch820
%endif
%patch840
%patch860
# ================================================ # ================================================
%build %build
%if 0%{suse_version} >= 1200 %if 0%{?suse_version} >= 1200
AUTOPOINT=true autoreconf -fi AUTOPOINT=true autoreconf -fi
%endif %endif
export CFLAGS="%optflags" export CFLAGS="%{optflags}"
%configure --libexecdir=%{_libdir} \ %configure --libexecdir=%{_libdir} \
--enable-install-program=arch \ --enable-install-program=arch \
--enable-no-install-program=kill \ --enable-no-install-program=kill \
@ -228,12 +177,12 @@ export CFLAGS="%optflags"
DEFAULT_POSIX2_VERSION=200112 \ DEFAULT_POSIX2_VERSION=200112 \
alternative=199209 alternative=199209
make -C po update-po %make_build -C po update-po
# Regenerate manpages # Regenerate manpages
touch man/*.x touch man/*.x
make all %{?_smp_mflags} V=1 %make_build all
# make sure that parse-datetime.{c,y} ends up in debuginfo (rh#1555079) # make sure that parse-datetime.{c,y} ends up in debuginfo (rh#1555079)
ln -v lib/parse-datetime.{c,y} . ln -v lib/parse-datetime.{c,y} .
@ -245,31 +194,20 @@ ln -v lib/parse-datetime.{c,y} .
chmod a+x tests/misc/sort-mb-tests.sh chmod a+x tests/misc/sort-mb-tests.sh
# Avoid parallel make, because otherwise some timeout based tests like # Avoid parallel make, because otherwise some timeout based tests like
# rm/ext3-perf may fail due to high CPU or IO load. # rm/ext3-perf may fail due to high CPU or IO load.
make check-very-expensive \ %make_build check-very-expensive \
&& install -d -m 755 %{buildroot}%{_docdir}/%{name} \ && install -d -m 755 %{buildroot}%{_docdir}/%{name} \
&& xz -c tests/test-suite.log \ && xz -c tests/test-suite.log \
> %{buildroot}%{_docdir}/%{name}/test-suite.log.xz > %{buildroot}%{_docdir}/%{name}/test-suite.log.xz
%else %else
# Run the shorter check otherwise. # Run the shorter check otherwise.
make check %make_build check
%endif %endif
# ================================================ # ================================================
%install %install
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single" %if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
make install DESTDIR="%buildroot" pkglibexecdir=%{_libdir}/%{name} make install DESTDIR=%{buildroot} pkglibexecdir=%{_libdir}/%{name}
#UsrMerge
%if !0%{?usrmerged}
install -d %{buildroot}/bin
for i in arch basename cat chgrp chmod chown cp date dd df echo \
false ln ls mkdir mknod mktemp mv pwd rm rmdir sleep sort stat \
stty sync touch true uname readlink md5sum
do
ln -sf %{_bindir}/$i %{buildroot}/bin/$i
done
%endif
#EndUsrMerge
echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1 echo '.so man1/test.1' > %{buildroot}/%{_mandir}/man1/\[.1
%if "%{name}" == "coreutils" %if "%{name}" == "coreutils"
%find_lang coreutils %find_lang coreutils
@ -300,24 +238,17 @@ rm -rf %{buildroot}%{_datadir}/locale
%files %files
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single" %if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%defattr(-,root,root)
%license COPYING %license COPYING
%doc NEWS README THANKS %doc NEWS README THANKS
%{_bindir}/* %{_bindir}/*
#UsrMerge
%if !0%{?usrmerged}
/bin/*
%endif
#EndUsrMerge
%{_libdir}/%{name} %{_libdir}/%{name}
%if "%{name}" == "coreutils" %if "%{name}" == "coreutils"
%files lang -f coreutils.lang %files lang -f coreutils.lang
%defattr(-,root,root)
%files doc %files doc
%doc %{_infodir}/coreutils.info*.gz %{_infodir}/coreutils.info*.gz
%doc %{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1%{?ext_man}
%endif %endif
%else %else

View File

@ -1,101 +0,0 @@
Avoid false-positive error in gnulib tests 'test-perror2' and 'test-strerror_r'.
On openSUSE OBS, the above gnulib tests fail on armv7l.
Corresponding report on the gnulib mailing list:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
From: Florian Weimer
Date: Thu, 27 Aug 2020 09:41:34 +0200
Subject: Use-after-free in test-perror2, test-strerror_r
The problem is visible with glibc 2.32 under valgrind:
==20== Invalid read of size 1
==20== at 0x483DAB4: strcmp (vg_replace_strmem.c:847)
==20== by 0x109414: main (test-perror2.c:84)
==20== Address 0x4a1a3d0 is 0 bytes inside a block of size 17 free'd
==20== at 0x483A9F5: free (vg_replace_malloc.c:538)
==20== by 0x48E2134: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x109328: main (test-perror2.c:72)
==20== Block was alloc'd at
==20== at 0x4839809: malloc (vg_replace_malloc.c:307)
==20== by 0x48CA03F: __vasprintf_internal (in /usr/lib64/libc-2.32.so)
==20== by 0x48A46F9: asprintf (in /usr/lib64/libc-2.32.so)
==20== by 0x48E2184: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x1092E2: main (test-perror2.c:67)
==20==
==20== Invalid read of size 1
==20== at 0x483DAC8: strcmp (vg_replace_strmem.c:847)
==20== by 0x109414: main (test-perror2.c:84)
==20== Address 0x4a1a3d1 is 1 bytes inside a block of size 17 free'd
==20== at 0x483A9F5: free (vg_replace_malloc.c:538)
==20== by 0x48E2134: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x109328: main (test-perror2.c:72)
==20== Block was alloc'd at
==20== at 0x4839809: malloc (vg_replace_malloc.c:307)
==20== by 0x48CA03F: __vasprintf_internal (in /usr/lib64/libc-2.32.so)
==20== by 0x48A46F9: asprintf (in /usr/lib64/libc-2.32.so)
==20== by 0x48E2184: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x1092E2: main (test-perror2.c:67)
I think it's the test that's invalid.
This was reported as an actual grep test failure (without valgrind) on
32-bit Arm, where glibc malloc happens to return a different buffer
address for the internal allocation (so that msg3 != msg4).
test-strerror_r has the same issue.
Thanks,
Florian
Upstream patch:
https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=175e0bc72808
From 175e0bc72808d564074c4adcc72aeadb74adfcc6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 27 Aug 2020 17:52:58 -0700
Subject: [PATCH] perror, strerror_r: remove unportable tests
Problem reported by Florian Weimer in:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
* tests/test-perror2.c (main):
* tests/test-strerror_r.c (main): Omit unportable tests.
This downstream patch is identical to upstream one modulo the ChangeLog entry.
---
gnulib-tests/test-perror2.c | 3 ---
gnulib-tests/test-strerror_r.c | 3 ---
2 files changed, 6 deletions(-)
Index: gnulib-tests/test-perror2.c
===================================================================
--- gnulib-tests/test-perror2.c.orig
+++ gnulib-tests/test-perror2.c
@@ -79,9 +79,6 @@ main (void)
errno = -5;
perror ("");
ASSERT (!ferror (stderr));
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);
Index: gnulib-tests/test-strerror_r.c
===================================================================
--- gnulib-tests/test-strerror_r.c.orig
+++ gnulib-tests/test-strerror_r.c
@@ -165,9 +165,6 @@ main (void)
strerror_r (EACCES, buf, sizeof buf);
strerror_r (-5, buf, sizeof buf);
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);