Initialize for coreutils

This commit is contained in:
zyppe 2024-02-06 16:48:14 +08:00
commit 3b5057119c
25 changed files with 10659 additions and 0 deletions

1
.coreutils.metadata Normal file
View file

@ -0,0 +1 @@
cb6b804ac6193a4e3b0ce59473ac38a47e120d2fbc7e08bd205088e5b5ddedbb coreutils-8.32.tar.xz

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
coreutils-8.32.tar.xz

3
baselibs.conf Normal file
View file

@ -0,0 +1,3 @@
targettype x86 package coreutils
+^/bin/uname$
prereq -glibc-x86

16
coreutils-8.32.tar.xz.sig Normal file
View file

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

View file

@ -0,0 +1,39 @@
From d1a49cccf99373293a88f5bce74857d5bb813e46 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Thu, 10 Jan 2013 09:21:22 +0200
Subject: build timeout as PIE
The OBS requires /usr/bin/timeout to be built as an position
independent executable (PIE). This is enforced via RPMLINT.
* src/local.mk (AM_CFLAGS): Add -fpie option.
(timeout_CFLAGS): Likewise.
(timeout_LDFLAGS): Add -pie option.
---
src/local.mk | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: src/local.mk
===================================================================
--- src/local.mk.orig
+++ src/local.mk
@@ -17,7 +17,7 @@
## along with this program. If not, see <https://www.gnu.org/licenses/>.
# FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am
-AM_CFLAGS = $(WERROR_CFLAGS)
+AM_CFLAGS = $(WERROR_CFLAGS) -fpie
# The list of all programs (separated in different variables to express
# the how and when they should be installed) is defined in this makefile
@@ -280,6 +280,9 @@ src_factor_LDADD += $(LIB_GMP)
# for getloadavg
src_uptime_LDADD += $(GETLOADAVG_LIBS)
+src_timeout_CFLAGS = -fpie
+src_timeout_LDFLAGS = -pie
+
# for various ACL functions
copy_ldadd += $(LIB_ACL)
src_ls_LDADD += $(LIB_HAS_ACL)

View file

@ -0,0 +1,29 @@
From 9a38d499ca16f2f4304992eb1ab0894cd0b478e1 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 7 Jun 2021 14:43:03 +0200
Subject: [PATCH] mountlist: recognize fuse.portal as dummy file system
This was originally proposed at:
https://lists.gnu.org/archive/html/bug-gnulib/2021-02/msg00053.html
As the full review might take some time, would it be possible to apply
at least the part related to fuse.portal file systems? They started to
cause problems recently:
https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal/+bug/1905623
https://github.com/muesli/duf/issues/35
https://bugzilla.redhat.com/1913358
---
diff --git a/lib/mountlist.c b/lib/mountlist.c
index f5d1364c1..e4c177982 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -170,6 +170,7 @@
|| strcmp (Fs_type, "debugfs") == 0 \
|| strcmp (Fs_type, "devpts") == 0 \
|| strcmp (Fs_type, "fusectl") == 0 \
+ || strcmp (Fs_type, "fuse.portal") == 0 \
|| strcmp (Fs_type, "mqueue") == 0 \
|| strcmp (Fs_type, "rpc_pipefs") == 0 \
|| strcmp (Fs_type, "sysfs") == 0 \

View file

@ -0,0 +1,23 @@
---
gnulib-tests/gnulib.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -951,10 +951,10 @@ EXTRA_DIST += test-getloadavg.c signatur
## begin gnulib module getlogin-tests
-TESTS += test-getlogin
-check_PROGRAMS += test-getlogin
-test_getlogin_LDADD = $(LDADD) $(LIB_GETLOGIN)
-EXTRA_DIST += test-getlogin.c test-getlogin.h signature.h macros.h
+#TESTS += test-getlogin
+#check_PROGRAMS += test-getlogin
+#test_getlogin_LDADD = $(LDADD) $(LIB_GETLOGIN)
+#EXTRA_DIST += test-getlogin.c test-getlogin.h signature.h macros.h
## end gnulib module getlogin-tests

View file

