new upstream release 8.31

This commit is contained in:
Kamil Dudka 2019-03-11 11:40:45 +01:00
parent 30ec1629e9
commit 5637e2b274
12 changed files with 69 additions and 1274 deletions

View File

@ -13,17 +13,14 @@ diff --git a/DIR_COLORS b/DIR_COLORS
index d2ea453..27af9d7 100644
--- a/DIR_COLORS
+++ b/DIR_COLORS
@@ -1,6 +1,10 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -1,3 +1,7 @@
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted provided the copyright notice and this notice are preserved.
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
@@ -8,6 +12,9 @@
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
@ -34,7 +31,7 @@ index d2ea453..27af9d7 100644
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -56,7 +63,7 @@ DOOR 01;35 # door
@@ -58,7 +65,7 @@ DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
@ -43,7 +40,7 @@ index d2ea453..27af9d7 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
@@ -184,21 +191,21 @@ EXEC 01;32
@@ -186,21 +193,21 @@ EXEC 01;32
.ogx 01;35
# audio formats
@ -131,9 +128,9 @@ index d2ea453..74c34ba 100644
+TERM *256color*
+TERM rxvt-unicode256
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
@@ -43,29 +30,40 @@ TERM xterm*
# Below are the color init strings for the basic file types.
# One can use codes for 256 or more colors supported by modern terminals.
@@ -45,29 +32,40 @@ TERM xterm*
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
@ -190,7 +187,7 @@ index d2ea453..74c34ba 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
@@ -83,122 +81,122 @@ EXEC 01;32
@@ -85,122 +83,122 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)
@ -448,7 +445,7 @@ index d2ea453..95d6879 100644
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
@@ -46,17 +55,17 @@ TERM xterm*
@@ -48,17 +57,17 @@ TERM xterm*
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
@ -471,7 +468,7 @@ index d2ea453..95d6879 100644
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
@@ -65,7 +74,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
@@ -67,7 +76,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
@ -480,7 +477,7 @@ index d2ea453..95d6879 100644
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
@@ -83,105 +92,105 @@ EXEC 01;32
@@ -85,105 +94,105 @@ EXEC 01;32
#.csh 01;32
# archives or compressed (bright red)

View File

