Merge pull request #290 from emilytrau/coreutils-pass-1

Enable additional tools in coreutils-5.0 phase 1
This commit is contained in:
fosslinux 2023-05-09 12:45:01 +00:00 committed by GitHub
commit a4e5829971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 2 deletions

View file

@ -6,12 +6,16 @@ c0b5b1eb102784c8202ec82990fffc4c57ba0da5724ac44544994a1d5a50615f /usr/bin/chmod
2f666cac19e38d7653975e68485ade9f6a4bb9414fa9364716414b294f3720d1 /usr/bin/cp
27f6fe3aa713d62cd9367ccafb2c52029f1f87e2d07cbadf7b71023240149fda /usr/bin/csplit
11068650333e2c0af8e9c8abb79c3d5c8fbe261b5a72b454ca632ad3ec5b965b /usr/bin/cut
7f5afda1460b2148f8b362bc37e252caf6bf02df10aab02a21f5581295921b97 /usr/bin/dirname
ecbbb0202e9b8274c93e41d831eddc809f7714c6e8004136e2fc7f1a0a30e799 /usr/bin/echo
a2962caac7a407f50a94c1d6496de9ca65c8ff66a3aa3e814a69f6aa3253dea2 /usr/bin/expand
61ffbe47da01a828ce0a0e2b871deb065bcaf874b831c019131d62bb5156e194 /usr/bin/expr
28c8920fb8ce6e5ed74f8be8a854688b8aa5155baf70812259c471fd84d2d716 /usr/bin/factor
1a851ce640196e1562d392f2a71cf294937513a43fd9b52e146c803722bd6c9e /usr/bin/false
fda23f5d23a65799794b49b3befa8d515e1e0f221c4b67e9dead07ca4b492c4c /usr/bin/fmt
2241e52196cc6f204528c32d844361cb917031cdfe5efda90ee6f2f3b2fb6a1a /usr/bin/fold
813bc16b973c2d13b96980d22d8ad49974aac356226781868af68973ba8229a2 /usr/bin/head
7948309bd45223be43e385367a56cf5fcd30ac7c94685423e651fab2d1c0a80d /usr/bin/hostname
fd55b2ed55a27de3c57dccf64c1457613a109c231dc0f8a40b650fb2f6114ab2 /usr/bin/id
9cb2877544e4dfc2521d54c3b18811dad170a6b31aeaa7556b73edcf57cb6668 /usr/bin/join
a532dfb88e4226ba1600ab8eb3c7a2801b6b7bc2d50200ba70470723322babfe /usr/bin/kill
@ -25,6 +29,7 @@ a9311865c1e95766e3be810617fce3892d5ea693fd3cdb26d680f75c579670f2 /usr/bin/nl
c68b80b2dff6423f5c92ec1cf02f30c61c9560f2a3499acf617aeee7c407d7b5 /usr/bin/od
775ec8b0a5c37a7360535c1c040b5c98e6177e69f978f520ee928efab39ed519 /usr/bin/paste
b45c0d13af7f9b1cad618fdcd48ec7db80d9e59acf37ced076c4a65412b3a5a7 /usr/bin/pathchk
267b1a8a23bf764f833cef10da9f0c77583234baed24bd67362a008015231ee3 /usr/bin/pr
6375dd4cb3d1326c895844fa7128d3d7c88df9da7b85830e23bc61d99e0bc186 /usr/bin/printf
9665a522e43fb6d2a7d66c217873cc9eb02936a51ff97b426214316b76a92792 /usr/bin/ptx
7af4c3a707f382730836223ce8651850e78e9aac4079cf2e0e7996cac8449011 /usr/bin/pwd
@ -32,6 +37,7 @@ b45c0d13af7f9b1cad618fdcd48ec7db80d9e59acf37ced076c4a65412b3a5a7 /usr/bin/pathc
3249f3b8a09e6862ce1a0c09b4e805fa03f6cfef70ee81c70704f0b481b20f45 /usr/bin/rmdir
014f6c56864a02903fcddc8f681459ab455524f12ace562fb4ff50b67cd07dab /usr/bin/seq
de46fe9655bad40463d8af57ec6fe0dd4d56fb4056a7fcef9e57eebf9c497959 /usr/bin/sleep
a6bbb377c517f2c00652b16f8eb14e8ba54fa318faf6c90fa82ebcc84fb14986 /usr/bin/sort
7d62c06a21c4eb9989f01bacf406bffe1b7e9d69596eac4fa6373e9ce7f7cb3b /usr/bin/split
00a0f9b9dc137193e6ddb0b7dba679ee98865dfc69589bcb619de0044fdb5550 /usr/bin/sum
38b82cf9f2a4818061cabc32e78df8cc552c1384cecf669b8a221f44fb1cf06b /usr/bin/tail
@ -39,6 +45,7 @@ e2683f200a8c14eef6d92d6ee3b4fdbc48b4f1cf5ea58ccab57259f6b8a315d5 /usr/bin/tee
ff9492d8e088acf1a689e907c9550ba78029a778bd2818674d4989cddbc28853 /usr/bin/tr
159651d7a72db3e4752ee184288c55a1fee0484443aa67e4f3a9984ad7320e78 /usr/bin/tsort
9f6f55239fa384564f78347b70c1287310283121446d63071045f6fd3eac90b1 /usr/bin/unexpand
5c1e4bdda086d0e8ed79c35183f36ea1f223a07e0c723037a7efd3b46ac2228a /usr/bin/uniq
1c6c0306829c5c0695d9e5336682aac3494eb78b86b0806fb8b94b4edbe9e670 /usr/bin/unlink
c601ba79b716d782bd8f01e2e3804bd2a66fdc6519c7c27dc709def51558ed53 /usr/bin/wc
762c3ac63eeafd49de5f324b16b1895167110e2ddee553c6f5198c7d71880caf /usr/bin/whoami