@ -0,0 +1,21 @@
---
gnulib-tests/test-getaddrinfo.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Index: gnulib-tests/test-getaddrinfo.c
===================================================================
--- gnulib-tests/test-getaddrinfo.c.orig
+++ gnulib-tests/test-getaddrinfo.c
@@ -93,11 +93,7 @@ simple (char const *host, char const *se
the test merely because someone is down the country on their
in-law's farm. */
if (res == EAI_AGAIN)
- {
- skip++;
- fprintf (stderr, "skipping getaddrinfo test: no network?\n");
- return 77;
- }
+ return 0;
/* IRIX reports EAI_NONAME for "https". Don't fail the test
merely because of this. */
if (res == EAI_NONAME)

View file

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

5332
coreutils-i18n.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
While uid_t and gid_t are both unsigned, the values (uid_t) -1 and
(gid_t) -1 are reserved. A uid or gid argument of -1 to the chown(2)
system call means to leave the uid/gid unchanged. Catch this case
so that trying to set a uid or gid to -1 will result in an error.
Test cases:
chown 4294967295 file
chown :4294967295 file
chgrp 4294967295 file
Andreas Gruenbacher <agruen@suse.de>
---
src/chgrp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: src/chgrp.c
===================================================================
--- src/chgrp.c.orig
+++ src/chgrp.c
@@ -89,7 +89,7 @@ parse_group (const char *name)
{
uintmax_t tmp;
if (! (xstrtoumax (name, NULL, 10, &tmp, "") == LONGINT_OK
- && tmp <= GID_T_MAX))
+ && tmp <= GID_T_MAX && (gid_t) tmp != (gid_t) -1))
die (EXIT_FAILURE, 0, _("invalid group: %s"),
quote (name));
gid = tmp;

View file

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

61
coreutils-misc.patch Normal file
View file

@ -0,0 +1,61 @@
---
gnulib-tests/test-isnanl.h | 5 +++--
tests/misc/help-version.sh | 1 +
tests/other-fs-tmpdir | 3 +++
3 files changed, 7 insertions(+), 2 deletions(-)
Index: gnulib-tests/test-isnanl.h
===================================================================
--- gnulib-tests/test-isnanl.h.orig
+++ gnulib-tests/test-isnanl.h
@@ -47,7 +47,7 @@ main ()
/* Quiet NaN. */
ASSERT (isnanl (NaNl ()));
-#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
+#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT && 0
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
@@ -98,6 +98,7 @@ main ()
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
ASSERT (isnanl (x.value));
}
+#if 0
/* isnanl should return something for noncanonical values. */
{ /* Pseudo-NaN. */
static memory_long_double x =
@@ -125,6 +126,6 @@ main ()
ASSERT (isnanl (x.value) || !isnanl (x.value));
}
#endif
-
+#endif
return 0;
}
Index: tests/misc/help-version.sh
===================================================================
--- tests/misc/help-version.sh.orig
+++ tests/misc/help-version.sh
@@ -239,6 +239,7 @@ parted_setup () { args="-s $tmp_in mklab
for i in $built_programs; do
# Skip these.
case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac
+ case $i in df) continue;; esac
rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2
echo z |gzip > $zin
Index: tests/other-fs-tmpdir
===================================================================
--- tests/other-fs-tmpdir.orig
+++ tests/other-fs-tmpdir
@@ -43,6 +43,9 @@ for d in $CANDIDATE_TMP_DIRS; do
done
+# Autobuild hack
+test -f /bin/uname.bin && other_partition_tmpdir=
+
if test -z "$other_partition_tmpdir"; then
skip_ \
"requires a writable directory on a different disk partition,

View file