@ -1,69 +0,0 @@
From 6d059cebfdefbdf56910a858f8b603d37f10ef6d Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 23 Sep 2018 14:13:52 +0200
Subject: [PATCH] vasnprintf: Fix heap memory overrun bug.
Reported by Ben Pfaff <blp@cs.stanford.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00107.html>.
* lib/vasnprintf.c (convert_to_decimal): Allocate one more byte of
memory.
* tests/test-vasnprintf.c (test_function): Add another test.
Upstream-commit: 278b4175c9d7dd47c1a3071554aac02add3b3c35
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gnulib-tests/test-vasnprintf.c | 21 ++++++++++++++++++++-
lib/vasnprintf.c | 4 +++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/gnulib-tests/test-vasnprintf.c b/gnulib-tests/test-vasnprintf.c
index 19731bc..93d81d7 100644
--- a/gnulib-tests/test-vasnprintf.c
+++ b/gnulib-tests/test-vasnprintf.c
@@ -53,7 +53,26 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
ASSERT (result != NULL);
ASSERT (strcmp (result, "12345") == 0);
ASSERT (length == 5);
- if (size < 6)
+ if (size < 5 + 1)
+ ASSERT (result != buf);
+ ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
+ if (result != buf)
+ free (result);
+ }
+
+ /* Note: This test assumes IEEE 754 representation of 'double' floats. */
+ for (size = 0; size <= 8; size++)
+ {
+ size_t length;
+ char *result;
+
+ memcpy (buf, "DEADBEEF", 8);
+ length = size;
+ result = my_asnprintf (buf, &length, "%2.0f", 1.6314159265358979e+125);
+ ASSERT (result != NULL);
+ ASSERT (strcmp (result, "163141592653589790215729350939528493057529598899734151772468186268423257777068536614838678161083520756952076273094236944990208") == 0);
+ ASSERT (length == 126);
+ if (size < 126 + 1)
ASSERT (result != buf);
ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
if (result != buf)
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 3b441d0..48ef7a6 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -860,7 +860,9 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
size_t a_len = a.nlimbs;
/* 0.03345 is slightly larger than log(2)/(9*log(10)). */
size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
- char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
+ /* We need extra_zeroes bytes for zeroes, followed by c_len bytes for the
+ digits of a, followed by 1 byte for the terminating NUL. */
+ char *c_ptr = (char *) malloc (xsum (xsum (extra_zeroes, c_len), 1));
if (c_ptr != NULL)
{
char *d_ptr = c_ptr;
--
2.17.1

View File

@ -1,77 +0,0 @@
From 2eabfbee57be82f755c74cbb05755dce1469ea7c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 6 Nov 2018 10:35:16 -0800
Subject: [PATCH 1/2] sync: fix open fallback bug
Problem caught by Coverity Analysis
and reported by Kamil Dudka (Bug#33287).
* src/sync.c (sync_arg): Fix typo in fallback code.
Upstream-commit: 94d364f157f007f2b23c70863ac8eefe9b21229d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sync.c b/src/sync.c
index bd3671a..607fa8f 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -111,8 +111,10 @@ sync_arg (enum sync_mode mode, char const *file)
if (open_flags != (O_WRONLY | O_NONBLOCK))
fd = open (file, O_WRONLY | O_NONBLOCK);
if (fd < 0)
- error (0, rd_errno, _("error opening %s"), quoteaf (file));
- return false;
+ {
+ error (0, rd_errno, _("error opening %s"), quoteaf (file));
+ return false;
+ }
}
/* We used O_NONBLOCK above to not hang with fifos,
--
2.17.2
From e62ff3068f1f1b1e84d3319f54f1b869bb0bf6cc Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 7 Nov 2018 00:26:01 +0100
Subject: [PATCH 2/2] sync: add test for the fix in the previous commit
* tests/misc/sync.sh: Add a test with a write-only file for the fix.
Upstream-commit: 4711c49312d54e84996c13c612f7081c95f821a6
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/misc/sync.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/misc/sync.sh b/tests/misc/sync.sh
index f60d28c..3bb6e17 100755
--- a/tests/misc/sync.sh
+++ b/tests/misc/sync.sh
@@ -19,7 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ sync
-touch file
+touch file || framework_failure_
# fdatasync+syncfs is nonsensical
returns_ 1 sync --data --file-system || fail=1
@@ -30,6 +30,11 @@ returns_ 1 sync -d || fail=1
# Test syncing of file (fsync) (little side effects)
sync file || fail=1
+# Test syncing of write-only file - which failed since adding argument
+# support to sync in coreutils-8.24.
+chmod 0200 file || framework_failure_
+sync file || fail=1
+
# Ensure multiple args are processed and diagnosed
returns_ 1 sync file nofile || fail=1
--
2.17.2

View File

@ -1,451 +0,0 @@
From 57ee8db4fee8eb6772df1ff18d275594c0b034d4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Jul 2018 09:22:09 -0700
Subject: [PATCH 1/2] renameatu: rename from renameat2
It's looking like Glibc will add a renameat2 function
that is incompatible with Gnulib renameat2; see:
https://sourceware.org/ml/libc-alpha/2018-07/msg00064.html
To help avoid future confusion, rename renameat2 to something else.
Use the name 'renameatu', as the Gnulib function is close to the
Glibc function. Perhaps someday there will also be a renameat2
Gnulib module, which mimicks the future glibc renameat2, but that
can wait as nobody seems to need such a module now.
* NEWS: Mention this.
* lib/renameatu.c: Rename from lib/renameat2.c.
* lib/renameatu.h: Rename from lib/renameat2.h.
* modules/renameatu: Rename from modules/renameat2.
* modules/renameatu-tests: Rename from modules/renameat2-tests.
All uses of "renameat2" in identifiers or file name
changed to "renameatu", except for two instances in
lib/renameatu.c that deal with the Linux kernel's
renameat2 syscall.
Upstream-commit: 2522322e5304e7d86c63e607e2bc83c8d8b0a889
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
gnulib-tests/gnulib.mk | 12 +++---
.../{test-renameat2.c => test-renameatu.c} | 48 +++++++++++-----------
lib/backupfile.c | 4 +-
lib/gnulib.mk | 10 ++---
lib/renameat.c | 4 +-
lib/{renameat2.c => renameatu.c} | 9 ++--
lib/{renameat2.h => renameatu.h} | 8 ++--
7 files changed, 48 insertions(+), 47 deletions(-)
rename gnulib-tests/{test-renameat2.c => test-renameatu.c} (80%)
rename lib/{renameat2.c => renameatu.c} (94%)
rename lib/{renameat2.h => renameatu.h} (84%)
diff --git a/gnulib-tests/gnulib.mk b/gnulib-tests/gnulib.mk
index be2b99e..891425b 100644
--- a/gnulib-tests/gnulib.mk
+++ b/gnulib-tests/gnulib.mk
@@ -1750,14 +1750,14 @@ EXTRA_DIST += test-rename.h test-renameat.c signature.h macros.h
## end gnulib module renameat-tests
-## begin gnulib module renameat2-tests
+## begin gnulib module renameatu-tests
-TESTS += test-renameat2
-check_PROGRAMS += test-renameat2
-test_renameat2_LDADD = $(LDADD) @LIBINTL@
-EXTRA_DIST += test-rename.h test-renameat2.c signature.h macros.h
+TESTS += test-renameatu
+check_PROGRAMS += test-renameatu
+test_renameatu_LDADD = $(LDADD) @LIBINTL@
+EXTRA_DIST += test-rename.h test-renameatu.c signature.h macros.h
-## end gnulib module renameat2-tests
+## end gnulib module renameatu-tests
## begin gnulib module rmdir-tests
diff --git a/gnulib-tests/test-renameat2.c b/gnulib-tests/test-renameatu.c
similarity index 80%
rename from gnulib-tests/test-renameat2.c
rename to gnulib-tests/test-renameatu.c
index 0104890..988428b 100644
--- a/gnulib-tests/test-renameat2.c
+++ b/gnulib-tests/test-renameatu.c
@@ -1,4 +1,4 @@
-/* Test renameat2.
+/* Test renameatu.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -18,12 +18,12 @@
#include <config.h>
-#include <renameat2.h>
+#include <renameatu.h>
#include <stdio.h>
#include "signature.h"
-SIGNATURE_CHECK (renameat2, int,
+SIGNATURE_CHECK (renameatu, int,
(int, char const *, int, char const *, unsigned int));
#include <dirent.h>
@@ -39,18 +39,18 @@ SIGNATURE_CHECK (renameat2, int,
#include "ignore-value.h"
#include "macros.h"
-#define BASE "test-renameat2.t"
+#define BASE "test-renameatu.t"
#include "test-rename.h"
static int dfd1 = AT_FDCWD;
static int dfd2 = AT_FDCWD;
-/* Wrapper to test renameat2 like rename. */
+/* Wrapper to test renameatu like rename. */
static int
do_rename (char const *name1, char const *name2)
{
- return renameat2 (dfd1, name1, dfd2, name2, 0);
+ return renameatu (dfd1, name1, dfd2, name2, 0);
}
int
@@ -67,24 +67,24 @@ main (void)
/* Test behaviour for invalid file descriptors. */
{
errno = 0;
- ASSERT (renameat2 (-1, "foo", AT_FDCWD, "bar", 0) == -1);
+ ASSERT (renameatu (-1, "foo", AT_FDCWD, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
{
close (99);
errno = 0;
- ASSERT (renameat2 (99, "foo", AT_FDCWD, "bar", 0) == -1);
+ ASSERT (renameatu (99, "foo", AT_FDCWD, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
ASSERT (close (creat (BASE "oo", 0600)) == 0);
{
errno = 0;
- ASSERT (renameat2 (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
+ ASSERT (renameatu (AT_FDCWD, BASE "oo", -1, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
{
errno = 0;
- ASSERT (renameat2 (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
+ ASSERT (renameatu (AT_FDCWD, BASE "oo", 99, "bar", 0) == -1);
ASSERT (errno == EBADF);
}
ASSERT (unlink (BASE "oo") == 0);
@@ -133,13 +133,13 @@ main (void)
ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
ASSERT (sprintf (strchr (file2, '\0') - 2, "%02d", i + 1) == 2);
- ASSERT (renameat2 (fd1, file1, fd2, file2, 0) == 0);
+ ASSERT (renameatu (fd1, file1, fd2, file2, 0) == 0);
free (file1);
free (file2);
}
dfd2 = open ("..", O_RDONLY);
ASSERT (0 <= dfd2);
- ASSERT (renameat2 (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
+ ASSERT (renameatu (dfd, "../" BASE "16", dfd2, BASE "17", 0) == 0);
ASSERT (close (dfd2) == 0);
/* Now we change back to the parent directory, and set dfd to ".";
@@ -152,47 +152,47 @@ main (void)
ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub1", dfd, BASE "sub2", 0) == -1);
ASSERT (errno == EEXIST || errno == ENOTEMPTY);
ASSERT (unlink (BASE "sub2/file") == 0);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "sub1/.", 0) == -1);
ASSERT (errno == EINVAL || errno == EISDIR || errno == EBUSY
|| errno == ENOTEMPTY || errno == EEXIST
|| errno == ENOENT /* WSL */);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2/.", dfd, BASE "sub1", 0) == -1);
ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
|| errno == ENOENT /* WSL */);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, BASE "sub1", 0) == -1);
ASSERT (errno == EISDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "nosuch", dfd, BASE "18", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, "", dfd, BASE "17", 0) == -1);
+ ASSERT (renameatu (dfd, "", dfd, BASE "17", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, "", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, "", 0) == -1);
ASSERT (errno == ENOENT);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "sub2", dfd, BASE "17", 0) == -1);
ASSERT (errno == ENOTDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17/", dfd, BASE "18", 0) == -1);
ASSERT (errno == ENOTDIR);
errno = 0;
- ASSERT (renameat2 (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
+ ASSERT (renameatu (dfd, BASE "17", dfd, BASE "18/", 0) == -1);
ASSERT (errno == ENOTDIR || errno == ENOENT);
/* Finally, make sure we cannot overwrite existing files. */
ASSERT (close (creat (BASE "sub2/file", 0600)) == 0);
errno = 0;
- ASSERT ((renameat2 (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
+ ASSERT ((renameatu (dfd, BASE "sub2", dfd, BASE "sub1", RENAME_NOREPLACE)
== -1)
&& errno == EEXIST);
- ASSERT ((renameat2 (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
+ ASSERT ((renameatu (dfd, BASE "sub2/file", dfd, BASE "17", RENAME_NOREPLACE)
== -1)
&& errno == EEXIST);
diff --git a/lib/backupfile.c b/lib/backupfile.c
index d438455..637be6c 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -23,7 +23,7 @@
#include "backup-internal.h"
#include "dirname.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "xalloc-oversized.h"
#include <fcntl.h>
@@ -353,7 +353,7 @@ backupfile_internal (char const *file, enum backup_type backup_type, bool rename
base_offset = 0;
}
unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
- if (renameat2 (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
+ if (renameatu (AT_FDCWD, file, sdir, s + base_offset, flags) == 0)
break;
int e = errno;
if (e != EEXIST)
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 04473d5..0b747e3 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameat2 rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
+# Reproduce by: gnulib-tool --import --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backup-rename backupfile base32 base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail explicit_bzero faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-has-acl file-type fileblocks filemode filenamecat filevercmp flexmember fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbschr mbslen mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkostemp mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc nstrftime obstack open parse-datetime pathmax perl physmem pipe-posix pipe2 posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename renameat renameatu rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at setenv settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strncat strnumcmp strsignal strtod strtoimax strtoumax symlinkat sys_ioctl sys_resource sys_stat sys_wait tempname termios time_rz timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wchar-single wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xbinary-io xdectoint xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax year2038 yesno
MOSTLYCLEANFILES += lib/core lib/*.stackdump
@@ -3218,15 +3218,15 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/renameat.c
## end gnulib module renameat
-## begin gnulib module renameat2
+## begin gnulib module renameatu
-lib_libcoreutils_a_SOURCES += lib/renameat2.c
+lib_libcoreutils_a_SOURCES += lib/renameatu.c
-EXTRA_DIST += lib/at-func2.c lib/renameat2.h
+EXTRA_DIST += lib/at-func2.c lib/renameatu.h
EXTRA_lib_libcoreutils_a_SOURCES += lib/at-func2.c
-## end gnulib module renameat2
+## end gnulib module renameatu
## begin gnulib module rewinddir
diff --git a/lib/renameat.c b/lib/renameat.c
index 0cb7d33..67be22b 100644
--- a/lib/renameat.c
+++ b/lib/renameat.c
@@ -16,10 +16,10 @@
#include <config.h>
#include <stdio.h>
-#include "renameat2.h"
+#include "renameatu.h"
int
renameat (int fd1, char const *src, int fd2, char const *dst)
{
- return renameat2 (fd1, src, fd2, dst, 0);
+ return renameatu (fd1, src, fd2, dst, 0);
}
diff --git a/lib/renameat2.c b/lib/renameatu.c
similarity index 94%
rename from lib/renameat2.c
rename to lib/renameatu.c
index a295ec3..b013ad6 100644
--- a/lib/renameat2.c
+++ b/lib/renameatu.c
@@ -18,7 +18,7 @@
#include <config.h>
-#include "renameat2.h"
+#include "renameatu.h"
#include <errno.h>
#include <stdio.h>
@@ -68,10 +68,13 @@ rename_noreplace (char const *src, char const *dst)
the restore_cwd fails, then give a diagnostic and exit nonzero.
Obey FLAGS when doing the renaming. If FLAGS is zero, this
- function is equivalent to renameat (FD1, SRC, FD2, DST). */
+ function is equivalent to renameat (FD1, SRC, FD2, DST).
+ Otherwise, attempt to implement FLAGS even if the implementation is
+ not atomic; this differs from the GNU/Linux native renameat2,
+ which fails if it cannot guarantee atomicity. */
int
-renameat2 (int fd1, char const *src, int fd2, char const *dst,
+renameatu (int fd1, char const *src, int fd2, char const *dst,
unsigned int flags)
{
int ret_val = -1;
diff --git a/lib/renameat2.h b/lib/renameatu.h
similarity index 84%
rename from lib/renameat2.h
rename to lib/renameatu.h
index aba7966..7d79775 100644
--- a/lib/renameat2.h
+++ b/lib/renameatu.h
@@ -16,15 +16,13 @@
/* written by Paul Eggert */
-/* Get RENAME_* macros from linux/fs.h if present, otherwise supply
+/* Get RENAME_* macros from <stdio.h> if present, otherwise supply
the traditional Linux values. */
-#if HAVE_LINUX_FS_H
-# include <linux/fs.h>
-#endif
+#include <stdio.h>
#ifndef RENAME_NOREPLACE
# define RENAME_NOREPLACE (1 << 0)
# define RENAME_EXCHANGE (1 << 1)
# define RENAME_WHITEOUT (1 << 2)
#endif
-extern int renameat2 (int, char const *, int, char const *, unsigned int);
+extern int renameatu (int, char const *, int, char const *, unsigned int);
--
2.14.4
From a6b7ff5ef538bbdff4550a56fed878e9cd951d6d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Jul 2018 09:33:48 -0700
Subject: [PATCH 2/2] build: update gnulib submodule to latest
* bootstrap.conf, src/copy.c, src/mv.c, src/shred.c:
Adjust to renaming of renameat2 to renameatu.
Upstream-commit: 439741053256618eb651e6d43919df29625b8714
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
bootstrap.conf | 2 +-
src/copy.c | 4 ++--
src/mv.c | 4 ++--
src/shred.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 4da4f94..fcf29dc 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -210,7 +210,7 @@ gnulib_modules="
remove
rename
renameat
- renameat2
+ renameatu
rmdir
root-dev-ino
rpmatch
diff --git a/src/copy.c b/src/copy.c
index 58d2f6e..1a9cdd1 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -53,7 +53,7 @@
#include "ignore-value.h"
#include "ioblksize.h"
#include "quote.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "root-uid.h"
#include "same.h"
#include "savedir.h"
@@ -1873,7 +1873,7 @@ copy_internal (char const *src_name, char const *dst_name,
if (x->move_mode)
{
if (rename_errno < 0)
- rename_errno = (renameat2 (AT_FDCWD, src_name, AT_FDCWD, dst_name,
+ rename_errno = (renameatu (AT_FDCWD, src_name, AT_FDCWD, dst_name,
RENAME_NOREPLACE)
? errno : 0);
new_dst = rename_errno == 0;
diff --git a/src/mv.c b/src/mv.c
index b6dd72d..36fd1af 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -31,7 +31,7 @@
#include "error.h"
#include "filenamecat.h"
#include "remove.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "root-dev-ino.h"
#include "priv-set.h"
@@ -456,7 +456,7 @@ main (int argc, char **argv)
{
assert (2 <= n_files);
if (n_files == 2)
- x.rename_errno = (renameat2 (AT_FDCWD, file[0], AT_FDCWD, file[1],
+ x.rename_errno = (renameatu (AT_FDCWD, file[0], AT_FDCWD, file[1],
RENAME_NOREPLACE)
? errno : 0);
if (x.rename_errno != 0 && target_directory_operand (file[n_files - 1]))
diff --git a/src/shred.c b/src/shred.c
index 2ddaadd..270b1e9 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -93,7 +93,7 @@
#include "human.h"
#include "randint.h"
#include "randread.h"
-#include "renameat2.h"
+#include "renameatu.h"
#include "stat-size.h"
/* Default number of times to overwrite. */
@@ -1096,7 +1096,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
memset (base, nameset[0], len);
base[len] = 0;
bool rename_ok;
- while (! (rename_ok = (renameat2 (AT_FDCWD, oldname, AT_FDCWD, newname,
+ while (! (rename_ok = (renameatu (AT_FDCWD, oldname, AT_FDCWD, newname,
RENAME_NOREPLACE)
== 0))
&& errno == EEXIST && incname (base, len))
--
2.14.4

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJbOYLXAAoJEN9v2XEwYDfZFRwP/1xKMtXTqCOnP3ECRze+bYnX
GB5Mm57kcP2NXwzo62+9C+FToEfkRTALtlU95edIRlsjLGBoDvv12fsOKdsyO/c5
7paI3NoaUFyJxby9w91mNOcgN6eR5WZ/LHm2VbTs5VFpsNcSVyHSvhiqgPXtRrVp
ZrnUKbg9iWjn8jcJHIS7qrIO4GsoFzfhn9gVh8Xxp4AYx0btn3BwPTWCxg53Ie0p
OgrMmMnOe3wrpwrlJOgfvpk5na7yKRt7GYsyGMaKB7OxbHlVg4UCx4LuRBnaUPZr
QmlX37sIR/sEJne0zR4iMorPi5IsErMT39VaBDLnsAjyccbmYQ/RmFYASiM5Zijw
d94fk+TocyDBrOMsO5fzKUID5Uf4c5vJlhCXBsPBykNiKsQTb3M7fZ+gjYrMJmoS
4DDgAMryoB5yc2i9HcNj8WMNHy4RGIrRWxOAUZf5j2zEEVwKaRcoNosFoycUotEA
yoWdRIwyCkVwlemVhx0zQTm8WbtFl0kkAFKTqu7uHGUGOKSS4dzTi000cJ4qHSyY
ODrouvKgqKwB+Q7IfpQ72i6DLpTzNjLKNMipBPsSkSW+RaWC67+smo1vL9V5ZlfX
ypzjMF++r3cRuIWG9IwAwedl/sH7iqjHwdMf4y+8sGxRzW5Oeyvx20TvqxMqRLGD
nU0Y2GCLW7C2Idw+I5QM
=pibq
-----END PGP SIGNATURE-----

17
coreutils-8.31.tar.xz.sig Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJchaqkAAoJEN9v2XEwYDfZKBMQAJNjmYU6VrbHvlSJm1d+9Qch
rvVtE5VGsTj3jUj1dh9MpuN9GhJifWJat9DEKUat0J4Z5G8d55LvyzQJppby2az2
kwbp/ffK0wR1tfGNii3Hop3pMVizqJn+LbT01qcS3E7tVQ2nJP/JVIeXOtOf9kJk
gPviDaqO8OUiV2l3gCwLtuOETKHXRGyraWRxCb9ZxOS12Gspqfwui7t4jQUDf2Ge
Kvhcawas+XomGdWx+io/VxwkOZkOCr9vQdMM7ZqLDnu+d7nGsnPMxxdGcP72WBnV
1LxFxHIel52yuRh3T1RggQMKxXPFPEyDRgaBNN0Yfk3a2CHFHf+YtySgLzKSqyS5
1P5syvSbNj9ASEuX428lpwI3EC5G3T9W/MLTKUpwVhfU8/WELI261F95dnFIfoar
mMPqbBMHwHpIasJfDy60m8H8/z8PEOmpRP0xfAuOtf47YpDLsH+AvrAJM4CH9kkS
lysMUZITyIqUBSoUs8mVygV7b4mq2X2US0Mkja/hDFAcq2O7m2eyvi61z7Oa1Y/r
tV+q/XS8ZTOtSTBBZzRVTJDPno1ZwFBl/MIiD5FgF7szgiR2z0KVMfAlVBdQwxKw
Mj6N/HYeP6yE3g9I5+8LmRLwQcXeC2B0ZzpvGE7DaKd5aFDC6YVDD8wyLEQFDAav
XGtN62+yfXArdYVjXygm
=LVk4
-----END PGP SIGNATURE-----

View File

@ -1,13 +0,0 @@
diff -urNp coreutils-8.5-orig/src/dircolors.hin coreutils-8.5/src/dircolors.hin
--- coreutils-8.5-orig/src/dircolors.hin 2010-04-20 21:52:04.000000000 +0200
+++ coreutils-8.5/src/dircolors.hin 2010-07-22 16:18:41.978036926 +0200
@@ -127,6 +127,9 @@ EXEC 01;32
.deb 01;31
.rpm 01;31
.jar 01;31
+.war 01;31
+.ear 01;31
+.sar 01;31
.rar 01;31
.ace 01;31
.zoo 01;31

View File

@ -1,587 +0,0 @@
(sb) lin18nux/lsb compliance - cut - not stable enough, not applied
--- coreutils-8.24/src/cut.c 2015-06-26 19:05:22.000000000 +0200
+++ cut.c 2016-01-15 10:15:04.863804121 +0100
@@ -28,6 +28,11 @@
#include <assert.h>
#include <getopt.h>
#include <sys/types.h>
+
+#include <mbfile.h>
+#include <mbiter.h>
+#include <string.h>
+
#include "system.h"
#include "error.h"
@@ -61,25 +66,16 @@
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
static struct field_range_pair *current_rp;
-/* This buffer is used to support the semantics of the -s option
- (or lack of same) when the specified field list includes (does
- not include) the first field. In both of those cases, the entire
- first field must be read into this buffer to determine whether it
- is followed by a delimiter or a newline before any of it may be
- output. Otherwise, cut_fields can do the job without using this
- buffer. */
-static char *field_1_buffer;
-
-/* The number of bytes allocated for FIELD_1_BUFFER. */
-static size_t field_1_bufsize;
-
enum operating_mode
{
undefined_mode,
- /* Output characters that are in the given bytes. */
+ /* Output the given bytes. */
byte_mode,
+ /* Output characters that are in the given positions . */
+ char_mode,
+
/* Output the given delimiter-separated fields. */
field_mode
};
@@ -91,12 +87,16 @@ static enum operating_mode operating_mode;
with field mode. */
static bool suppress_non_delimited;
+/* Unless true, we do not recognize multibyte characters in byte-splitting
+ mode. */
+static bool no_break_mb_chars;
+
/* If true, print all bytes, characters, or fields _except_
those that were specified. */
static bool complement;
/* The delimiter character for field mode. */
-static unsigned char delim;
+static mbf_char_t delim;
/* The delimiter for each line/record. */
static unsigned char line_delim = '\n';
@@ -109,7 +109,7 @@ static size_t output_delimiter_length;
/* The output field separator string. Defaults to the 1-character
string consisting of the input delimiter. */
-static char *output_delimiter_string;
+static char const *output_delimiter_string;
/* True if we have ever read standard input. */
static bool have_read_stdin;
@@ -164,7 +164,7 @@ Print selected parts of lines from each FILE to standard output.\n\
-f, --fields=LIST select only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
- -n (ignored)\n\
+ -n with -b, don't split multibyte characters\n\
"), stdout);
fputs (_("\
--complement complement the set of selected bytes, characters\n\
@@ -211,6 +211,12 @@ next_item (size_t *item_idx)
current_rp++;
}
+static inline void
+next_item_n (size_t *item_idx, size_t n)
+{
+ while (n-- > 0)
+ next_item (item_idx);
+}
/* Return nonzero if the K'th field or byte is printable. */
static inline bool
@@ -219,6 +225,15 @@ print_kth (size_t k)
return current_rp->lo <= k;
}
+/* The lo and hi params should be used for the current characters byte position
+ * and byte size, respectively. */
+static inline bool
+rp_intersect (size_t lo, size_t hi)
+{
+ return ((current_rp->lo <= lo && current_rp->hi >= lo)
+ || (current_rp->lo <= hi && current_rp->hi >= hi));
+}
+
/* Return nonzero if K'th byte is the beginning of a range. */
static inline bool
@@ -281,23 +296,215 @@ cut_bytes (FILE *stream)
}
/* Read from stream STREAM, printing to standard output any selected fields. */
+extern ssize_t
+mb_getndelim2 (mbf_char_t **lineptr, size_t *linesize, size_t nmax,
+ mbf_char_t delim1, mbf_char_t delim2, mb_file_t *stream)
+{
+/* The maximum value that getndelim2 can return without suffering from
+ overflow problems, either internally (because of pointer
+ subtraction overflow) or due to the API (because of ssize_t). */
+#define GETNDELIM2_MAXIMUM (PTRDIFF_MAX < SSIZE_MAX ? PTRDIFF_MAX : SSIZE_MAX)
+
+/* Try to add at least this many bytes when extending the buffer.
+ MIN_CHUNK must be no greater than GETNDELIM2_MAXIMUM. */
+#define MIN_CHUNK 64
+ size_t nchars_avail; /* Allocated but unused chars in *LINEPTR. */
+ mbf_char_t *read_pos; /* Where we're reading into *LINEPTR. */
+ ssize_t chars_stored = -1;
+ mbf_char_t *ptr = *lineptr;
+ size_t size = *linesize;
+ bool found_delimiter;
+
+ if (!ptr)
+ {
+ size = nmax < MIN_CHUNK ? nmax : MIN_CHUNK;
+ ptr = malloc (size * sizeof (mbf_char_t));
+ if (!ptr)
+ return -1;
+ }
+
+ if (size < 0)
+ goto done;
+
+ nchars_avail = size;
+ read_pos = ptr;
+
+ if (nchars_avail == 0 && nmax <= size)
+ goto done;
+
+ /* Normalize delimiters, since memchr2 doesn't handle EOF. */
+ if (mb_iseof (delim1))
+ mb_copy (&delim1, &delim2);
+ else if (mb_iseof (delim2))
+ mb_copy (&delim2, &delim1);
+
+ flockfile (stream);
+
+ found_delimiter = false;
+ do
+ {
+ /* Here always ptr + size == read_pos + nchars_avail.
+ Also nchars_avail > 0 || size < nmax. */
+
+ mbf_char_t c IF_LINT (= 0);
+ {
+ mbf_getc (c, *stream);
+ if (mb_iseof (c))
+ {
+ /* Return partial line, if any. */
+ if (read_pos == ptr)
+ goto unlock_done;
+ else
+ break;
+ }
+ if (mb_equal (c, delim1) || mb_equal (c, delim2))
+ found_delimiter = true;
+ }
+
+ /* We always want at least one byte left in the buffer, since we
+ always (unless we get an error while reading the first byte)
+ NUL-terminate the line buffer. */
+
+ if (!nchars_avail)
+ {
+ /* Grow size proportionally, not linearly, to avoid O(n^2)
+ running time. */
+ size_t newsize = size < MIN_CHUNK ? size + MIN_CHUNK : 2 * size;
+ mbf_char_t *newptr;
+
+ /* Respect nmax. This handles possible integer overflow. */
+ if (! (size < newsize && newsize <= nmax))
+ newsize = nmax;
+
+ if (GETNDELIM2_MAXIMUM < newsize)
+ {
+ size_t newsizemax = GETNDELIM2_MAXIMUM + 1;
+ if (size == newsizemax)
+ goto unlock_done;
+ newsize = newsizemax;
+ }
+ nchars_avail = newsize - (read_pos - ptr);
+ newptr = realloc (ptr, newsize * sizeof (mbf_char_t));
+ if (!newptr)
+ goto unlock_done;
+ ptr = newptr;
+ size = newsize;
+ read_pos = size - nchars_avail + ptr;
+ }
+
+ /* Here, if size < nmax, nchars_avail >= buffer_len + 1.
+ If size == nmax, nchars_avail > 0. */
+
+ if (1 < nchars_avail--)
+ {
+ mb_copy(read_pos++, &c);
+ }
+
+ }
+ while (!found_delimiter);
+
+ chars_stored = (read_pos - ptr);
+
+ unlock_done:
+ funlockfile (stream);
+
+ done:
+ *lineptr = ptr;
+ *linesize = size;
+ return chars_stored;
+}
+
+static void
+cut_chars (FILE *stream)
+{
+ size_t char_idx; /* Number of chars in the line so far. */
+ bool print_delimiter;
+ mbf_char_t c;
+ mb_file_t mbf;
+
+ print_delimiter = false;
+ char_idx = 0;
+ current_rp = frp;
+
+ mbf_init (mbf, stream);
+ while (true)
+ {
+ mbf_getc (c, mbf);
+
+ if (mb_iseq (c, line_delim))
+ {
+ putc (line_delim, stdout);
+ char_idx = 0;
+ print_delimiter = false;
+ current_rp = frp;
+ }
+ else if (mb_iseof (c))
+ {
+ if (char_idx > 0)
+ putc (line_delim, stdout);
+ break;
+ }
+ else
+ {
+ /* Forward by one byte. */
+ next_item (&char_idx);
+
+ /* Check if the current characters byte range is within
+ * the argument list. */
+ if (rp_intersect (char_idx, char_idx + mb_len (c) - 1))
+ {
+ if (output_delimiter_specified)
+ {
+ if (print_delimiter && is_range_start_index (char_idx))
+ {
+ fwrite (output_delimiter_string, sizeof (char),
+ output_delimiter_length, stdout);
+ }
+ print_delimiter = true;
+ }
+ mb_putc (c, stdout);
+ }
+
+ /* Byte mode with multibyte characters uncut (-b -n). */
+ if (no_break_mb_chars)
+ /* Forward by an additional byte_length (c) - 1. */
+ next_item_n (&char_idx, mb_len (c) - 1);
+ }
+ }
+}
static void
cut_fields (FILE *stream)
{
- int c;
+
+ /* This buffer is used to support the semantics of the -s option
+ (or lack of same) when the specified field list includes (does
+ not include) the first field. In both of those cases, the entire
+ first field must be read into this buffer to determine whether it
+ is followed by a delimiter or a newline before any of it may be
+ output. Otherwise, cut_fields can do the job without using this
+ buffer. */
+ mbf_char_t *field_1_buffer = 0;
+ /* The number of bytes allocated for FIELD_1_BUFFER. */
+ size_t field_1_bufsize;
+
+
+ mbf_char_t c, d;
+ mb_file_t mbf;
size_t field_idx = 1;
bool found_any_selected_field = false;
bool buffer_first_field;
current_rp = frp;
- c = getc (stream);
- if (c == EOF)
+ mbf_init (mbf, stream);
+ mbf_getc (c, mbf);
+ if (mb_iseof (c))
return;
- ungetc (c, stream);
- c = 0;
+ mbf_ungetc (c, mbf);
+ mb_setascii (&c, 0);
+ mb_copy (&d, &delim);
/* To support the semantics of the -s flag, we may have to buffer
all of the first field to determine whether it is 'delimited.'
@@ -312,10 +519,14 @@ cut_fields (FILE *stream)
if (field_idx == 1 && buffer_first_field)
{
ssize_t len;
- size_t n_bytes;
+ size_t n_chars;
+ mbf_char_t nl;
+ mb_setascii (&nl, line_delim);
+
+ len = mb_getndelim2 (&field_1_buffer, &field_1_bufsize,
+ GETNLINE_NO_LIMIT, d, nl, &mbf);
+
- len = getndelim2 (&field_1_buffer, &field_1_bufsize, 0,
- GETNLINE_NO_LIMIT, delim, line_delim, stream);
if (len < 0)
{
free (field_1_buffer);
@@ -325,15 +536,15 @@ cut_fields (FILE *stream)
xalloc_die ();
}
- n_bytes = len;
- assert (n_bytes != 0);
+ n_chars = len;
+ //assert (n_chars != 0);
- c = 0;
+ mb_setascii (&c, 0);
/* If the first field extends to the end of line (it is not
delimited) and we are printing all non-delimited lines,
print this one. */
- if (to_uchar (field_1_buffer[n_bytes - 1]) != delim)
+ if (!mb_equal (field_1_buffer[n_chars - 1], d))
{
if (suppress_non_delimited)
{
@@ -341,26 +552,30 @@ cut_fields (FILE *stream)
}
else
{
- fwrite (field_1_buffer, sizeof (char), n_bytes, stdout);
+ for (int i = 0; i < n_chars; ++i)
+ mb_putc (field_1_buffer[i], stdout);
+
/* Make sure the output line is newline terminated. */
- if (field_1_buffer[n_bytes - 1] != line_delim)
+ if (!mb_iseq (field_1_buffer[n_chars - 1], line_delim))
putchar (line_delim);
- c = line_delim;
+ mb_setascii (&c, line_delim);
}
continue;
}
if (print_kth (1))
{
/* Print the field, but not the trailing delimiter. */
- fwrite (field_1_buffer, sizeof (char), n_bytes - 1, stdout);
+ for (int i = 0; i < n_chars - 1; ++i)
+ mb_putc (field_1_buffer[i], stdout);
/* With -d$'\n' don't treat the last '\n' as a delimiter. */
- if (delim == line_delim)
+ if (mb_iseq (d, line_delim))
{
- int last_c = getc (stream);
- if (last_c != EOF)
+ mbf_char_t last_c;
+ mbf_getc (last_c, mbf);
+ if (!mb_iseof (last_c))
{
- ungetc (last_c, stream);
+ mbf_ungetc (last_c, mbf);
found_any_selected_field = true;
}
}
@@ -370,7 +585,8 @@ cut_fields (FILE *stream)
next_item (&field_idx);
}
- int prev_c = c;
+ mbf_char_t prev_c;
+ mb_copy (&prev_c, &c);
if (print_kth (field_idx))
{
@@ -381,42 +597,46 @@ cut_fields (FILE *stream)
}
found_any_selected_field = true;
- while ((c = getc (stream)) != delim && c != line_delim && c != EOF)
+ mbf_getc (c, mbf);
+ while (!mb_equal (c, d) && !mb_iseq (c, line_delim) && !mb_iseof (c))
{
- putchar (c);
- prev_c = c;
+ mb_putc (c, stdout);
+ mb_copy (&prev_c, &c);
+ mbf_getc (c, mbf);
}
}
else
{
- while ((c = getc (stream)) != delim && c != line_delim && c != EOF)
+ mbf_getc (c, mbf);
+ while (!mb_equal (c, d) && !mb_iseq (c, line_delim) && !mb_iseof (c))
{
- prev_c = c;
+ mb_copy (&prev_c, &c);
+ mbf_getc (c, mbf);
}
}
/* With -d$'\n' don't treat the last '\n' as a delimiter. */
- if (delim == line_delim && c == delim)
+ if (mb_iseq (d, line_delim) && mb_equal (c, d))
{
- int last_c = getc (stream);
- if (last_c != EOF)
- ungetc (last_c, stream);
+ mbf_char_t last_c;
+ mbf_getc (last_c, mbf);
+ if (!mb_iseof (last_c))
+ mbf_ungetc (last_c, mbf);
else
- c = last_c;
+ mb_copy (&c, &last_c);
}
- if (c == delim)
+ if (mb_equal (c, d))
next_item (&field_idx);
- else if (c == line_delim || c == EOF)
+ else if (mb_iseq (c, line_delim) || mb_iseof (c))
{
if (found_any_selected_field
|| !(suppress_non_delimited && field_idx == 1))
{
- if (c == line_delim || prev_c != line_delim
- || delim == line_delim)
+ if (mb_iseq (c, line_delim) || !mb_iseq (prev_c, line_delim) || mb_iseq (d, line_delim))
putchar (line_delim);
}
- if (c == EOF)
+ if (mb_iseof (c))
break;
field_idx = 1;
current_rp = frp;
@@ -429,7 +649,14 @@ static void
cut_stream (FILE *stream)
{
if (operating_mode == byte_mode)
- cut_bytes (stream);
+ {
+ if (no_break_mb_chars)
+ cut_chars (stream);
+ else
+ cut_bytes (stream);
+ }
+ else if (operating_mode == char_mode)
+ cut_chars (stream);
else
cut_fields (stream);
}
@@ -483,6 +710,7 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL);
+ mbi_iterator_t iter;
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -496,8 +724,10 @@ main (int argc, char **argv)
/* By default, all non-delimited lines are printed. */
suppress_non_delimited = false;
+ /* Default behaviour for -b, unless -n is also specified. */
+ no_break_mb_chars = false;
- delim = '\0';
+ mb_setascii (&delim, '\0');
have_read_stdin = false;
while ((optc = getopt_long (argc, argv, "b:c:d:f:nsz", longopts, NULL)) != -1)
@@ -505,7 +735,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
- case 'c':
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
@@ -513,6 +742,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
+ case 'c':
+ /* Build the char list. */
+ if (operating_mode != undefined_mode)
+ FATAL_ERROR (_("only one type of list may be specified"));
+ operating_mode = char_mode;
+ spec_list_string = optarg;
+ break;
+
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
@@ -524,9 +761,17 @@ main (int argc, char **argv)
case 'd':
/* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
- if (optarg[0] != '\0' && optarg[1] != '\0')
+ mbi_init (iter, optarg, strlen (optarg));
+ if (!mbi_avail (iter))
+ mb_setascii (&delim, '\0');
+ else
+ {
+ mb_copy (&delim, &mbi_cur (iter));
+
+ mbi_advance (iter);
+ if (mbi_avail (iter))
FATAL_ERROR (_("the delimiter must be a single character"));
- delim = optarg[0];
+ }
delim_specified = true;
break;
@@ -540,6 +785,7 @@ main (int argc, char **argv)
break;
case 'n':
+ no_break_mb_chars = true;
break;
case 's':
@@ -579,15 +825,12 @@ main (int argc, char **argv)
| (complement ? SETFLD_COMPLEMENT : 0) );
if (!delim_specified)
- delim = '\t';
+ mb_setascii (&delim, '\t');
if (output_delimiter_string == NULL)
{
- static char dummy[2];
- dummy[0] = delim;
- dummy[1] = '\0';
- output_delimiter_string = dummy;
- output_delimiter_length = 1;
+ output_delimiter_string = mb_ptr (delim);
+ output_delimiter_length = mb_len (delim);
}
if (optind == argc)

View File

@ -1731,7 +1731,7 @@ index 6d2eec5..f189a0d 100644
#include "system.h"
#include "argmatch.h"
#include "die.h"
@@ -169,14 +177,39 @@ static int decimal_point;
@@ -161,14 +169,39 @@ static int decimal_point;
/* Thousands separator; if -1, then there isn't one. */
static int thousands_sep;
@ -1772,7 +1772,7 @@ index 6d2eec5..f189a0d 100644
/* The kind of blanks for '-b' to skip in various options. */
enum blanktype { bl_start, bl_end, bl_both };
@@ -350,13 +383,11 @@ static bool reverse;
@@ -342,13 +375,11 @@ static bool reverse;
they were read if all keys compare equal. */
static bool stable;
@ -1789,7 +1789,7 @@ index 6d2eec5..f189a0d 100644
/* Flag to remove consecutive duplicate lines from the output.
Only the last of a sequence of equal lines will be output. */
@@ -814,6 +845,46 @@ reap_all (void)
@@ -806,6 +837,46 @@ reap_all (void)
reap (-1);
}
@ -1836,7 +1836,7 @@ index 6d2eec5..f189a0d 100644
/* Clean up any remaining temporary files. */
static void
@@ -1264,7 +1335,7 @@ zaptemp (char const *name)
@@ -1274,7 +1345,7 @@ zaptemp (char const *name)
free (node);
}
@ -1845,7 +1845,7 @@ index 6d2eec5..f189a0d 100644
static int
struct_month_cmp (void const *m1, void const *m2)
@@ -1279,7 +1350,7 @@ struct_month_cmp (void const *m1, void const *m2)
@@ -1289,7 +1360,7 @@ struct_month_cmp (void const *m1, void const *m2)
/* Initialize the character class tables. */
static void
@ -1854,7 +1854,7 @@ index 6d2eec5..f189a0d 100644
{
size_t i;
@@ -1291,7 +1362,7 @@ inittables (void)
@@ -1301,7 +1372,7 @@ inittables (void)
fold_toupper[i] = toupper (i);
}
@ -1863,7 +1863,7 @@ index 6d2eec5..f189a0d 100644
/* If we're not in the "C" locale, read different names for months. */
if (hard_LC_TIME)
{
@@ -1373,6 +1444,84 @@ specify_nmerge (int oi, char c, char const *s)
@@ -1383,6 +1454,84 @@ specify_nmerge (int oi, char c, char const *s)
xstrtol_fatal (e, oi, c, long_options, s);
}
@ -1948,7 +1948,7 @@ index 6d2eec5..f189a0d 100644
/* Specify the amount of main memory to use when sorting. */
static void
specify_sort_size (int oi, char c, char const *s)
@@ -1604,7 +1753,7 @@ buffer_linelim (struct buffer const *buf)
@@ -1614,7 +1763,7 @@ buffer_linelim (struct buffer const *buf)
by KEY in LINE. */
static char *
@ -1957,7 +1957,7 @@ index 6d2eec5..f189a0d 100644
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t sword = key->sword;
@@ -1613,10 +1762,10 @@ begfield (struct line const *line, struct keyfield const *key)
@@ -1623,10 +1772,10 @@ begfield (struct line const *line, struct keyfield const *key)
/* The leading field separator itself is included in a field when -t
is absent. */
@ -1970,7 +1970,7 @@ index 6d2eec5..f189a0d 100644
++ptr;
if (ptr < lim)
++ptr;
@@ -1642,11 +1791,70 @@ begfield (struct line const *line, struct keyfield const *key)
@@ -1652,11 +1801,70 @@ begfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@ -2042,7 +2042,7 @@ index 6d2eec5..f189a0d 100644
{
char *ptr = line->text, *lim = ptr + line->length - 1;
size_t eword = key->eword, echar = key->echar;
@@ -1661,10 +1869,10 @@ limfield (struct line const *line, struct keyfield const *key)
@@ -1671,10 +1879,10 @@ limfield (struct line const *line, struct keyfield const *key)
'beginning' is the first character following the delimiting TAB.
Otherwise, leave PTR pointing at the first 'blank' character after
the preceding field. */
@ -2055,7 +2055,7 @@ index 6d2eec5..f189a0d 100644
++ptr;
if (ptr < lim && (eword || echar))
++ptr;
@@ -1710,10 +1918,10 @@ limfield (struct line const *line, struct keyfield const *key)
@@ -1720,10 +1928,10 @@ limfield (struct line const *line, struct keyfield const *key)
*/
/* Make LIM point to the end of (one byte past) the current field. */
@ -2068,7 +2068,7 @@ index 6d2eec5..f189a0d 100644
if (newlim)
lim = newlim;
}
@@ -1744,6 +1952,130 @@ limfield (struct line const *line, struct keyfield const *key)
@@ -1754,6 +1962,130 @@ limfield (struct line const *line, struct keyfield const *key)
return ptr;
}
@ -2199,7 +2199,7 @@ index 6d2eec5..f189a0d 100644
/* Fill BUF reading from FP, moving buf->left bytes from the end
of buf->buf to the beginning first. If EOF is reached and the
file wasn't terminated by a newline, supply one. Set up BUF's line
@@ -1830,8 +2162,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
@@ -1840,8 +2172,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
else
{
if (key->skipsblanks)
@ -2224,7 +2224,7 @@ index 6d2eec5..f189a0d 100644
line->keybeg = line_start;
}
}
@@ -1981,7 +2327,7 @@ human_numcompare (char const *a, char const *b)
@@ -1991,7 +2337,7 @@ human_numcompare (char const *a, char const *b)
hideously fast. */
static int
@ -2233,7 +2233,7 @@ index 6d2eec5..f189a0d 100644
{
while (blanks[to_uchar (*a)])
a++;
@@ -1991,6 +2337,25 @@ numcompare (char const *a, char const *b)
@@ -2001,6 +2347,25 @@ numcompare (char const *a, char const *b)
return strnumcmp (a, b, decimal_point, thousands_sep);
}
@ -2258,8 +2258,8 @@ index 6d2eec5..f189a0d 100644
+
/* Work around a problem whereby the long double value returned by glibc's
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
A and B before calling strtold. FIXME: remove this function once
@@ -2041,7 +2406,7 @@ general_numcompare (char const *sa, char const *sb)
A and B before calling strtold. FIXME: remove this function if
@@ -2051,7 +2416,7 @@ general_numcompare (char const *sa, char const *sb)
Return 0 if the name in S is not recognized. */
static int
@ -2268,7 +2268,7 @@ index 6d2eec5..f189a0d 100644
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
@@ -2317,15 +2682,14 @@ debug_key (struct line const *line, struct keyfield const *key)
@@ -2327,15 +2692,14 @@ debug_key (struct line const *line, struct keyfield const *key)
char saved = *lim;
*lim = '\0';
@ -2286,7 +2286,7 @@ index 6d2eec5..f189a0d 100644
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
else if (key->numeric || key->human_numeric)
@@ -2459,7 +2823,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
@@ -2469,7 +2833,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
/* Warn about significant leading blanks. */
bool implicit_skip = key_numeric (key) || key->month;
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
@ -2295,7 +2295,7 @@ index 6d2eec5..f189a0d 100644
&& ((!key->skipsblanks && !implicit_skip)
|| (!key->skipsblanks && key->schar)
|| (!key->skipeblanks && key->echar)))
@@ -2517,11 +2881,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
@@ -2527,11 +2891,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
error (0, 0, _("option '-r' only applies to last-resort comparison"));
}
@ -2384,7 +2384,7 @@ index 6d2eec5..f189a0d 100644
{
struct keyfield *key = keylist;
@@ -2606,7 +3046,7 @@ keycompare (struct line const *a, struct line const *b)
@@ -2616,7 +3056,7 @@ keycompare (struct line const *a, struct line const *b)
else if (key->human_numeric)
diff = human_numcompare (ta, tb);
else if (key->month)
@ -2393,7 +2393,7 @@ index 6d2eec5..f189a0d 100644
else if (key->random)
diff = compare_random (ta, tlena, tb, tlenb);
else if (key->version)
@@ -2722,6 +3162,211 @@ keycompare (struct line const *a, struct line const *b)
@@ -2732,6 +3172,211 @@ keycompare (struct line const *a, struct line const *b)
return key->reverse ? -diff : diff;
}
@ -2605,7 +2605,7 @@ index 6d2eec5..f189a0d 100644
/* Compare two lines A and B, returning negative, zero, or positive
depending on whether A compares less than, equal to, or greater than B. */
@@ -2749,7 +3394,7 @@ compare (struct line const *a, struct line const *b)
@@ -2759,7 +3404,7 @@ compare (struct line const *a, struct line const *b)
diff = - NONZERO (blen);
else if (blen == 0)
diff = 1;
@ -2614,7 +2614,7 @@ index 6d2eec5..f189a0d 100644
{
/* xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
@@ -4144,6 +4789,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
@@ -4149,6 +4794,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
break;
case 'f':
key->translate = fold_toupper;
@ -2622,7 +2622,7 @@ index 6d2eec5..f189a0d 100644
break;
case 'g':
key->general_numeric = true;
@@ -4223,7 +4869,7 @@ main (int argc, char **argv)
@@ -4228,7 +4874,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -2631,7 +2631,7 @@ index 6d2eec5..f189a0d 100644
hard_LC_TIME = hard_locale (LC_TIME);
#endif
@@ -4244,6 +4890,29 @@ main (int argc, char **argv)
@@ -4249,6 +4895,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@ -2661,7 +2661,7 @@ index 6d2eec5..f189a0d 100644
have_read_stdin = false;
inittables ();
@@ -4518,13 +5187,34 @@ main (int argc, char **argv)
@@ -4523,13 +5192,34 @@ main (int argc, char **argv)
case 't':
{
@ -2700,7 +2700,7 @@ index 6d2eec5..f189a0d 100644
else
{
/* Provoke with 'sort -txx'. Complain about
@@ -4535,9 +5225,11 @@ main (int argc, char **argv)
@@ -4540,9 +5230,11 @@ main (int argc, char **argv)
quote (optarg));
}
}
@ -2714,7 +2714,7 @@ index 6d2eec5..f189a0d 100644
}
break;
@@ -4765,12 +5457,10 @@ main (int argc, char **argv)
@@ -4771,12 +5463,10 @@ main (int argc, char **argv)
sort (files, nfiles, outfile, nthreads);
}
@ -3156,7 +3156,7 @@ diff --git a/tests/local.mk b/tests/local.mk
index 568944e..192f776 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -362,6 +362,8 @@ all_tests = \
@@ -368,6 +368,8 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
@ -3325,7 +3325,7 @@ index 4d399d8..07f2823 100755
my $delim = chr 0247;
sub t_subst ($)
{
@@ -329,8 +338,49 @@ foreach my $t (@tv)
@@ -333,8 +342,49 @@ foreach my $t (@tv)
push @Tests, $new_ent;
}

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.30
Release: 9%{?dist}
Version: 8.31
Release: 1%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/coreutils/
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
@ -13,15 +13,6 @@ Source106: coreutils-colorls.csh
# do not make coreutils-single depend on /usr/bin/coreutils
%global __requires_exclude ^%{_bindir}/coreutils$
# rename gnulib's renameat2 to renameatu to avoid clash with glibc (#1598518)
Patch1: coreutils-8.30-renameatu.patch
# fix heap-based buffer overflow in vasnprintf() (CVE-2018-17942)
Patch2: coreutils-8.30-CVE-2018-17942.patch
# sync: fix open() fallback bug
Patch3: coreutils-8.30-fsync-fallback.patch
# disable the test-lock gnulib test prone to deadlock
Patch100: coreutils-8.26-test-lock.patch
@ -243,6 +234,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%license COPYING
%changelog
* Mon Mar 11 2019 Kamil Dudka <kdudka@redhat.com> - 8.31-1
- new upstream release 8.31
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (coreutils-8.30.tar.xz) = 25bc132c0d89ce71c33e417f04649c9fcfce6c5ef8b19f093b2e9e2851bfde9b5a31e20499d9c427332228ba54b88d445ddb445551e1944bb8f5cbff5ffa4eda
SHA512 (coreutils-8.31.tar.xz) = ef8941dae845bbf5ae5838bc49e44554a766302930601aada6fa594e8088f0fbad74e481ee392ff89633e68b99e4da3f761fcb5d31ee3b233d540fe2a2d4e1af

View File

@ -1,6 +1,7 @@
%{_bindir}/arch
%{_bindir}/b2sum
%{_bindir}/basename
%{_bindir}/basenc
%{_bindir}/cat
%{_bindir}/chgrp
%{_bindir}/chmod