View file

@ -3,6 +3,7 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -39,6 +40,8 @@ patch -Np0 -i ../../patches/ls-strcmp.patch
patch -Np0 -i ../../patches/touch-getdate.patch
patch -Np0 -i ../../patches/touch-dereference.patch
patch -Np0 -i ../../patches/tac-uint64.patch
patch -Np0 -i ../../patches/expr-strcmp.patch
patch -Np0 -i ../../patches/sort-locale.patch
# Build and install
make -f Makefile PREFIX=${prefix}

View file

@ -1,5 +1,6 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -76,7 +77,7 @@ CFLAGS = -I . -I lib \
SRC_DIR=src
COREUTILS = basename cat chmod cksum csplit cut echo expand false fmt fold head id join kill link ln logname mkfifo mkdir mknod nl od paste pathchk printf ptx pwd readlink rmdir seq sleep split sum tail tee tr tsort unexpand unlink wc whoami tac test touch true yes
COREUTILS = basename cat chmod cksum csplit cut dirname echo expand expr factor false fmt fold head hostname id join kill link ln logname mkfifo mkdir mknod nl od paste pathchk pr printf ptx pwd readlink rmdir seq sleep sort split sum tail tee tr tsort unexpand uniq unlink wc whoami tac test touch true yes
BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))
@ -84,7 +85,7 @@ ALL=$(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum
all: $(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
LIB_DIR = lib
LIB_SRC = acl posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw dirfd obstack strverscmp strftime tempname tsearch
LIB_SRC = acl posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write gethostname getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw dirfd obstack strverscmp strftime tempname tsearch
LIB_OBJECTS = $(addprefix $(LIB_DIR)/, $(addsuffix .o, $(LIB_SRC)))

View file

@ -0,0 +1,26 @@
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
SPDX-License-Identifier: GPL-2.0-or-later
strcoll() does not exist in mes libc, change it to strcmp.
--- src/expr.c
+++ src/expr.c
@@ -332,7 +332,7 @@ nextarg (char *str)
return 0;
else
{
- int r = strcoll (*args, str) == 0;
+ int r = strcmp (*args, str) == 0;
args += r;
return r;
}
@@ -668,7 +668,7 @@ eval2 (void)
r = eval3 ();
tostring (l);
tostring (r);
- lval = strcoll (l->u.s, r->u.s);
+ lval = strcmp (l->u.s, r->u.s);
rval = 0;
if (toarith (l) && toarith (r))
{

View file

@ -0,0 +1,37 @@
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
SPDX-License-Identifier: GPL-2.0-or-later
strcoll() does not exist in mes libc, change it to strcmp.
hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset.
--- lib/memcoll.c
+++ lib/memcoll.c
@@ -47,7 +47,7 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
s1[s1len++] = '\0';
s2[s2len++] = '\0';
- while (! (errno = 0, (diff = strcoll (s1, s2)) || errno))
+ while (! (errno = 0, (diff = strcmp (s1, s2)) || errno))
{
/* strcoll found no difference, but perhaps it was fooled by NUL
characters in the data. Work around this problem by advancing
--- src/sort.c
+++ src/sort.c
@@ -91,13 +91,13 @@ double strtod ();
#define NEGATION_SIGN '-'
#define NUMERIC_ZERO '0'
+/* Nonzero if the corresponding locales are hard. */
+static int hard_LC_COLLATE;
#if HAVE_SETLOCALE
static char decimal_point;
static int th_sep; /* if CHAR_MAX + 1, then there is no thousands separator */
-/* Nonzero if the corresponding locales are hard. */
-static int hard_LC_COLLATE;
# if HAVE_NL_LANGINFO
static int hard_LC_TIME;
# endif