@ -0,0 +1,92 @@
---
doc/coreutils.texi | 42 +-----------------------------------------
1 file changed, 1 insertion(+), 41 deletions(-)
Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -71,7 +71,6 @@
* groups: (coreutils)groups invocation. Print group names a user is in.
* head: (coreutils)head invocation. Output the first part of files.
* hostid: (coreutils)hostid invocation. Print numeric host identifier.
-* hostname: (coreutils)hostname invocation. Print or set system name.
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
@@ -203,7 +202,7 @@ Free Documentation License''.
* File name manipulation:: dirname basename pathchk mktemp realpath
* Working context:: pwd stty printenv tty
* User information:: id logname whoami groups users who
-* System context:: date arch nproc uname hostname hostid uptime
+* System context:: date arch nproc uname hostid uptime
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
* Process control:: kill
@@ -426,7 +425,6 @@ System context
* date invocation:: Print or set system date and time
* nproc invocation:: Print the number of processors
* uname invocation:: Print system information
-* hostname invocation:: Print or set system name
* hostid invocation:: Print numeric host identifier
* uptime invocation:: Print system uptime and load
@@ -15761,7 +15759,6 @@ information.
* arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors.
* uname invocation:: Print system information.
-* hostname invocation:: Print or set system name.
* hostid invocation:: Print numeric host identifier.
* uptime invocation:: Print system uptime and load.
@end menu
@@ -16623,15 +16620,6 @@ Note this is non-portable (even across G
Print the machine hardware name (sometimes called the hardware class
or hardware type).
-@item -n
-@itemx --nodename
-@opindex -n
-@opindex --nodename
-@cindex hostname
-@cindex node name
-@cindex network node name
-Print the network node hostname.
-
@item -p
@itemx --processor
@opindex -p
@@ -16685,34 +16673,6 @@ Print the kernel version.
@exitstatus
-
-@node hostname invocation
-@section @command{hostname}: Print or set system name
-
-@pindex hostname
-@cindex setting the hostname
-@cindex printing the hostname
-@cindex system name, printing
-@cindex appropriate privileges
-
-With no arguments, @command{hostname} prints the name of the current host
-system. With one argument, it sets the current host name to the
-specified string. You must have appropriate privileges to set the host
-name. Synopsis:
-
-@example
-hostname [@var{name}]
-@end example
-
-The only options are @option{--help} and @option{--version}. @xref{Common
-options}.
-
-@command{hostname} is not installed by default, and other packages
-also supply a @command{hostname} command, so portable scripts should
-not rely on its existence or on the exact behavior documented above.
-
-@exitstatus
-
@node hostid invocation
@section @command{hostid}: Print numeric host identifier

View file

@ -0,0 +1,126 @@
---
doc/coreutils.texi | 90 -----------------------------------------------------
1 file changed, 90 deletions(-)
Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -74,7 +74,6 @@
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
-* kill: (coreutils)kill invocation. Send a signal to processes.
* link: (coreutils)link invocation. Make hard links between files.
* ln: (coreutils)ln invocation. Make links between files.
* logname: (coreutils)logname invocation. Print current login name.
@@ -205,7 +204,6 @@ Free Documentation License''.
* System context:: date arch nproc uname hostid uptime
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
-* Process control:: kill
* Delaying:: sleep
* Numeric operations:: factor numfmt seq
* File permissions:: Access modes
@@ -453,10 +451,6 @@ Modified command invocation
* stdbuf invocation:: Run a command with modified I/O buffering
* timeout invocation:: Run a command with a time limit
-Process control
-
-* kill invocation:: Sending a signal to processes.
-
Delaying
* sleep invocation:: Delay for a specified time
@@ -18089,90 +18083,6 @@ the exit status of @var{command} otherwi
@end display
-@node Process control
-@chapter Process control
-
-@cindex processes, commands for controlling
-@cindex commands for controlling processes
-
-@menu
-* kill invocation:: Sending a signal to processes.
-@end menu
-
-
-@node kill invocation
-@section @command{kill}: Send a signal to processes
-
-@pindex kill
-@cindex send a signal to processes
-
-The @command{kill} command sends a signal to processes, causing them
-to terminate or otherwise act upon receiving the signal in some way.
-Alternatively, it lists information about signals. Synopses:
-
-@example
-kill [-s @var{signal} | --signal @var{signal} | -@var{signal}] @var{pid}@dots{}
-kill [-l | --list | -t | --table] [@var{signal}]@dots{}
-@end example
-
-@mayConflictWithShellBuiltIn{kill}
-
-The first form of the @command{kill} command sends a signal to all
-@var{pid} arguments. The default signal to send if none is specified
-is @samp{TERM}@. The special signal number @samp{0} does not denote a
-valid signal, but can be used to test whether the @var{pid} arguments
-specify processes to which a signal could be sent.
-
-If @var{pid} is positive, the signal is sent to the process with the
-process ID @var{pid}. If @var{pid} is zero, the signal is sent to all
-processes in the process group of the current process. If @var{pid}
-is @minus{}1, the signal is sent to all processes for which the user has
-permission to send a signal. If @var{pid} is less than @minus{}1, the signal
-is sent to all processes in the process group that equals the absolute
-value of @var{pid}.
-
-If @var{pid} is not positive, a system-dependent set of system
-processes is excluded from the list of processes to which the signal
-is sent.
-
-If a negative @var{pid} argument is desired as the first one, it
-should be preceded by @option{--}. However, as a common extension to
-POSIX, @option{--} is not required with @samp{kill
--@var{signal} -@var{pid}}. The following commands are equivalent:
-
-@example
-kill -15 -1
-kill -TERM -1
-kill -s TERM -- -1
-kill -- -1
-@end example
-
-The first form of the @command{kill} command succeeds if every @var{pid}
-argument specifies at least one process that the signal was sent to.
-
-The second form of the @command{kill} command lists signal information.
-Either the @option{-l} or @option{--list} option, or the @option{-t}
-or @option{--table} option must be specified. Without any
-@var{signal} argument, all supported signals are listed. The output
-of @option{-l} or @option{--list} is a list of the signal names, one
-per line; if @var{signal} is already a name, the signal number is
-printed instead. The output of @option{-t} or @option{--table} is a
-table of signal numbers, names, and descriptions. This form of the
-@command{kill} command succeeds if all @var{signal} arguments are valid
-and if there is no output error.
-
-The @command{kill} command also supports the @option{--help} and
-@option{--version} options. @xref{Common options}.
-
-A @var{signal} may be a signal name like @samp{HUP}, or a signal
-number like @samp{1}, or an exit status of a process terminated by the
-signal. A signal name can be given in canonical form or prefixed by
-@samp{SIG}@. The case of the letters is ignored, except for the
-@option{-@var{signal}} option which must use upper case to avoid
-ambiguity with lower case option letters.
-@xref{Signal specifications}, for a list of supported
-signal names and numbers.
-
@node Delaying
@chapter Delaying

View file

@ -0,0 +1,37 @@
Subject: Skip the gnulib test 'test-tls' on some platforms
On i586, x86_64, ppc and ppc64, this test is known to sometimes fail
with a diagnostic like:
Starting test_tls ...*** Error in `./test-tls': free(): invalid pointer: 0x00007f21500008c0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7406f)[0x7f215845006f]
/lib64/libc.so.6(+0x7989e)[0x7f215845589e]
/lib64/libpthread.so.0(+0x7ee2)[0x7f215878fee2]
/lib64/libpthread.so.0(+0x813e)[0x7f215879013e]
/lib64/libc.so.6(clone+0x6d)[0x7f21584c3d6d]
* gnulib-tests/gnulib.mk (test-tls): Comment to skip for now.
---
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
@@ -2485,9 +2485,10 @@ EXTRA_DIST += test-timespec.c macros.h
## begin gnulib module tls-tests
-TESTS += test-tls
-check_PROGRAMS += test-tls
-test_tls_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
+# Fails on i586 and x86_64.
+#TESTS += test-tls
+#check_PROGRAMS += test-tls
+#test_tls_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@
EXTRA_DIST += test-tls.c

View file

@ -0,0 +1,52 @@
Subject: tests: skip some valgrind-ed tests of sort on ppc/ppc64
Valgrind diagnoses problems in 'mkstemp64' deep down in glibc on PowerPC:
Conditional jump or move depends on uninitialised value(s)
at 0xFDB37DC: __udivmoddi4 (in /lib/libc-2.18.90.so)
by 0xFDB3DD7: __umoddi3@GLIBC_2.0 (in /lib/libc-2.18.90.so)
by 0xFDFDF9F: __gen_tempname (in /lib/libc-2.18.90.so)
by 0xFE77563: mkstemp64 (in /lib/libc-2.18.90.so)
by 0x100135D3: mkstemp_safer (mkstemp-safer.c:33)
by 0x10006ECF: create_temp_file (sort.c:942)
by 0x1000A427: maybe_create_temp (sort.c:1176)
by 0x100031BF: main (sort.c:1223)
* tests/misc/sort-stale-thread-mem.sh: Skip on ppc/ppc64.
* tests/misc/sort-u-FMR.sh: Likewise.
---
tests/misc/sort-stale-thread-mem.sh | 4 ++++
tests/misc/sort-u-FMR.sh | 4 ++++
2 files changed, 8 insertions(+)
Index: tests/misc/sort-stale-thread-mem.sh
===================================================================
--- tests/misc/sort-stale-thread-mem.sh.orig
+++ tests/misc/sort-stale-thread-mem.sh
@@ -27,6 +27,10 @@ require_valgrind_
grep '^#define HAVE_PTHREAD_T 1' "$CONFIG_HEADER" > /dev/null ||
skip_ 'requires pthreads'
+case "$( uname -m )" in
+ ppc | ppc64) skip_ "SUSE: disabled for now on ppc/ppc64";;
+esac
+
# gensort output seems to trigger the failure more often,
# so prefer gensort if it is available.
(gensort -a 10000 in) 2>/dev/null ||
Index: tests/misc/sort-u-FMR.sh
===================================================================
--- tests/misc/sort-u-FMR.sh.orig
+++ tests/misc/sort-u-FMR.sh
@@ -20,6 +20,10 @@
print_ver_ sort
require_valgrind_
+case "$( uname -m )" in
+ ppc | ppc64) skip_ "SUSE: disabled for now on ppc/ppc64";;
+esac
+
{ echo 0; printf '%0900d\n' 1; } > in || framework_failure_
valgrind --error-exitcode=1 sort --p=1 -S32b -u in > out || fail=1

64
coreutils-sysinfo.patch Normal file
View file

@ -0,0 +1,64 @@
---
src/uname.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: src/uname.c
===================================================================
--- src/uname.c.orig
+++ src/uname.c
@@ -338,6 +338,36 @@ main (int argc, char **argv)
# endif
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char processor[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (processor, name.machine);
+ element = processor;
+#ifdef __linux__
+ if (!strcmp (element, "i686"))
+ {
+ /* Check for Athlon */
+ char line[1024];
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+ if (f)
+ {
+ while (fgets (line, sizeof (line), f) > 0)
+ {
+ if (strncmp (line, "vendor_id", 9) == 0)
+ {
+ if (strstr (line, "AuthenticAMD"))
+ element = "athlon";
+ break;
+ }
+ }
+ fclose (f);
+ }
+ }
+#endif
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}
@@ -363,6 +393,18 @@ main (int argc, char **argv)
element = hardware_platform;
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char hardware_platform[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (hardware_platform, name.machine);
+ if (hardware_platform[0] == 'i' && hardware_platform[2] == '8'
+ && hardware_platform[3] == '6' && hardware_platform[4] == 0)
+ hardware_platform[1] = '3';
+ element = hardware_platform;
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}

View file

@ -0,0 +1,18 @@
---
tests/misc/shuf-reservoir.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: tests/misc/shuf-reservoir.sh
===================================================================
--- tests/misc/shuf-reservoir.sh.orig
+++ tests/misc/shuf-reservoir.sh
@@ -37,8 +37,7 @@ run_shuf_n()
# Critical memory-related bugs will cause a segfault here
# (with varying numbers of input/output lines)
- seq "$INPUT_LINES" | valgrind --leak-check=$leaklevel --error-exitcode=1 \
- shuf -n "$OUTPUT_LINES" -o "out_${INPUT_LINES}_${OUTPUT_LINES}" || return 1
+ seq "$INPUT_LINES" | shuf -n "$OUTPUT_LINES" -o "out_${INPUT_LINES}_${OUTPUT_LINES}" || return 1
EXPECTED_LINES="$OUTPUT_LINES"
test "$INPUT_LINES" -lt "$OUTPUT_LINES" && EXPECTED_LINES="$INPUT_LINES"

View file

@ -0,0 +1,36 @@
From d3b433bd41c8978c31fee085cc7e6b0554a4c03e Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 8 Jan 2014 01:15:58 +0100
Subject: [PATCH] tests: shorten extreme-expensive factor tests
The extended factor tests alone can take several hours on e.g. i586
or arm6l. Strip the tests down from 37 to 3.
* tests/local.mk (factor_tests): From the sequence of the tests
00..36, remove all but t00, t05 and t36.
---
tests/local.mk | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
@@ -723,14 +723,9 @@ all_tests = \
# See tests/factor/create-test.sh.
tf = tests/factor
factor_tests = \
- $(tf)/t00.sh $(tf)/t01.sh $(tf)/t02.sh $(tf)/t03.sh $(tf)/t04.sh \
- $(tf)/t05.sh $(tf)/t06.sh $(tf)/t07.sh $(tf)/t08.sh $(tf)/t09.sh \
- $(tf)/t10.sh $(tf)/t11.sh $(tf)/t12.sh $(tf)/t13.sh $(tf)/t14.sh \
- $(tf)/t15.sh $(tf)/t16.sh $(tf)/t17.sh $(tf)/t18.sh $(tf)/t19.sh \
- $(tf)/t20.sh $(tf)/t21.sh $(tf)/t22.sh $(tf)/t23.sh $(tf)/t24.sh \
- $(tf)/t25.sh $(tf)/t26.sh $(tf)/t27.sh $(tf)/t28.sh $(tf)/t29.sh \
- $(tf)/t30.sh $(tf)/t31.sh $(tf)/t32.sh $(tf)/t33.sh $(tf)/t34.sh \
- $(tf)/t35.sh $(tf)/t36.sh
+ $(tf)/t00.sh \
+ $(tf)/t05.sh \
+ $(tf)/t36.sh
$(factor_tests): $(tf)/run.sh $(tf)/create-test.sh
$(AM_V_GEN)$(MKDIR_P) $(tf)

View file

@ -0,0 +1,24 @@
--- tests/du/move-dir-while-traversing.sh
+++ tests/du/move-dir-while-traversing.sh
@@ -20,9 +20,9 @@
print_ver_ du
require_trap_signame_
-# We use a python-inotify script, so...
-python -m pyinotify -h > /dev/null \
- || skip_ 'python inotify package not installed'
+# We use a python3-inotify script, so...
+python3 -m pyinotify -h > /dev/null \
+ || skip_ 'python3 inotify package not installed'
# Move a directory "up" while du is processing its sub-directories.
# While du is processing a hierarchy .../B/C/D/... this script
@@ -33,7 +33,7 @@
# rename syscall before du finishes processing the subtree under D/.
cat <<'EOF' > inotify-watch-for-dir-access.py
-#!/usr/bin/env python
+#!/usr/bin/env python3
import pyinotify as pn
import os,sys

2948
coreutils.changes Normal file

File diff suppressed because it is too large Load diff

1103
coreutils.keyring Normal file

File diff suppressed because it is too large Load diff

321
coreutils.spec Normal file
View file

@ -0,0 +1,321 @@
#
# spec file for package coreutils
#
# Copyright (c) 2022-2023 ZhuningOS
#
%bcond_with ringdisabled
# 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 %{nil}
%if "%{flavor}" != ""
%define name_suffix -%{flavor}
%if %{with ringdisabled}
ExclusiveArch: do_not_build
%endif
%endif
Name: coreutils%{?name_suffix}
Summary: GNU Core Utilities
License: GPL-3.0-or-later
Group: System/Base
URL: https://www.gnu.org/software/coreutils/
Version: 8.32
Release: 150400.7.5
BuildRequires: automake
BuildRequires: gmp-devel
BuildRequires: libacl-devel
BuildRequires: libattr-devel
BuildRequires: libcap-devel
BuildRequires: libselinux-devel
BuildRequires: makeinfo
BuildRequires: perl
BuildRequires: xz
%if %{suse_version} > 1320
BuildRequires: gcc-PIE
%endif
%if "%{name}" == "coreutils-testsuite"
BuildRequires: acl
BuildRequires: gdb
BuildRequires: perl-Expect
BuildRequires: python
BuildRequires: python3
BuildRequires: python3-pyinotify
BuildRequires: strace
BuildRequires: timezone
# Some tests need the 'bin' user.
BuildRequires: user(bin)
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l armv7hl
BuildRequires: valgrind
%endif
%endif
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
Provides: fileutils = %{version}
Provides: mktemp = %{version}
%if 0%{?usrmerged}
Provides: /bin/mktemp
%endif
Provides: sh-utils = %{version}
Provides: stat = %{version}
Provides: textutils = %{version}
%if "%{name}" == "coreutils-single"
Conflicts: coreutils
Provides: coreutils = %{version}-%{release}
%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/memberlist-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
Patch20: coreutils-df-fuse-portal-dummy.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
# ================================================
%description
These are the GNU core utilities. This package is the union of
the GNU fileutils, sh-utils, and textutils packages.
[ arch b2sum base32 base64 basename basenc cat chcon chgrp chmod chown chroot
cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand
expr factor false fmt fold groups head hostid id install join
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink
realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum
shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test
timeout touch tr true truncate tsort tty uname unexpand uniq unlink
uptime users vdir wc who whoami yes
%package doc
Summary: Documentation for the GNU Core Utilities
Group: Documentation/Man
Provides: coreutils:%{_infodir}/coreutils.info.gz
Supplements: packageand(coreutils:patterns-base-documentation)
Supplements: packageand(coreutils-single:patterns-base-documentation)
BuildArch: noarch
%description doc
This package contains the documentation for the GNU Core Utilities.
# ================================================
%lang_package
%prep
%setup -q -n coreutils-%{version}
%patch4
%patch1
%patch3
%patch8
%patch16
%patch20 -p1
#
%if %{suse_version} <= 1320
%patch100
%endif
%patch112
%patch113
%patch300
%ifarch %ix86 x86_64 ppc ppc64
%patch301
%endif
%patch303
%patch304
%patch500
%patch501
%patch800
%ifarch ppc ppc64le
# Disable gnulib test 'test-float' temporarily as it fails on ppc and ppc64le.
%patch820
%endif
%patch840
# ================================================
%build
%if 0%{suse_version} >= 1200
AUTOPOINT=true autoreconf -fi
%endif
export CFLAGS="%optflags"
%configure --libexecdir=%{_libdir} \
--enable-install-program=arch \
--enable-no-install-program=kill \
%if "%{name}" == "coreutils-single"
--enable-single-binary \
--without-openssl \
--without-gmp \
%endif
DEFAULT_POSIX2_VERSION=200112 \
alternative=199209
make -C po update-po
# Regenerate manpages
touch man/*.x
make all %{?_smp_mflags} V=1
# make sure that parse-datetime.{c,y} ends up in debuginfo (rh#1555079)
ln -v lib/parse-datetime.{c,y} .
# ================================================
%check
%if "%{name}" == "coreutils-testsuite"
# Make our multi-byte test for sort executable
chmod a+x tests/misc/sort-mb-tests.sh
# Avoid parallel make, because otherwise some timeout based tests like
# rm/ext3-perf may fail due to high CPU or IO load.
make check-very-expensive \
&& install -d -m 755 %{buildroot}%{_docdir}/%{name} \
&& xz -c tests/test-suite.log \
> %{buildroot}%{_docdir}/%{name}/test-suite.log.xz
%else
# Run the shorter check otherwise.
make check
%endif
# ================================================
%install
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
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
%if "%{name}" == "coreutils"
%find_lang coreutils
# add LC_TIME directories to lang package
awk '/LC_TIME/ {a=$2; gsub(/\/[^\/]+\.mo/,"", a); print "%%dir", a} {print}' < coreutils.lang > tmp
mv tmp coreutils.lang
%else
rm -rf %{buildroot}%{_mandir}
rm -rf %{buildroot}%{_infodir}
rm -rf %{buildroot}%{_datadir}/locale
> coreutils.lang
%endif
%endif
# ================================================
%post
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%{?regenerate_initrd_post}
%endif
# ================================================
%posttrans
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%{?regenerate_initrd_posttrans}
%endif
# ================================================
%files
%if "%{name}" == "coreutils" || "%{name}" == "coreutils-single"
%defattr(-,root,root)
%license COPYING
%doc NEWS README THANKS
%{_bindir}/*
#UsrMerge
%if !0%{?usrmerged}
/bin/*
%endif
#EndUsrMerge
%{_libdir}/%{name}
%if "%{name}" == "coreutils"
%files lang -f coreutils.lang
%defattr(-,root,root)
%files doc
%doc %{_infodir}/coreutils.info*.gz
%doc %{_mandir}/man1/*.1.gz
%endif
%else
# test-suite
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/test-suite.log.xz
%endif
# ================================================
%changelog

View file

@ -0,0 +1,101 @@
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);