new upstream release 9.0
This commit is contained in:
parent
67dacdf0ad
commit
baf6440388
@ -2,7 +2,7 @@ diff --git a/src/date.c b/src/date.c
|
||||
index ddb011e..619a72b 100644
|
||||
--- a/src/date.c
|
||||
+++ b/src/date.c
|
||||
@@ -490,14 +490,7 @@ main (int argc, char **argv)
|
||||
@@ -494,14 +494,7 @@ main (int argc, char **argv)
|
||||
format = DATE_FMT_LANGINFO ();
|
||||
if (! *format)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ index bd5df23..84f2417 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
|
||||
@@ -58,7 +65,7 @@ DOOR 01;35 # door
|
||||
@@ -59,7 +66,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 ...
|
||||
@ -63,7 +63,7 @@ index 4316832..6402854 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
|
||||
@@ -48,17 +57,17 @@ TERM xterm*
|
||||
@@ -49,17 +58,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
|
||||
@ -86,7 +86,7 @@ index 4316832..6402854 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
|
||||
@@ -67,7 +76,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
|
||||
@@ -68,7 +77,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:
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 51b9a8ba0974d262e0b0f81a2078b3c7907b25ed Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Wed, 7 Apr 2021 17:29:59 -0700
|
||||
Subject: [PATCH] utimens: fix confusing arg type in internal func
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Although the old code was technically correct, this was accidental
|
||||
and it understandably confused Coverity. Reported by Ondrej Dubaj in:
|
||||
https://lists.gnu.org/r/bug-tar/2021-04/msg00000.html
|
||||
* lib/utimens.c (update_timespec): Change arg type from ‘struct
|
||||
timespec *[2]’ (pointer to array of 2 pointers to timespecs) to
|
||||
‘struct timespec **’ (pointer to pointer to the first timespec in
|
||||
an array of 2 timespecs). Although the old code happened to be
|
||||
technically correct, it was misleading and confused Coverity.
|
||||
And though the type ‘struct timespec (**)[2]’ (pointer to pointer
|
||||
to array of 2 timespecs) would perhaps be more technically
|
||||
correct, it would be almost as confusing and would require changes
|
||||
elsewhere in this file; let’s quit while we’re ahead.
|
||||
|
||||
Upstream-commit: a3a946f670718d0dee5a7425ad5ac0a29fb46ea1
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
lib/utimens.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/utimens.c b/lib/utimens.c
|
||||
index 3f53942..ea8c672 100644
|
||||
--- a/lib/utimens.c
|
||||
+++ b/lib/utimens.c
|
||||
@@ -123,14 +123,14 @@ validate_timespec (struct timespec timespec[2])
|
||||
return result + (utime_omit_count == 1);
|
||||
}
|
||||
|
||||
-/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat
|
||||
- buffer STATBUF to obtain the current timestamps of the file. If
|
||||
+/* Normalize any UTIME_NOW or UTIME_OMIT values in (*TS)[0] and (*TS)[1],
|
||||
+ using STATBUF to obtain the current timestamps of the file. If
|
||||
both times are UTIME_NOW, set *TS to NULL (as this can avoid some
|
||||
permissions issues). If both times are UTIME_OMIT, return true
|
||||
(nothing further beyond the prior collection of STATBUF is
|
||||
necessary); otherwise return false. */
|
||||
static bool
|
||||
-update_timespec (struct stat const *statbuf, struct timespec *ts[2])
|
||||
+update_timespec (struct stat const *statbuf, struct timespec **ts)
|
||||
{
|
||||
struct timespec *timespec = *ts;
|
||||
if (timespec[0].tv_nsec == UTIME_OMIT
|
||||
--
|
||||
2.26.3
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,119 +0,0 @@
|
||||
From 76126e2831580d0df20530f4d6f72189bd4f0b9a Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 18 Jun 2020 22:16:24 -0700
|
||||
Subject: [PATCH] cp: default to COW
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Likewise for ‘install’. Proposed in Bug#24400, and long past due.
|
||||
* NEWS:
|
||||
* doc/coreutils.texi (cp invocation):
|
||||
* src/copy.h (enum Reflink_type): Document this.
|
||||
* src/cp.c (cp_option_init):
|
||||
* src/install.c (cp_option_init): Implement this.
|
||||
|
||||
Upstream-commit: 25725f9d41735d176d73a757430739fb71c7d043
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
doc/coreutils.texi | 19 ++++++++++++-------
|
||||
src/copy.h | 4 ++--
|
||||
src/cp.c | 2 +-
|
||||
src/install.c | 2 +-
|
||||
4 files changed, 16 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 02e0c1c..2382a16 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -8854,12 +8854,14 @@ The @var{when} value can be one of the following:
|
||||
|
||||
@table @samp
|
||||
@item always
|
||||
-The default behavior: if the copy-on-write operation is not supported
|
||||
+If the copy-on-write operation is not supported
|
||||
then report the failure for each file and exit with a failure status.
|
||||
+Plain @option{--reflink} is equivalent to @option{--reflink=when}.
|
||||
|
||||
@item auto
|
||||
If the copy-on-write operation is not supported then fall back
|
||||
to the standard copy behavior.
|
||||
+This is the default if no @option{--reflink} option is given.
|
||||
|
||||
@item never
|
||||
Disable copy-on-write operation and use the standard copy behavior.
|
||||
@@ -8868,12 +8870,6 @@ Disable copy-on-write operation and use the standard copy behavior.
|
||||
This option is overridden by the @option{--link}, @option{--symbolic-link}
|
||||
and @option{--attributes-only} options, thus allowing it to be used
|
||||
to configure the default data copying behavior for @command{cp}.
|
||||
-For example, with the following alias, @command{cp} will use the
|
||||
-minimum amount of space supported by the file system.
|
||||
-
|
||||
-@example
|
||||
-alias cp='cp --reflink=auto --sparse=always'
|
||||
-@end example
|
||||
|
||||
@item --remove-destination
|
||||
@opindex --remove-destination
|
||||
@@ -8918,6 +8914,15 @@ This is useful in creating a file for use with the @command{mkswap} command,
|
||||
since such a file must not have any holes.
|
||||
@end table
|
||||
|
||||
+For example, with the following alias, @command{cp} will use the
|
||||
+minimum amount of space supported by the file system.
|
||||
+(Older versions of @command{cp} can also benefit from
|
||||
+@option{--reflink=auto} here.)
|
||||
+
|
||||
+@example
|
||||
+alias cp='cp --sparse=always'
|
||||
+@end example
|
||||
+
|
||||
@optStripTrailingSlashes
|
||||
|
||||
@item -s
|
||||
diff --git a/src/copy.h b/src/copy.h
|
||||
index 874d6f7..a0ad494 100644
|
||||
--- a/src/copy.h
|
||||
+++ b/src/copy.h
|
||||
@@ -46,10 +46,10 @@ enum Sparse_type
|
||||
/* Control creation of COW files. */
|
||||
enum Reflink_type
|
||||
{
|
||||
- /* Default to a standard copy. */
|
||||
+ /* Do a standard copy. */
|
||||
REFLINK_NEVER,
|
||||
|
||||
- /* Try a COW copy and fall back to a standard copy. */
|
||||
+ /* Try a COW copy and fall back to a standard copy; this is the default. */
|
||||
REFLINK_AUTO,
|
||||
|
||||
/* Require a COW copy and fail if not available. */
|
||||
diff --git a/src/cp.c b/src/cp.c
|
||||
index 0193df8..9e7ad14 100644
|
||||
--- a/src/cp.c
|
||||
+++ b/src/cp.c
|
||||
@@ -796,7 +796,7 @@ cp_option_init (struct cp_options *x)
|
||||
x->move_mode = false;
|
||||
x->install_mode = false;
|
||||
x->one_file_system = false;
|
||||
- x->reflink_mode = REFLINK_NEVER;
|
||||
+ x->reflink_mode = REFLINK_AUTO;
|
||||
|
||||
x->preserve_ownership = false;
|
||||
x->preserve_links = false;
|
||||
diff --git a/src/install.c b/src/install.c
|
||||
index 4ab44a6..aef16ca 100644
|
||||
--- a/src/install.c
|
||||
+++ b/src/install.c
|
||||
@@ -264,7 +264,7 @@ cp_option_init (struct cp_options *x)
|
||||
{
|
||||
cp_options_default (x);
|
||||
x->copy_as_regular = true;
|
||||
- x->reflink_mode = REFLINK_NEVER;
|
||||
+ x->reflink_mode = REFLINK_AUTO;
|
||||
x->dereference = DEREF_ALWAYS;
|
||||
x->unlink_dest_before_opening = true;
|
||||
x->unlink_dest_after_failed_open = false;
|
||||
--
|
||||
2.25.4
|
||||
|
@ -1,72 +0,0 @@
|
||||
From 0f053de4bc3ca0cfd88a42d236881dfdddb10ee9 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Wed, 30 Jun 2021 17:53:22 +0200
|
||||
Subject: [PATCH] df: fix duplicated remote entries due to bind mounts
|
||||
|
||||
As originally reported in <https://bugzilla.redhat.com/1962515>,
|
||||
df invoked without -a printed duplicated entries for NFS mounts
|
||||
of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99,
|
||||
which introduced the use of a hash table.
|
||||
|
||||
The proposed patch makes sure that the devlist entry seen the last time
|
||||
is used for comparison when eliminating duplicated mount entries. This
|
||||
way it worked before introducing the hash table.
|
||||
|
||||
Patch co-authored by Roberto Bergantinos.
|
||||
|
||||
* src/ls.c (struct devlist): Introduce the seen_last pointer.
|
||||
(devlist_for_dev): Return the devlist entry seen the last time if found.
|
||||
(filter_mount_list): Remember the devlist entry seen the last time for
|
||||
each hashed item.
|
||||
Fixes https://bugs.gnu.org/49298
|
||||
|
||||
Upstream-commit: d6125af095c9553f38cba0696f15158f5abe4ecc
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/df.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/df.c b/src/df.c
|
||||
index 7e01839..3e9247f 100644
|
||||
--- a/src/df.c
|
||||
+++ b/src/df.c
|
||||
@@ -54,6 +54,7 @@ struct devlist
|
||||
dev_t dev_num;
|
||||
struct mount_entry *me;
|
||||
struct devlist *next;
|
||||
+ struct devlist *seen_last; /* valid for hashed devlist entries only */
|
||||
};
|
||||
|
||||
/* Filled with device numbers of examined file systems to avoid
|
||||
@@ -689,7 +690,13 @@ devlist_for_dev (dev_t dev)
|
||||
return NULL;
|
||||
struct devlist dev_entry;
|
||||
dev_entry.dev_num = dev;
|
||||
- return hash_lookup (devlist_table, &dev_entry);
|
||||
+
|
||||
+ struct devlist *found = hash_lookup (devlist_table, &dev_entry);
|
||||
+ if (found == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* Return the last devlist entry we have seen with this dev_num */
|
||||
+ return found->seen_last;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -807,8 +814,12 @@ filter_mount_list (bool devices_only)
|
||||
devlist->dev_num = buf.st_dev;
|
||||
devlist->next = device_list;
|
||||
device_list = devlist;
|
||||
- if (hash_insert (devlist_table, devlist) == NULL)
|
||||
+
|
||||
+ struct devlist *hash_entry = hash_insert (devlist_table, devlist);
|
||||
+ if (hash_entry == NULL)
|
||||
xalloc_die ();
|
||||
+ /* Ensure lookups use this latest devlist. */
|
||||
+ hash_entry->seen_last = devlist;
|
||||
|
||||
me = me->me_next;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,81 +0,0 @@
|
||||
From 9618fb718b75920f37e5be2049ad1d0bb5c4a28c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 26 Jan 2021 09:23:54 -0800
|
||||
Subject: [PATCH] expr: fix bug with unmatched \(...\)
|
||||
|
||||
Problem reported by Qiuhao Li.
|
||||
* doc/coreutils.texi (String expressions):
|
||||
Document the correct behavior, which POSIX requires.
|
||||
* src/expr.c (docolon): Treat unmatched \(...\) as empty.
|
||||
* tests/misc/expr.pl: New test.
|
||||
|
||||
Upstream-commit: 735083ba24878075235007b4417982ad5700436d
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
doc/coreutils.texi | 14 ++++++++------
|
||||
src/expr.c | 9 +++++++--
|
||||
tests/misc/expr.pl | 3 +++
|
||||
3 files changed, 18 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 2382a16..5b2bb2c 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -13529,12 +13529,14 @@ second is considered to be a (basic, a la GNU @code{grep}) regular
|
||||
expression, with a @code{^} implicitly prepended. The first argument is
|
||||
then matched against this regular expression.
|
||||
|
||||
-If the match succeeds and @var{regex} uses @samp{\(} and @samp{\)}, the
|
||||
-@code{:} expression returns the part of @var{string} that matched the
|
||||
-subexpression; otherwise, it returns the number of characters matched.
|
||||
-
|
||||
-If the match fails, the @code{:} operator returns the null string if
|
||||
-@samp{\(} and @samp{\)} are used in @var{regex}, otherwise 0.
|
||||
+If @var{regex} does not use @samp{\(} and @samp{\)}, the @code{:}
|
||||
+expression returns the number of characters matched, or 0 if the match
|
||||
+fails.
|
||||
+
|
||||
+If @var{regex} uses @samp{\(} and @samp{\)}, the @code{:} expression
|
||||
+returns the part of @var{string} that matched the subexpression, or
|
||||
+the null string if the match failed or the subexpression did not
|
||||
+contribute to the match.
|
||||
|
||||
@kindex \( @r{regexp operator}
|
||||
Only the first @samp{\( @dots{} \)} pair is relevant to the return
|
||||
diff --git a/src/expr.c b/src/expr.c
|
||||
index e134872..0616a42 100644
|
||||
--- a/src/expr.c
|
||||
+++ b/src/expr.c
|
||||
@@ -721,8 +721,13 @@ docolon (VALUE *sv, VALUE *pv)
|
||||
/* Were \(...\) used? */
|
||||
if (re_buffer.re_nsub > 0)
|
||||
{
|
||||
- sv->u.s[re_regs.end[1]] = '\0';
|
||||
- v = str_value (sv->u.s + re_regs.start[1]);
|
||||
+ if (re_regs.end[1] < 0)
|
||||
+ v = str_value ("");
|
||||
+ else
|
||||
+ {
|
||||
+ sv->u.s[re_regs.end[1]] = '\0';
|
||||
+ v = str_value (sv->u.s + re_regs.start[1]);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/tests/misc/expr.pl b/tests/misc/expr.pl
|
||||
index e45f8e7..e57f79d 100755
|
||||
--- a/tests/misc/expr.pl
|
||||
+++ b/tests/misc/expr.pl
|
||||
@@ -84,6 +84,9 @@ my @Tests =
|
||||
# In 5.94 and earlier, anchors incorrectly matched newlines.
|
||||
['anchor', "'a\nb' : 'a\$'", {OUT => '0'}, {EXIT => 1}],
|
||||
|
||||
+ # In 8.32, \( ... \) that did not match caused memory errors.
|
||||
+ ['emptysub', '"a" : "\\(b\\)*"', {OUT => ''}, {EXIT => 1}],
|
||||
+
|
||||
# These tests are taken from grep/tests/bre.tests.
|
||||
['bre1', '"abc" : "a\\(b\\)c"', {OUT => 'b'}],
|
||||
['bre2', '"a(" : "a("', {OUT => '2'}],
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 602fb566468d3837b7871c17a0fab1a20228d119 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
|
||||
|
||||
Upstream-commit: 9a38d499ca16f2f4304992eb1ab0894cd0b478e1
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
lib/mountlist.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/mountlist.c b/lib/mountlist.c
|
||||
index e0227b7..e5f6b07 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 \
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,48 +0,0 @@
|
||||
From f61085aaa37f169365c56e44f5129d0491913b6a 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.
|
||||
|
||||
Upstream-commit: 175e0bc72808d564074c4adcc72aeadb74adfcc6
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
gnulib-tests/test-perror2.c | 3 ---
|
||||
gnulib-tests/test-strerror_r.c | 3 ---
|
||||
2 files changed, 6 deletions(-)
|
||||
|
||||
diff --git a/gnulib-tests/test-perror2.c b/gnulib-tests/test-perror2.c
|
||||
index 1d14eda..c6214dd 100644
|
||||
--- a/gnulib-tests/test-perror2.c
|
||||
+++ b/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);
|
||||
diff --git a/gnulib-tests/test-strerror_r.c b/gnulib-tests/test-strerror_r.c
|
||||
index b11d6fd..c1dbcf8 100644
|
||||
--- a/gnulib-tests/test-strerror_r.c
|
||||
+++ b/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);
|
||||
--
|
||||
2.25.4
|
||||
|
@ -1,164 +0,0 @@
|
||||
From b9f9ed14bda93ecb407129b69e6476813c250046 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Wed, 15 Apr 2020 20:50:32 -0700
|
||||
Subject: [PATCH] fts: remove NOSTAT_LEAF_OPTIMIZATION
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It caused ‘find’ and ‘du’ to dump core, and it was useful
|
||||
only for obsolescent Linux filesystems anyway. Problem reported in:
|
||||
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00068.html
|
||||
Quite possibly there is still a serious underlying fts bug with
|
||||
tight-loop-check and mutating file systems, but if so this patch
|
||||
should cause the bug to be triggered less often.
|
||||
* lib/fts.c (enum leaf_optimization): Remove
|
||||
NOSTAT_LEAF_OPTIMIZATION, as it’s problematic.
|
||||
(S_MAGIC_REISERFS, S_MAGIC_XFS): Remove; no longer needed.
|
||||
(leaf_optimization): Remove special cases for ReiserFS and XFS.
|
||||
(fts_read): Remove NOSTAT_LEAF_OPTIMIZATION code.
|
||||
* lib/fts_.h (struct _ftsent.fts_n_dirs_remaining):
|
||||
Remove. All uses removed.
|
||||
|
||||
Upstream-commit: 47bf2cf3184027c1eb9c1dfeea5c5b8b2d69710d
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
lib/fts.c | 56 ++++++++-------------------------------------------
|
||||
lib/fts_.h | 5 -----
|
||||
2 files changed, 8 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/lib/fts.c b/lib/fts.c
|
||||
index 1093ce5..dfe3fef 100644
|
||||
--- a/lib/fts.c
|
||||
+++ b/lib/fts.c
|
||||
@@ -445,7 +445,6 @@ fts_open (char * const *argv,
|
||||
if ((parent = fts_alloc(sp, "", 0)) == NULL)
|
||||
goto mem2;
|
||||
parent->fts_level = FTS_ROOTPARENTLEVEL;
|
||||
- parent->fts_n_dirs_remaining = -1;
|
||||
}
|
||||
|
||||
/* The classic fts implementation would call fts_stat with
|
||||
@@ -634,9 +633,8 @@ fts_close (FTS *sp)
|
||||
}
|
||||
|
||||
/* Minimum link count of a traditional Unix directory. When leaf
|
||||
- optimization is OK and MIN_DIR_NLINK <= st_nlink, then st_nlink is
|
||||
- an upper bound on the number of subdirectories (counting "." and
|
||||
- ".."). */
|
||||
+ optimization is OK and a directory's st_nlink == MIN_DIR_NLINK,
|
||||
+ then the directory has no subdirectories. */
|
||||
enum { MIN_DIR_NLINK = 2 };
|
||||
|
||||
/* Whether leaf optimization is OK for a directory. */
|
||||
@@ -645,12 +643,8 @@ enum leaf_optimization
|
||||
/* st_nlink is not reliable for this directory's subdirectories. */
|
||||
NO_LEAF_OPTIMIZATION,
|
||||
|
||||
- /* Leaf optimization is OK, but is not useful for avoiding stat calls. */
|
||||
- OK_LEAF_OPTIMIZATION,
|
||||
-
|
||||
- /* Leaf optimization is not only OK: it is useful for avoiding
|
||||
- stat calls, because dirent.d_type does not work. */
|
||||
- NOSTAT_LEAF_OPTIMIZATION
|
||||
+ /* st_nlink == 2 means the directory lacks subdirectories. */
|
||||
+ OK_LEAF_OPTIMIZATION
|
||||
};
|
||||
|
||||
#if (defined __linux__ || defined __ANDROID__) \
|
||||
@@ -663,9 +657,7 @@ enum leaf_optimization
|
||||
# define S_MAGIC_CIFS 0xFF534D42
|
||||
# define S_MAGIC_NFS 0x6969
|
||||
# define S_MAGIC_PROC 0x9FA0
|
||||
-# define S_MAGIC_REISERFS 0x52654973
|
||||
# define S_MAGIC_TMPFS 0x1021994
|
||||
-# define S_MAGIC_XFS 0x58465342
|
||||
|
||||
# ifdef HAVE___FSWORD_T
|
||||
typedef __fsword_t fsword;
|
||||
@@ -786,23 +778,15 @@ dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
|
||||
}
|
||||
|
||||
/* Given an FTS entry P for a directory with descriptor DIR_FD,
|
||||
- return true if it is both useful and valid to apply leaf optimization.
|
||||
- The optimization is useful only for file systems that lack usable
|
||||
- dirent.d_type info. The optimization is valid if an st_nlink value
|
||||
- of at least MIN_DIR_NLINK is an upper bound on the number of
|
||||
- subdirectories of D, counting "." and ".." as subdirectories.
|
||||
+ return whether it is valid to apply leaf optimization.
|
||||
+ The optimization is valid if a directory's st_nlink value equal
|
||||
+ to MIN_DIR_NLINK means the directory has no subdirectories.
|
||||
DIR_FD is negative if unavailable. */
|
||||
static enum leaf_optimization
|
||||
leaf_optimization (FTSENT const *p, int dir_fd)
|
||||
{
|
||||
switch (filesystem_type (p, dir_fd))
|
||||
{
|
||||
- /* List here the file system types that may lack usable dirent.d_type
|
||||
- info, yet for which the optimization does apply. */
|
||||
- case S_MAGIC_REISERFS:
|
||||
- case S_MAGIC_XFS: /* XFS lacked it until 2013-08-22 commit. */
|
||||
- return NOSTAT_LEAF_OPTIMIZATION;
|
||||
-
|
||||
case 0:
|
||||
/* Leaf optimization is unsafe if the file system type is unknown. */
|
||||
FALLTHROUGH;
|
||||
@@ -1027,26 +1011,7 @@ check_for_dir:
|
||||
if (p->fts_info == FTS_NSOK)
|
||||
{
|
||||
if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
|
||||
- {
|
||||
- FTSENT *parent = p->fts_parent;
|
||||
- if (parent->fts_n_dirs_remaining == 0
|
||||
- && ISSET(FTS_NOSTAT)
|
||||
- && ISSET(FTS_PHYSICAL)
|
||||
- && (leaf_optimization (parent, sp->fts_cwd_fd)
|
||||
- == NOSTAT_LEAF_OPTIMIZATION))
|
||||
- {
|
||||
- /* nothing more needed */
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- p->fts_info = fts_stat(sp, p, false);
|
||||
- if (S_ISDIR(p->fts_statp->st_mode)
|
||||
- && p->fts_level != FTS_ROOTLEVEL
|
||||
- && 0 < parent->fts_n_dirs_remaining
|
||||
- && parent->fts_n_dirs_remaining != (nlink_t) -1)
|
||||
- parent->fts_n_dirs_remaining--;
|
||||
- }
|
||||
- }
|
||||
+ p->fts_info = fts_stat(sp, p, false);
|
||||
else
|
||||
fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
|
||||
}
|
||||
@@ -1830,11 +1795,6 @@ err: memset(sbp, 0, sizeof(struct stat));
|
||||
}
|
||||
|
||||
if (S_ISDIR(sbp->st_mode)) {
|
||||
- p->fts_n_dirs_remaining
|
||||
- = ((sbp->st_nlink < MIN_DIR_NLINK
|
||||
- || p->fts_level <= FTS_ROOTLEVEL)
|
||||
- ? -1
|
||||
- : sbp->st_nlink - (ISSET (FTS_SEEDOT) ? 0 : MIN_DIR_NLINK));
|
||||
if (ISDOT(p->fts_name)) {
|
||||
/* Command-line "." and ".." are real directories. */
|
||||
return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT);
|
||||
diff --git a/lib/fts_.h b/lib/fts_.h
|
||||
index d40a116..2e76cc4 100644
|
||||
--- a/lib/fts_.h
|
||||
+++ b/lib/fts_.h
|
||||
@@ -227,11 +227,6 @@ typedef struct _ftsent {
|
||||
|
||||
size_t fts_namelen; /* strlen(fts_name) */
|
||||
|
||||
- /* If not (nlink_t) -1, an upper bound on the number of
|
||||
- remaining subdirectories of interest. If this becomes
|
||||
- zero, some work can be avoided. */
|
||||
- nlink_t fts_n_dirs_remaining;
|
||||
-
|
||||
# define FTS_D 1 /* preorder directory */
|
||||
# define FTS_DC 2 /* directory that causes cycles */
|
||||
# define FTS_DEFAULT 3 /* none of the above */
|
||||
--
|
||||
2.21.1
|
||||
|
@ -1,153 +0,0 @@
|
||||
From 8c022656320592dbad146f5d3a3ae1875f419446 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 5 Mar 2020 17:25:29 -0800
|
||||
Subject: [PATCH 1/2] 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.
|
||||
|
||||
Upstream-commit: 10fcb97bd728f09d4a027eddf8ad2900f0819b0a
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/ls.c | 22 ----------------------
|
||||
tests/ls/removed-directory.sh | 10 ++--------
|
||||
2 files changed, 2 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/src/ls.c b/src/ls.c
|
||||
index 9d25f62..850ecc2 100644
|
||||
--- a/src/ls.c
|
||||
+++ b/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 *realname, bool command_line_arg)
|
||||
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 *realname, bool command_line_arg)
|
||||
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 *realname, bool command_line_arg)
|
||||
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;
|
||||
|
||||
diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
|
||||
index e8c835d..fe8f929 100755
|
||||
--- a/tests/ls/removed-directory.sh
|
||||
+++ b/tests/ls/removed-directory.sh
|
||||
@@ -26,20 +26,14 @@ case $host_triplet in
|
||||
*) 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_
|
||||
|
||||
-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
|
||||
--
|
||||
2.21.1
|
||||
|
||||
|
||||
From 847324a0debd9d12062c79e7a7a9d3d8ce76390d Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Sat, 7 Mar 2020 10:29:51 -0800
|
||||
Subject: [PATCH 2/2] 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).
|
||||
|
||||
Upstream-commit: 672819c73f2e94e61386dc0584bddf9da860cc26
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
tests/ls/removed-directory.sh | 13 ++++---------
|
||||
1 file changed, 4 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
|
||||
index fe8f929..63b209d 100755
|
||||
--- a/tests/ls/removed-directory.sh
|
||||
+++ b/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,15 +21,10 @@
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ ls
|
||||
|
||||
-case $host_triplet in
|
||||
- *linux*) ;;
|
||||
- *) skip_ 'non linux kernel' ;;
|
||||
-esac
|
||||
-
|
||||
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"
|
||||
|
||||
ls >../out 2>../err || fail=1
|
||||
cd "$cwd" || framework_failure_
|
||||
--
|
||||
2.21.1
|
||||
|
@ -1,85 +0,0 @@
|
||||
From 53c6b01e8e3fd338d7f53e5ff817ef86f9efa852 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Wed, 11 Nov 2020 17:22:33 +0000
|
||||
Subject: [PATCH] ls: fix crash printing SELinux context for unstatable files
|
||||
|
||||
This crash was identified by Cyber Independent Testing Lab:
|
||||
https://cyber-itl.org/2020/10/28/citl-7000-defects.html
|
||||
and was introduced with commit v6.9.90-11-g4245876e2
|
||||
|
||||
* src/ls.c (gobble_file): Ensure scontext is initialized
|
||||
in the case where files are not statable.
|
||||
* tests/ls/selinux-segfault.sh: Renamed from proc-selinux-segfault.sh,
|
||||
and added test case for broken symlinks.
|
||||
* tests/local.mk: Adjust for the renamed test.
|
||||
|
||||
Upstream-commit: 6fc695cb4a26f09dfeef8b1c24895a707055334e
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/ls.c | 3 +++
|
||||
tests/local.mk | 2 +-
|
||||
.../{proc-selinux-segfault.sh => selinux-segfault.sh} | 10 ++++++++--
|
||||
3 files changed, 12 insertions(+), 3 deletions(-)
|
||||
rename tests/ls/{proc-selinux-segfault.sh => selinux-segfault.sh} (77%)
|
||||
|
||||
diff --git a/src/ls.c b/src/ls.c
|
||||
index 4acf5f4..8eb483d 100644
|
||||
--- a/src/ls.c
|
||||
+++ b/src/ls.c
|
||||
@@ -3412,6 +3412,9 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
|
||||
provokes an exit status of 1. */
|
||||
file_failure (command_line_arg,
|
||||
_("cannot access %s"), full_name);
|
||||
+
|
||||
+ f->scontext = UNKNOWN_SECURITY_CONTEXT;
|
||||
+
|
||||
if (command_line_arg)
|
||||
return 0;
|
||||
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 2aeff2b..2441fdc 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -616,7 +616,7 @@ all_tests = \
|
||||
tests/ls/multihardlink.sh \
|
||||
tests/ls/no-arg.sh \
|
||||
tests/ls/no-cap.sh \
|
||||
- tests/ls/proc-selinux-segfault.sh \
|
||||
+ tests/ls/selinux-segfault.sh \
|
||||
tests/ls/quote-align.sh \
|
||||
tests/ls/readdir-mountpoint-inode.sh \
|
||||
tests/ls/recursive.sh \
|
||||
diff --git a/tests/ls/proc-selinux-segfault.sh b/tests/ls/selinux-segfault.sh
|
||||
similarity index 77%
|
||||
rename from tests/ls/proc-selinux-segfault.sh
|
||||
rename to tests/ls/selinux-segfault.sh
|
||||
index 831a00e..e2b7ef6 100755
|
||||
--- a/tests/ls/proc-selinux-segfault.sh
|
||||
+++ b/tests/ls/selinux-segfault.sh
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
-# ls -l /proc/sys would segfault when built against libselinux1 2.0.15-2+b1
|
||||
+# Ensure we don't segfault in selinux handling
|
||||
|
||||
# Copyright (C) 2008-2020 Free Software Foundation, Inc.
|
||||
|
||||
@@ -19,9 +19,15 @@
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ ls
|
||||
|
||||
+# ls -l /proc/sys would segfault when built against libselinux1 2.0.15-2+b1
|
||||
f=/proc/sys
|
||||
test -r $f || f=.
|
||||
-
|
||||
ls -l $f > out || fail=1
|
||||
|
||||
+# ls <= 8.32 would segfault when printing
|
||||
+# the security context of broken symlink targets
|
||||
+mkdir sedir || framework_failure_
|
||||
+ln -sf missing sedir/broken || framework_failure_
|
||||
+returns_ 1 ls -L -R -Z -m sedir > out || fail=1
|
||||
+
|
||||
Exit $fail
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,186 +0,0 @@
|
||||
From be77b4ab7cb68fd2daf9de90bd75d844392788ac Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 25 Mar 2021 11:57:56 +0100
|
||||
Subject: [PATCH 1/4] ln: fix memory leaks in do_link
|
||||
|
||||
* src/ln.c (do_link): Free memory allocated by convert_abs_rel
|
||||
on all code paths (Bug#47373).
|
||||
|
||||
Upstream-commit: 6e98f67758260579d7d44ea5f2df4c82d28c9f58
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/ln.c | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/ln.c b/src/ln.c
|
||||
index ffa278e..9b52602 100644
|
||||
--- a/src/ln.c
|
||||
+++ b/src/ln.c
|
||||
@@ -229,14 +229,14 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
error (0, errno, _("failed to access %s"), quoteaf (dest));
|
||||
- return false;
|
||||
+ goto fail;
|
||||
}
|
||||
force = false;
|
||||
}
|
||||
else if (S_ISDIR (dest_stats.st_mode))
|
||||
{
|
||||
error (0, 0, _("%s: cannot overwrite directory"), quotef (dest));
|
||||
- return false;
|
||||
+ goto fail;
|
||||
}
|
||||
else if (seen_file (dest_set, dest, &dest_stats))
|
||||
{
|
||||
@@ -245,7 +245,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
error (0, 0,
|
||||
_("will not overwrite just-created %s with %s"),
|
||||
quoteaf_n (0, dest), quoteaf_n (1, source));
|
||||
- return false;
|
||||
+ goto fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -274,7 +274,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
{
|
||||
error (0, 0, _("%s and %s are the same file"),
|
||||
quoteaf_n (0, source), quoteaf_n (1, dest));
|
||||
- return false;
|
||||
+ goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,10 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
fprintf (stderr, _("%s: replace %s? "),
|
||||
program_name, quoteaf (dest));
|
||||
if (!yesno ())
|
||||
- return true;
|
||||
+ {
|
||||
+ free(rel_source);
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (backup_type != no_backups)
|
||||
@@ -304,7 +307,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
{
|
||||
error (0, rename_errno, _("cannot backup %s"),
|
||||
quoteaf (dest));
|
||||
- return false;
|
||||
+ goto fail;
|
||||
}
|
||||
force = false;
|
||||
}
|
||||
@@ -397,6 +400,10 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
free (backup_base);
|
||||
free (rel_source);
|
||||
return link_errno <= 0;
|
||||
+
|
||||
+fail:
|
||||
+ free (rel_source);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
||||
From c051578e69bd8acf8f8a469566ae34e855345532 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 25 Mar 2021 09:15:50 -0700
|
||||
Subject: [PATCH 2/4] maint: indenting
|
||||
|
||||
* src/ln.c: Fix indenting.
|
||||
|
||||
Upstream-commit: 8980b7c898046d899646da01c296fd15f0cced21
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/ln.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/ln.c b/src/ln.c
|
||||
index 9b52602..8881d6a 100644
|
||||
--- a/src/ln.c
|
||||
+++ b/src/ln.c
|
||||
@@ -286,7 +286,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
program_name, quoteaf (dest));
|
||||
if (!yesno ())
|
||||
{
|
||||
- free(rel_source);
|
||||
+ free (rel_source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ do_link (char const *source, int destdir_fd, char const *dest_base,
|
||||
free (backup_base);
|
||||
backup_base = NULL;
|
||||
if (rename_errno != ENOENT)
|
||||
- {
|
||||
+ {
|
||||
error (0, rename_errno, _("cannot backup %s"),
|
||||
quoteaf (dest));
|
||||
goto fail;
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
||||
From 0d6a4afe5bee0e397fb2fc3b205a29b32a69af9d Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 25 Mar 2021 09:16:36 -0700
|
||||
Subject: [PATCH 3/4] hostname: use puts
|
||||
|
||||
* src/hostname.c (main): Prefer puts to printf "%s\n".
|
||||
|
||||
Upstream-commit: c7a588ac3632aae21642d4d568497177950d36bf
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/hostname.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hostname.c b/src/hostname.c
|
||||
index 0b5c0cf..62cc98c 100644
|
||||
--- a/src/hostname.c
|
||||
+++ b/src/hostname.c
|
||||
@@ -103,7 +103,7 @@ main (int argc, char **argv)
|
||||
hostname = xgethostname ();
|
||||
if (hostname == NULL)
|
||||
die (EXIT_FAILURE, errno, _("cannot determine hostname"));
|
||||
- printf ("%s\n", hostname);
|
||||
+ puts (hostname);
|
||||
}
|
||||
|
||||
if (optind + 1 < argc)
|
||||
--
|
||||
2.26.3
|
||||
|
||||
|
||||
From 19c98d2080251edbaad9fb271aa10ad34f953500 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Thu, 25 Mar 2021 11:20:18 -0700
|
||||
Subject: [PATCH 4/4] hostname: pacify valgrind
|
||||
|
||||
* src/hostname.c (main) [IF_LINT]: Free hostname (Bug#47384).
|
||||
|
||||
Upstream-commit: 4698e284f37844bc9b9f63f00eb556ccaaed5030
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/hostname.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/hostname.c b/src/hostname.c
|
||||
index 62cc98c..7210248 100644
|
||||
--- a/src/hostname.c
|
||||
+++ b/src/hostname.c
|
||||
@@ -104,6 +104,7 @@ main (int argc, char **argv)
|
||||
if (hostname == NULL)
|
||||
die (EXIT_FAILURE, errno, _("cannot determine hostname"));
|
||||
puts (hostname);
|
||||
+ IF_LINT (free (hostname));
|
||||
}
|
||||
|
||||
if (optind + 1 < argc)
|
||||
--
|
||||
2.26.3
|
||||
|
@ -1,104 +0,0 @@
|
||||
From 09400b7f7f48d8eedc0df55de8073a43bc0aac96 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Tue, 27 Oct 2020 20:15:43 +0000
|
||||
Subject: [PATCH 1/2] stat,tail: sync file system constants from the linux
|
||||
kernel
|
||||
|
||||
* src/stat.c: Add magic constants for "devmem", and
|
||||
"zonefs" file systems.
|
||||
* NEWS: Mention the improvement.
|
||||
|
||||
Upstream-commit: ff80b6b0a0507e24f39cc1aad09d147f5187430b
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/stat.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/stat.c b/src/stat.c
|
||||
index 5012622..8cd69da 100644
|
||||
--- a/src/stat.c
|
||||
+++ b/src/stat.c
|
||||
@@ -347,6 +347,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
|
||||
return "debugfs";
|
||||
case S_MAGIC_DEVFS: /* 0x1373 local */
|
||||
return "devfs";
|
||||
+ case S_MAGIC_DEVMEM: /* 0x454D444D local */
|
||||
+ return "devmem";
|
||||
case S_MAGIC_DEVPTS: /* 0x1CD1 local */
|
||||
return "devpts";
|
||||
case S_MAGIC_DMA_BUF: /* 0x444D4142 local */
|
||||
@@ -549,6 +551,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
|
||||
return "z3fold";
|
||||
case S_MAGIC_ZFS: /* 0x2FC12FC1 local */
|
||||
return "zfs";
|
||||
+ case S_MAGIC_ZONEFS: /* 0x5A4F4653 local */
|
||||
+ return "zonefs";
|
||||
case S_MAGIC_ZSMALLOC: /* 0x58295829 local */
|
||||
return "zsmallocfs";
|
||||
|
||||
--
|
||||
2.25.4
|
||||
|
||||
|
||||
From d5948fd41013dfe4d2d10083111821667977c6d1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Tue, 27 Oct 2020 21:04:14 +0000
|
||||
Subject: [PATCH 2/2] mountlist: recognize more file system types as remote
|
||||
|
||||
Sync "remote" file systems from stat.c in coreutils.
|
||||
Note we only consider file systems that do not use host:resource
|
||||
mount source. I.e. those that don't generally use a colon when
|
||||
mounting, as that case is already considered. Searching for
|
||||
"<fstype> /etc/fstab" was informative for identifying these.
|
||||
The full list of "remote" file systems in coreutils is currently:
|
||||
acfs afs ceph cifs coda fhgfs fuseblk fusectl
|
||||
gfs gfs2 gpfs ibrix k-afs lustre novell nfs nfsd
|
||||
ocfs2 panfs prl_fs smb smb2 snfs vboxsf vmhgfs vxfs
|
||||
Note also we do not include virtual machine file systems,
|
||||
as even though they're remote to the current kernel,
|
||||
they are generally not distributed to separate hosts.
|
||||
|
||||
* lib/mountlist.c (ME_REMOTE): Sync previously unconsidered
|
||||
"remote" file systems from stat.c in coreutils.
|
||||
|
||||
Upstream-commit: dd1fc46be12d671c1a9d9dc5a6fa8c766e99aa2f
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
lib/mountlist.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/mountlist.c b/lib/mountlist.c
|
||||
index 7abe024..e0227b7 100644
|
||||
--- a/lib/mountlist.c
|
||||
+++ b/lib/mountlist.c
|
||||
@@ -221,8 +221,9 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
|
||||
#ifndef ME_REMOTE
|
||||
/* A file system is "remote" if its Fs_name contains a ':'
|
||||
or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
|
||||
- or if it is of type (afs or auristorfs)
|
||||
- or Fs_name is equal to "-hosts" (used by autofs to mount remote fs). */
|
||||
+ or if it is of any other of the listed types
|
||||
+ or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).
|
||||
+ "VM" file systems like prl_fs or vboxsf are not considered remote here. */
|
||||
# define ME_REMOTE(Fs_name, Fs_type) \
|
||||
(strchr (Fs_name, ':') != NULL \
|
||||
|| ((Fs_name)[0] == '/' \
|
||||
@@ -230,8 +231,15 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
|
||||
&& (strcmp (Fs_type, "smbfs") == 0 \
|
||||
|| strcmp (Fs_type, "smb3") == 0 \
|
||||
|| strcmp (Fs_type, "cifs") == 0)) \
|
||||
+ || strcmp (Fs_type, "acfs") == 0 \
|
||||
|| strcmp (Fs_type, "afs") == 0 \
|
||||
+ || strcmp (Fs_type, "coda") == 0 \
|
||||
|| strcmp (Fs_type, "auristorfs") == 0 \
|
||||
+ || strcmp (Fs_type, "fhgfs") == 0 \
|
||||
+ || strcmp (Fs_type, "gpfs") == 0 \
|
||||
+ || strcmp (Fs_type, "ibrix") == 0 \
|
||||
+ || strcmp (Fs_type, "ocfs2") == 0 \
|
||||
+ || strcmp (Fs_type, "vxfs") == 0 \
|
||||
|| strcmp ("-hosts", Fs_name) == 0)
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.4
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 11b37b65d08c2a8b6d967fd866ebbdbe7e864949 Mon Sep 17 00:00:00 2001
|
||||
From: Nishant Nayan <nishant.nayan@oracle.com>
|
||||
Date: Thu, 26 Nov 2020 14:35:17 +0000
|
||||
Subject: [PATCH] rm: do not skip files upon failure to remove an empty dir
|
||||
|
||||
When removing a directory fails for some reason, and that directory
|
||||
is empty, the rm_fts code gets the return value of the excise call
|
||||
confused with the return value of its earlier call to prompt,
|
||||
causing fts_skip_tree to be called again and the next file
|
||||
that rm would otherwise have deleted to survive.
|
||||
|
||||
* src/remove.c (rm_fts): Ensure we only skip a single fts entry,
|
||||
when processing empty dirs. I.e. only skip the entry
|
||||
having successfully removed it.
|
||||
* tests/rm/empty-immutable-skip.sh: New root-only test.
|
||||
* tests/local.mk: Add it.
|
||||
* NEWS: Mention the bug fix.
|
||||
Fixes https://bugs.gnu.org/44883
|
||||
|
||||
Upstream-commit: 6bf108358a6104ec1c694c9530b3cd56b95f4b57
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/remove.c | 3 ++-
|
||||
tests/local.mk | 1 +
|
||||
tests/rm/empty-immutable-skip.sh | 46 ++++++++++++++++++++++++++++++++
|
||||
3 files changed, 49 insertions(+), 1 deletion(-)
|
||||
create mode 100755 tests/rm/empty-immutable-skip.sh
|
||||
|
||||
diff --git a/src/remove.c b/src/remove.c
|
||||
index 2d40c55..adf9489 100644
|
||||
--- a/src/remove.c
|
||||
+++ b/src/remove.c
|
||||
@@ -506,7 +506,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
|
||||
/* When we know (from prompt when in interactive mode)
|
||||
that this is an empty directory, don't prompt twice. */
|
||||
s = excise (fts, ent, x, true);
|
||||
- fts_skip_tree (fts, ent);
|
||||
+ if (s == RM_OK)
|
||||
+ fts_skip_tree (fts, ent);
|
||||
}
|
||||
|
||||
if (s != RM_OK)
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 5f7f775..2aeff2b 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -136,6 +136,7 @@ all_root_tests = \
|
||||
tests/rm/no-give-up.sh \
|
||||
tests/rm/one-file-system.sh \
|
||||
tests/rm/read-only.sh \
|
||||
+ tests/rm/empty-immutable-skip.sh \
|
||||
tests/tail-2/append-only.sh \
|
||||
tests/tail-2/end-of-device.sh \
|
||||
tests/touch/now-owned-by-other.sh
|
||||
diff --git a/tests/rm/empty-immutable-skip.sh b/tests/rm/empty-immutable-skip.sh
|
||||
new file mode 100755
|
||||
index 0000000..c91d8d4
|
||||
--- /dev/null
|
||||
+++ b/tests/rm/empty-immutable-skip.sh
|
||||
@@ -0,0 +1,46 @@
|
||||
+#!/bin/sh
|
||||
+# Ensure that rm does not skip extra files after hitting an empty immutable dir.
|
||||
+# Requires root access to do chattr +i, as well as an ext[23] or xfs file system
|
||||
+
|
||||
+# Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software: you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation, either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ rm
|
||||
+require_root_
|
||||
+
|
||||
+# These simple one-file operations are expected to work even in the
|
||||
+# presence of this bug, and we need them to set up the rest of the test.
|
||||
+chattr_i_works=1
|
||||
+touch f
|
||||
+chattr +i f 2>/dev/null || chattr_i_works=0
|
||||
+rm f 2>/dev/null
|
||||
+test -f f || chattr_i_works=0
|
||||
+chattr -i f 2>/dev/null || chattr_i_works=0
|
||||
+rm f 2>/dev/null || chattr_i_works=0
|
||||
+test -f f && chattr_i_works=0
|
||||
+
|
||||
+if test $chattr_i_works = 0; then
|
||||
+ skip_ "chattr +i doesn't work on this file system"
|
||||
+fi
|
||||
+
|
||||
+mkdir empty || framework_failure_
|
||||
+touch x y || framework_failure_
|
||||
+chattr +i empty || framework_failure_
|
||||
+rm -rf empty x y
|
||||
+{ test -f x || test -f y; } && fail=1
|
||||
+chattr -i empty
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,100 +0,0 @@
|
||||
From bb0e7fabcaed9a7e71e30f05e638e9f243cdb13e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Mon, 25 Jan 2021 14:12:48 +0000
|
||||
Subject: [PATCH] split: fix --number=K/N to output correct part of file
|
||||
|
||||
This functionality regressed with the adjustments
|
||||
in commit v8.25-4-g62e7af032
|
||||
|
||||
* src/split.c (bytes_chunk_extract): Account for already read data
|
||||
when seeking into the file.
|
||||
* tests/split/b-chunk.sh: Use the hidden ---io-blksize option,
|
||||
to test this functionality.
|
||||
Fixes https://bugs.gnu.org/46048
|
||||
|
||||
Upstream-commit: bb21daa125aeb4e32546309d370918ca47e612db
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/split.c | 2 +-
|
||||
tests/split/b-chunk.sh | 45 ++++++++++++++++++++++++------------------
|
||||
2 files changed, 27 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/split.c b/src/split.c
|
||||
index 09e610b..19248f6 100644
|
||||
--- a/src/split.c
|
||||
+++ b/src/split.c
|
||||
@@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
|
||||
+ if (lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0)
|
||||
die (EXIT_FAILURE, errno, "%s", quotef (infile));
|
||||
initial_read = SIZE_MAX;
|
||||
}
|
||||
diff --git a/tests/split/b-chunk.sh b/tests/split/b-chunk.sh
|
||||
index 864ce55..39a6799 100755
|
||||
--- a/tests/split/b-chunk.sh
|
||||
+++ b/tests/split/b-chunk.sh
|
||||
@@ -35,32 +35,39 @@ split -e -n 10 /dev/null || fail=1
|
||||
returns_ 1 stat x?? 2>/dev/null || fail=1
|
||||
|
||||
printf '1\n2\n3\n4\n5\n' > input || framework_failure_
|
||||
+printf '1\n2' > exp-1 || framework_failure_
|
||||
+printf '\n3\n' > exp-2 || framework_failure_
|
||||
+printf '4\n5\n' > exp-3 || framework_failure_
|
||||
|
||||
for file in input /proc/version /sys/kernel/profiling; do
|
||||
test -f $file || continue
|
||||
|
||||
- split -n 3 $file > out || fail=1
|
||||
- split -n 1/3 $file > b1 || fail=1
|
||||
- split -n 2/3 $file > b2 || fail=1
|
||||
- split -n 3/3 $file > b3 || fail=1
|
||||
+ for blksize in 1 2 4096; do
|
||||
+ if ! test "$file" = 'input'; then
|
||||
+ # For /proc like files we must be able to read all
|
||||
+ # into the internal buffer to be able to determine size.
|
||||
+ test "$blksize" = 4096 || continue
|
||||
+ fi
|
||||
|
||||
- case $file in
|
||||
- input)
|
||||
- printf '1\n2' > exp-1
|
||||
- printf '\n3\n' > exp-2
|
||||
- printf '4\n5\n' > exp-3
|
||||
+ split -n 3 ---io-blksize=$blksize $file > out || fail=1
|
||||
+ split -n 1/3 ---io-blksize=$blksize $file > b1 || fail=1
|
||||
+ split -n 2/3 ---io-blksize=$blksize $file > b2 || fail=1
|
||||
+ split -n 3/3 ---io-blksize=$blksize $file > b3 || fail=1
|
||||
|
||||
- compare exp-1 xaa || fail=1
|
||||
- compare exp-2 xab || fail=1
|
||||
- compare exp-3 xac || fail=1
|
||||
- ;;
|
||||
- esac
|
||||
+ case $file in
|
||||
+ input)
|
||||
+ compare exp-1 xaa || fail=1
|
||||
+ compare exp-2 xab || fail=1
|
||||
+ compare exp-3 xac || fail=1
|
||||
+ ;;
|
||||
+ esac
|
||||
|
||||
- compare xaa b1 || fail=1
|
||||
- compare xab b2 || fail=1
|
||||
- compare xac b3 || fail=1
|
||||
- cat xaa xab xac | compare - $file || fail=1
|
||||
- test -f xad && fail=1
|
||||
+ compare xaa b1 || fail=1
|
||||
+ compare xab b2 || fail=1
|
||||
+ compare xac b3 || fail=1
|
||||
+ cat xaa xab xac | compare - $file || fail=1
|
||||
+ test -f xad && fail=1
|
||||
+ done
|
||||
done
|
||||
|
||||
Exit $fail
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,32 +0,0 @@
|
||||
From b87f944c87ffe04db6e5476b007a8e4979de933d Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 18 Feb 2021 11:18:04 +0100
|
||||
Subject: [PATCH] stat,tail: add support for the exfat file system
|
||||
|
||||
Bug: https://bugzilla.redhat.com/1921427
|
||||
|
||||
* src/stat.c (human_fstype): Add case for the 'exfat' file system type.
|
||||
Fixes https://bugs.gnu.org/46613
|
||||
|
||||
Upstream-commit: a5e0d8f387e81e854427addbbaf2504541bbf4b9
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/stat.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/stat.c b/src/stat.c
|
||||
index 8cd69da..4e1c8e3 100644
|
||||
--- a/src/stat.c
|
||||
+++ b/src/stat.c
|
||||
@@ -361,6 +361,8 @@ human_fstype (STRUCT_STATVFS const *statfsbuf)
|
||||
return "efs";
|
||||
case S_MAGIC_EROFS_V1: /* 0xE0F5E1E2 local */
|
||||
return "erofs";
|
||||
+ case S_MAGIC_EXFAT: /* 0x2011BAB0 local */
|
||||
+ return "exfat";
|
||||
case S_MAGIC_EXFS: /* 0x45584653 local */
|
||||
return "exfs";
|
||||
case S_MAGIC_EXOFS: /* 0x5DF5 local */
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,181 +0,0 @@
|
||||
From c7a04cef4075da864a3468e63a5bb79334d8f556 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Sat, 26 Jun 2021 18:23:52 -0700
|
||||
Subject: [PATCH] tail: use poll, not select
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes an unlikely stack out-of-bounds write reported by
|
||||
Stepan Broz via Kamil Dudka (Bug#49209).
|
||||
* src/tail.c: Do not include <sys/select.h>.
|
||||
[!_AIX]: Include poll.h.
|
||||
(check_output_alive) [!_AIX]: Use poll instead of select.
|
||||
(tail_forever_inotify): Likewise. Simplify logic, as there is no
|
||||
need for a ‘while (len <= evbuf_off)’ loop.
|
||||
|
||||
Upstream-commit: da0d448bca62c6305fc432f67e2c5ccc2da75346
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
src/tail.c | 100 +++++++++++++++++++++--------------------------------
|
||||
1 file changed, 39 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/src/tail.c b/src/tail.c
|
||||
index 1c88723..5b4f21a 100644
|
||||
--- a/src/tail.c
|
||||
+++ b/src/tail.c
|
||||
@@ -28,12 +28,9 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <getopt.h>
|
||||
-#include <sys/select.h>
|
||||
+#include <poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
-#ifdef _AIX
|
||||
-# include <poll.h>
|
||||
-#endif
|
||||
|
||||
#include "system.h"
|
||||
#include "argmatch.h"
|
||||
@@ -351,27 +348,12 @@ check_output_alive (void)
|
||||
if (! monitor_output)
|
||||
return;
|
||||
|
||||
-#ifdef _AIX
|
||||
- /* select on AIX was seen to give a readable event immediately. */
|
||||
struct pollfd pfd;
|
||||
pfd.fd = STDOUT_FILENO;
|
||||
pfd.events = POLLERR;
|
||||
|
||||
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & POLLERR))
|
||||
die_pipe ();
|
||||
-#else
|
||||
- struct timeval delay;
|
||||
- delay.tv_sec = delay.tv_usec = 0;
|
||||
-
|
||||
- fd_set rfd;
|
||||
- FD_ZERO (&rfd);
|
||||
- FD_SET (STDOUT_FILENO, &rfd);
|
||||
-
|
||||
- /* readable event on STDOUT is equivalent to POLLERR,
|
||||
- and implies an error condition on output like broken pipe. */
|
||||
- if (select (STDOUT_FILENO + 1, &rfd, NULL, NULL, &delay) == 1)
|
||||
- die_pipe ();
|
||||
-#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -1612,7 +1594,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
|
||||
/* Wait for inotify events and handle them. Events on directories
|
||||
ensure that watched files can be re-added when following by name.
|
||||
This loop blocks on the 'safe_read' call until a new event is notified.
|
||||
- But when --pid=P is specified, tail usually waits via the select. */
|
||||
+ But when --pid=P is specified, tail usually waits via poll. */
|
||||
while (1)
|
||||
{
|
||||
struct File_spec *fspec;
|
||||
@@ -1629,54 +1611,51 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
|
||||
return false;
|
||||
}
|
||||
|
||||
- /* When watching a PID, ensure that a read from WD will not block
|
||||
- indefinitely. */
|
||||
- while (len <= evbuf_off)
|
||||
+ if (len <= evbuf_off)
|
||||
{
|
||||
- struct timeval delay; /* how long to wait for file changes. */
|
||||
+ /* Poll for inotify events. When watching a PID, ensure
|
||||
+ that a read from WD will not block indefinitely.
|
||||
+ If MONITOR_OUTPUT, also poll for a broken output pipe. */
|
||||
|
||||
- if (pid)
|
||||
+ int file_change;
|
||||
+ struct pollfd pfd[2];
|
||||
+ do
|
||||
{
|
||||
- if (writer_is_dead)
|
||||
- exit (EXIT_SUCCESS);
|
||||
+ /* How many ms to wait for changes. -1 means wait forever. */
|
||||
+ int delay = -1;
|
||||
|
||||
- writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
|
||||
-
|
||||
- if (writer_is_dead)
|
||||
- delay.tv_sec = delay.tv_usec = 0;
|
||||
- else
|
||||
+ if (pid)
|
||||
{
|
||||
- delay.tv_sec = (time_t) sleep_interval;
|
||||
- delay.tv_usec = 1000000 * (sleep_interval - delay.tv_sec);
|
||||
+ if (writer_is_dead)
|
||||
+ exit (EXIT_SUCCESS);
|
||||
+
|
||||
+ writer_is_dead = (kill (pid, 0) != 0 && errno != EPERM);
|
||||
+
|
||||
+ if (writer_is_dead || sleep_interval <= 0)
|
||||
+ delay = 0;
|
||||
+ else if (sleep_interval < INT_MAX / 1000 - 1)
|
||||
+ {
|
||||
+ /* delay = ceil (sleep_interval * 1000), sans libm. */
|
||||
+ double ddelay = sleep_interval * 1000;
|
||||
+ delay = ddelay;
|
||||
+ delay += delay < ddelay;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ pfd[0].fd = wd;
|
||||
+ pfd[0].events = POLLIN;
|
||||
+ pfd[1].fd = STDOUT_FILENO;
|
||||
+ pfd[1].events = pfd[1].revents = 0;
|
||||
+ file_change = poll (pfd, monitor_output + 1, delay);
|
||||
}
|
||||
+ while (file_change == 0);
|
||||
|
||||
- fd_set rfd;
|
||||
- FD_ZERO (&rfd);
|
||||
- FD_SET (wd, &rfd);
|
||||
- if (monitor_output)
|
||||
- FD_SET (STDOUT_FILENO, &rfd);
|
||||
-
|
||||
- int file_change = select (MAX (wd, STDOUT_FILENO) + 1,
|
||||
- &rfd, NULL, NULL, pid ? &delay: NULL);
|
||||
-
|
||||
- if (file_change == 0)
|
||||
- continue;
|
||||
- else if (file_change == -1)
|
||||
- die (EXIT_FAILURE, errno,
|
||||
- _("error waiting for inotify and output events"));
|
||||
- else if (FD_ISSET (STDOUT_FILENO, &rfd))
|
||||
- {
|
||||
- /* readable event on STDOUT is equivalent to POLLERR,
|
||||
- and implies an error on output like broken pipe. */
|
||||
- die_pipe ();
|
||||
- }
|
||||
- else
|
||||
- break;
|
||||
- }
|
||||
+ if (file_change < 0)
|
||||
+ die (EXIT_FAILURE, errno,
|
||||
+ _("error waiting for inotify and output events"));
|
||||
+ if (pfd[1].revents)
|
||||
+ die_pipe ();
|
||||
|
||||
- if (len <= evbuf_off)
|
||||
- {
|
||||
len = safe_read (wd, evbuf, evlen);
|
||||
evbuf_off = 0;
|
||||
|
||||
@@ -2437,8 +2416,7 @@ main (int argc, char **argv)
|
||||
if (forever && ignore_fifo_and_pipe (F, n_files))
|
||||
{
|
||||
/* If stdout is a fifo or pipe, then monitor it
|
||||
- so that we exit if the reader goes away.
|
||||
- Note select() on a regular file is always readable. */
|
||||
+ so that we exit if the reader goes away. */
|
||||
struct stat out_stat;
|
||||
if (fstat (STDOUT_FILENO, &out_stat) < 0)
|
||||
die (EXIT_FAILURE, errno, _("standard output"));
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,99 +0,0 @@
|
||||
From fc6318841f008dadc1e7c93e539f10d24aa83e90 Mon Sep 17 00:00:00 2001
|
||||
From: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||
Date: Wed, 21 Apr 2021 00:12:00 +0200
|
||||
Subject: [PATCH 1/2] tests: fix FP in ls/stat-free-color.sh
|
||||
|
||||
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
|
||||
newfstatat(STDOUT_FILENO, ...), but only when there is something to
|
||||
output.
|
||||
|
||||
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
|
||||
of ls, thus enforcing something gets output.
|
||||
|
||||
Upstream-commit: b7091093bb6505c33279f9bc940b2e94763a6e5d
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
tests/ls/stat-free-color.sh | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh
|
||||
index 00942f7..87bed1c 100755
|
||||
--- a/tests/ls/stat-free-color.sh
|
||||
+++ b/tests/ls/stat-free-color.sh
|
||||
@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat)
|
||||
# The system may perform additional stat-like calls before main.
|
||||
# Furthermore, underlying library functions may also implicitly
|
||||
# add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d.
|
||||
-# To avoid counting those, first get a baseline count for running
|
||||
-# ls with one empty directory argument. Then, compare that with the
|
||||
-# invocation under test.
|
||||
+# Finally, ls(1) makes a stat call for stdout, but only in the case
|
||||
+# when there is something to output.
|
||||
+# To get the comparison right, first get a baseline count for running
|
||||
+# 'ls -a' with one empty directory argument. Then, compare that with
|
||||
+# the invocation under test.
|
||||
mkdir d || framework_failure_
|
||||
|
||||
-strace -q -o log1 -e $stats ls --color=always d || fail=1
|
||||
+strace -q -o log1 -e $stats ls -a --color=always d || fail=1
|
||||
n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_
|
||||
|
||||
test $n_stat1 = 0 \
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
||||
From c16ca58f17a088e925c0d1c4015c48332c380a00 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sun, 9 May 2021 23:41:00 +0100
|
||||
Subject: [PATCH 2/2] tests: fix tests/cp/sparse-2.sh false failure on some
|
||||
systems
|
||||
|
||||
* tests/cp/sparse-2.sh: Double check cp --sparse=always,
|
||||
with dd conv=sparse, in the case where the former didn't
|
||||
create a sparse file. Now that this test is being newly run
|
||||
on macos, we're seeing a failure due to seek() not creating
|
||||
holes on apfs unless the size is >= 16MiB.
|
||||
|
||||
Upstream-commit: 6b499720fecae935dc00e236d6aefe94d9010482
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
tests/cp/fiemap-2.sh | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tests/cp/fiemap-2.sh b/tests/cp/fiemap-2.sh
|
||||
index 548a376..e20ce54 100755
|
||||
--- a/tests/cp/fiemap-2.sh
|
||||
+++ b/tests/cp/fiemap-2.sh
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
-print_ver_ cp
|
||||
+print_ver_ cp stat dd
|
||||
|
||||
# Require a fiemap-enabled FS.
|
||||
touch fiemap_chk # check a file rather than current dir for best coverage
|
||||
@@ -46,10 +46,17 @@ dd bs=1k seek=1 of=k count=255 < /dev/zero || framework_failure_
|
||||
|
||||
# cp should detect the all-zero blocks and convert some of them to holes.
|
||||
# How many it detects/converts currently depends on io_blksize.
|
||||
-# Currently, on my F14/ext4 desktop, this K starts off with size 256KiB,
|
||||
+# Currently, on my F14/ext4 desktop, this K file starts off with size 256KiB,
|
||||
# (note that the K in the preceding test starts off with size 4KiB).
|
||||
# cp from coreutils-8.9 with --sparse=always reduces the size to 32KiB.
|
||||
cp --sparse=always k k2 || fail=1
|
||||
-test $(stat -c %b k2) -lt $(stat -c %b k) || fail=1
|
||||
+if test $(stat -c %b k2) -ge $(stat -c %b k); then
|
||||
+ # If not sparse, then double check by creating with dd
|
||||
+ # as we're not guaranteed that seek will create a hole.
|
||||
+ # apfs on darwin 19.2.0 for example was seen to not to create holes < 16MiB.
|
||||
+ hole_size=$(stat -c %o k2) || framework_failure_
|
||||
+ dd if=k of=k2.dd bs=$hole_size conv=sparse || framework_failure_
|
||||
+ test $(stat -c %b k2) -eq $(stat -c %b k2.dd) || fail=1
|
||||
+fi
|
||||
|
||||
Exit $fail
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,16 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAl5hC5MACgkQ32/ZcTBg
|
||||
N9n92Q//Td2GE1f8AZKkxCNI76Q/TqbxAwhjbkR+KdzvsyMePmgHcMgHG6sO2MNF
|
||||
g6DIBmHpO3vWGzvUxUZRRhuW5QBOnMxHb/WXZ0p/g45d5MQdn4i0dA0wUJgByOqn
|
||||
/WVfygNg9mrWFx/uTeCdhrwL11m71C7j/eQVu7Wr5DIb20VJ8+nVC2IWW33ZvxRj
|
||||
Goa0wwDpeeD9qYe/Y+E5ZyhDYHJGRmNAlS03SXLO3+RfsbZFwdQEtzvr+v1VN6/S
|
||||
9OsoI/GLdRjY1tByppaoZ63ZybB6iF5zZfJiWDF7Nw4MduJpjZQDSywiNleJ9vOi
|
||||
fwR1180PjMV6aTXvPwqbqQxZjDl7nqvO36ghlTvErJbqdJVIYxmUGNjeJyjqI85l
|
||||
Lhckh0GWos9K/kl13Ry9KWsxNQgfjNhtgjXGh+W47ojrho2kCiK5BTwDFeVU0jtU
|
||||
H/1EePSGAIUF/Sfjz3rmGgLaaBwPiRiyzEIuZMyd4NCJWwfOTqgOshOYw15GCWYq
|
||||
wGesN/4LWzEja7Au5lHP7imXjP0bp4qE/sYrOb4WzVVLCn+z2hu6SEIzjJzSm+D+
|
||||
8Wv3Ia1/ypVpR+Z7gUt7VtEvI8zAwlySd/6Jw5U7TL0rzvZsTVWmCvEjPp+o3jCB
|
||||
Fy/4ybao1gowBFtT1AtPMmxmiJ41KWCxLFrTuGJpFYCGvBH2y8s=
|
||||
=yHV6
|
||||
-----END PGP SIGNATURE-----
|
@ -2,7 +2,7 @@ diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 400e135..47e4480 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -10074,6 +10074,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
|
||||
@@ -10829,6 +10829,8 @@ incorrect. @xref{Directory Setuid and Setgid}, for how the
|
||||
set-user-ID and set-group-ID bits of directories are inherited unless
|
||||
overridden in this way.
|
||||
|
||||
|
16
coreutils-9.0.tar.xz.sig
Normal file
16
coreutils-9.0.tar.xz.sig
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAABCAAdFiEEbDfcEhIaUAa8HbgE32/ZcTBgN9kFAmFN1c4ACgkQ32/ZcTBg
|
||||
N9mtfw/8D8BJrt2Ver2xdPfow5FYHT/zakUQ2b3ZIHP0Es62W56+pWtGombphrZu
|
||||
4PkI1x6i4S8z06O9rWPIDGMPjyPV9UJbzAiGC7Px6tW6RFHZx0M+GNsKfcjmhtf7
|
||||
0v3jFF0g1IdrikFG1aYCAHZHy7n+yOm7xsfSmlYVlKcOVbCFN92ZBw0IohOSriSq
|
||||
nJN6IOY8I3frhuI5kchY4wM6RMQ+ztNtG8odNvJI3kWCCL9pQFxzD8uorrvTiAcp
|
||||
Qdbfz5TDnlVcXKR1gu6AAP+XThUYuxG5t/2Kghlril1zxnbDBZJsGteevyHsS7kY
|
||||
grAWY4XqSvKVURGaKSSUhXlriQilPknBaichwEhAXvrUk1giviAzZ8CXB6WzzTvn
|
||||
E9+ofC8RqTu345+ixkdZZu0TauOZWYIUVzKsD7W0ooQOT7OZeIQfb3+pbves/I+k
|
||||
ZyiRLxfiUkAkKMUDrMr+okhqFA9fo/GCkFmHWj9m2NAc15kifEpSiCktfgoChbeG
|
||||
ZiQFXQz090P+L1pk82qBXVgTjUyS5VEnXZoIkTWGzkHKySwreiaIjPQhS3cU2xAm
|
||||
24i53zidj84Ib62Xa4jwxX7BzZqYRdbWAa/BUUNMov75W4dfkPlZ6qbRXtKnoOZf
|
||||
u0ok3fgFvopGzwbw3l/HFp58jpaYL5S28gy10PpdOnxeO54XBn0=
|
||||
=3TCC
|
||||
-----END PGP SIGNATURE-----
|
@ -1,8 +1,20 @@
|
||||
From 6e36198f10a2f63b89c89ebb5d5c185b20fb3a63 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 29 Mar 2010 17:20:34 +0000
|
||||
Subject: [PATCH] coreutils-df-direct.patch
|
||||
|
||||
---
|
||||
doc/coreutils.texi | 7 ++++++
|
||||
src/df.c | 36 ++++++++++++++++++++++++++++--
|
||||
tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 96 insertions(+), 2 deletions(-)
|
||||
create mode 100755 tests/df/direct.sh
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index a507280..400e135 100644
|
||||
index 5b9a597..6810c15 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -11303,6 +11303,13 @@ some systems (notably SunOS), doing this yields more up to date results,
|
||||
@@ -12067,6 +12067,13 @@ some systems (notably Solaris), doing this yields more up to date results,
|
||||
but in general this option makes @command{df} much slower, especially when
|
||||
there are many or very busy file systems.
|
||||
|
||||
@ -15,12 +27,12 @@ index a507280..400e135 100644
|
||||
+
|
||||
@item --total
|
||||
@opindex --total
|
||||
@cindex grand total of disk size, usage and available space
|
||||
@cindex grand total of file system size, usage and available space
|
||||
diff --git a/src/df.c b/src/df.c
|
||||
index 8f760db..a7385fd 100644
|
||||
index 48025b9..c8efa5b 100644
|
||||
--- a/src/df.c
|
||||
+++ b/src/df.c
|
||||
@@ -120,6 +120,9 @@ static bool print_type;
|
||||
@@ -125,6 +125,9 @@ static bool print_type;
|
||||
/* If true, print a grand total at the end. */
|
||||
static bool print_grand_total;
|
||||
|
||||
@ -30,7 +42,7 @@ index 8f760db..a7385fd 100644
|
||||
/* Grand total data. */
|
||||
static struct fs_usage grand_fsu;
|
||||
|
||||
@@ -247,13 +250,15 @@ enum
|
||||
@@ -252,13 +255,15 @@ enum
|
||||
NO_SYNC_OPTION = CHAR_MAX + 1,
|
||||
SYNC_OPTION,
|
||||
TOTAL_OPTION,
|
||||
@ -47,7 +59,7 @@ index 8f760db..a7385fd 100644
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
@@ -509,7 +514,10 @@ get_header (void)
|
||||
@@ -583,7 +588,10 @@ get_header (void)
|
||||
for (col = 0; col < ncolumns; col++)
|
||||
{
|
||||
char *cell = NULL;
|
||||
@ -59,7 +71,7 @@ index 8f760db..a7385fd 100644
|
||||
|
||||
if (columns[col]->field == SIZE_FIELD
|
||||
&& (header_mode == DEFAULT_MODE
|
||||
@@ -1397,6 +1405,19 @@ get_point (const char *point, const struct stat *statp)
|
||||
@@ -1486,6 +1494,19 @@ get_point (char const *point, const struct stat *statp)
|
||||
static void
|
||||
get_entry (char const *name, struct stat const *statp)
|
||||
{
|
||||
@ -77,9 +89,9 @@ index 8f760db..a7385fd 100644
|
||||
+ }
|
||||
+
|
||||
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
|
||||
&& get_disk (name))
|
||||
&& get_device (name))
|
||||
return;
|
||||
@@ -1467,6 +1488,7 @@ or all file systems by default.\n\
|
||||
@@ -1556,6 +1577,7 @@ or all file systems by default.\n\
|
||||
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
|
||||
'-BM' prints sizes in units of 1,048,576 bytes;\n\
|
||||
see SIZE format below\n\
|
||||
@ -87,7 +99,7 @@ index 8f760db..a7385fd 100644
|
||||
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
|
||||
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
|
||||
"), stdout);
|
||||
@@ -1557,6 +1579,9 @@ main (int argc, char **argv)
|
||||
@@ -1646,6 +1668,9 @@ main (int argc, char **argv)
|
||||
xstrtol_fatal (e, oi, c, long_options, optarg);
|
||||
}
|
||||
break;
|
||||
@ -97,7 +109,7 @@ index 8f760db..a7385fd 100644
|
||||
case 'i':
|
||||
if (header_mode == OUTPUT_MODE)
|
||||
{
|
||||
@@ -1653,6 +1678,13 @@ main (int argc, char **argv)
|
||||
@@ -1742,6 +1767,13 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,3 +184,6 @@ index 0000000..8e4cfb8
|
||||
+compare file_out file_exp || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
@ -29,7 +29,7 @@ index 76474c2..0a9d221 100644
|
||||
#include "xalloc-oversized.h"
|
||||
|
||||
/* Work around an incompatibility of OS X 10.11: getgrouplist
|
||||
@@ -121,9 +122,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
@@ -119,9 +120,17 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
/* else no username, so fall through and use getgroups. */
|
||||
#endif
|
||||
|
||||
@ -50,7 +50,7 @@ index 76474c2..0a9d221 100644
|
||||
|
||||
/* If we failed to count groups because there is no supplemental
|
||||
group support, then return an array containing just GID.
|
||||
@@ -145,10 +154,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
@@ -143,10 +152,25 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
|
||||
if (g == NULL)
|
||||
return -1;
|
||||
|
||||
@ -84,7 +84,7 @@ diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4
|
||||
index 62777c7..5180243 100644
|
||||
--- a/m4/jm-macros.m4
|
||||
+++ b/m4/jm-macros.m4
|
||||
@@ -82,6 +82,7 @@ AC_DEFUN([coreutils_MACROS],
|
||||
@@ -68,6 +68,7 @@ AC_DEFUN([coreutils_MACROS],
|
||||
fchown
|
||||
fchmod
|
||||
ftruncate
|
||||
|
@ -1,4 +1,4 @@
|
||||
From e87ab5b991b08092a7e07af82b3ec822a8604151 Mon Sep 17 00:00:00 2001
|
||||
From bde345889debed9041dec0710b1edc78821ced21 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Oprala <ooprala@redhat.com>
|
||||
Date: Wed, 5 Aug 2015 09:15:09 +0200
|
||||
Subject: [PATCH] expand,unexpand: add multibyte support
|
||||
@ -20,15 +20,15 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
|
||||
bootstrap.conf | 1 +
|
||||
configure.ac | 2 +
|
||||
lib/mbfile.c | 3 +
|
||||
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++
|
||||
m4/mbfile.m4 | 14 +++
|
||||
src/expand.c | 43 +++++----
|
||||
src/expand.c | 43 +++++---
|
||||
src/local.mk | 4 +-
|
||||
src/unexpand.c | 54 +++++++----
|
||||
tests/expand/mb.sh | 98 ++++++++++++++++++++
|
||||
src/unexpand.c | 54 ++++++---
|
||||
tests/expand/mb.sh | 98 +++++++++++++++++
|
||||
tests/local.mk | 2 +
|
||||
tests/unexpand/mb.sh | 97 ++++++++++++++++++++
|
||||
10 files changed, 535 insertions(+), 34 deletions(-)
|
||||
tests/unexpand/mb.sh | 97 ++++++++++++++++
|
||||
11 files changed, 537 insertions(+), 36 deletions(-)
|
||||
create mode 100644 lib/mbfile.c
|
||||
create mode 100644 lib/mbfile.h
|
||||
create mode 100644 m4/mbfile.m4
|
||||
@ -36,10 +36,10 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
|
||||
create mode 100755 tests/unexpand/mb.sh
|
||||
|
||||
diff --git a/bootstrap.conf b/bootstrap.conf
|
||||
index 8a0ff31..a1c78b2 100644
|
||||
index aef9ec7..9486e9d 100644
|
||||
--- a/bootstrap.conf
|
||||
+++ b/bootstrap.conf
|
||||
@@ -152,6 +152,7 @@ gnulib_modules="
|
||||
@@ -156,6 +156,7 @@ gnulib_modules="
|
||||
maintainer-makefile
|
||||
malloc-gnu
|
||||
manywarnings
|
||||
@ -48,10 +48,10 @@ index 8a0ff31..a1c78b2 100644
|
||||
mbrtowc
|
||||
mbsalign
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 1e74b36..24c9725 100644
|
||||
index 6960b48..8ff85f8 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -427,6 +427,8 @@ fi
|
||||
@@ -457,6 +457,8 @@ fi
|
||||
# I'm leaving it here for now. This whole thing needs to be modernized...
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
@ -351,7 +351,7 @@ index 0000000..8589902
|
||||
+ :
|
||||
+])
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 9fa2e10..380e020 100644
|
||||
index 4e32bfc..28809b0 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -37,6 +37,9 @@
|
||||
@ -363,8 +363,8 @@ index 9fa2e10..380e020 100644
|
||||
+
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "xstrndup.h"
|
||||
@@ -100,19 +103,19 @@ expand (void)
|
||||
|
||||
@@ -97,19 +100,19 @@ expand (void)
|
||||
{
|
||||
/* Input stream. */
|
||||
FILE *fp = next_file (NULL);
|
||||
@ -388,7 +388,7 @@ index 9fa2e10..380e020 100644
|
||||
/* The following variables have valid values only when CONVERT
|
||||
is true: */
|
||||
|
||||
@@ -122,17 +125,23 @@ expand (void)
|
||||
@@ -119,17 +122,23 @@ expand (void)
|
||||
/* Index in TAB_LIST of next tab stop to examine. */
|
||||
size_t tab_index = 0;
|
||||
|
||||
@ -416,7 +416,7 @@ index 9fa2e10..380e020 100644
|
||||
{
|
||||
/* Column the next input tab stop is on. */
|
||||
uintmax_t next_tab_column;
|
||||
@@ -151,32 +160,34 @@ expand (void)
|
||||
@@ -148,32 +157,34 @@ expand (void)
|
||||
if (putchar (' ') < 0)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
@ -460,22 +460,22 @@ index 9fa2e10..380e020 100644
|
||||
}
|
||||
|
||||
diff --git a/src/local.mk b/src/local.mk
|
||||
index 72db9c704..ef3bfa469 100644
|
||||
index 0c8b65d..011421a 100644
|
||||
--- a/src/local.mk
|
||||
+++ b/src/local.mk
|
||||
@@ -415,8 +415,8 @@ src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
|
||||
|
||||
src_ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS)
|
||||
@@ -429,8 +429,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS)
|
||||
src_basenc_SOURCES = src/basenc.c
|
||||
src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
|
||||
|
||||
-src_expand_SOURCES = src/expand.c src/expand-common.c
|
||||
-src_unexpand_SOURCES = src/unexpand.c src/expand-common.c
|
||||
+src_expand_SOURCES = src/expand.c src/expand-common.c lib/mbfile.c
|
||||
+src_unexpand_SOURCES = src/unexpand.c src/expand-common.c lib/mbfile.c
|
||||
|
||||
# Ensure we don't link against libcoreutils.a as that lib is
|
||||
# not compiled with -fPIC which causes issues on 64 bit at least
|
||||
src_wc_SOURCES = src/wc.c
|
||||
if USE_AVX2_WC_LINECOUNT
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 7801274..569a7ee 100644
|
||||
index cec392d..02f18f9 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -38,6 +38,9 @@
|
||||
@ -487,8 +487,8 @@ index 7801274..569a7ee 100644
|
||||
+
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "xstrndup.h"
|
||||
@@ -107,11 +110,12 @@ unexpand (void)
|
||||
|
||||
@@ -106,11 +109,12 @@ unexpand (void)
|
||||
{
|
||||
/* Input stream. */
|
||||
FILE *fp = next_file (NULL);
|
||||
@ -502,7 +502,7 @@ index 7801274..569a7ee 100644
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
@@ -119,12 +123,14 @@ unexpand (void)
|
||||
@@ -118,12 +122,14 @@ unexpand (void)
|
||||
/* The worst case is a non-blank character, then one blank, then a
|
||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||
@ -519,7 +519,7 @@ index 7801274..569a7ee 100644
|
||||
|
||||
/* If true, perform translations. */
|
||||
bool convert = true;
|
||||
@@ -158,12 +164,19 @@ unexpand (void)
|
||||
@@ -157,12 +163,19 @@ unexpand (void)
|
||||
|
||||
do
|
||||
{
|
||||
@ -542,7 +542,7 @@ index 7801274..569a7ee 100644
|
||||
|
||||
if (blank)
|
||||
{
|
||||
@@ -180,16 +193,16 @@ unexpand (void)
|
||||
@@ -179,16 +192,16 @@ unexpand (void)
|
||||
if (next_tab_column < column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
|
||||
@ -562,7 +562,7 @@ index 7801274..569a7ee 100644
|
||||
|
||||
if (! (prev_blank && column == next_tab_column))
|
||||
{
|
||||
@@ -197,13 +210,14 @@ unexpand (void)
|
||||
@@ -196,13 +209,14 @@ unexpand (void)
|
||||
will be replaced by tabs. */
|
||||
if (column == next_tab_column)
|
||||
one_blank_before_tab_stop = true;
|
||||
@ -579,7 +579,7 @@ index 7801274..569a7ee 100644
|
||||
}
|
||||
|
||||
/* Discard pending blanks, unless it was a single
|
||||
@@ -211,7 +225,7 @@ unexpand (void)
|
||||
@@ -210,7 +224,7 @@ unexpand (void)
|
||||
pending = one_blank_before_tab_stop;
|
||||
}
|
||||
}
|
||||
@ -588,7 +588,7 @@ index 7801274..569a7ee 100644
|
||||
{
|
||||
/* Go back one column, and force recalculation of the
|
||||
next tab stop. */
|
||||
@@ -221,7 +235,7 @@ unexpand (void)
|
||||
@@ -220,7 +234,7 @@ unexpand (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -597,7 +597,7 @@ index 7801274..569a7ee 100644
|
||||
if (!column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
}
|
||||
@@ -229,8 +243,11 @@ unexpand (void)
|
||||
@@ -228,8 +242,11 @@ unexpand (void)
|
||||
if (pending)
|
||||
{
|
||||
if (pending > 1 && one_blank_before_tab_stop)
|
||||
@ -611,7 +611,7 @@ index 7801274..569a7ee 100644
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
pending = 0;
|
||||
one_blank_before_tab_stop = false;
|
||||
@@ -240,16 +257,17 @@ unexpand (void)
|
||||
@@ -239,16 +256,17 @@ unexpand (void)
|
||||
convert &= convert_entire_line || blank;
|
||||
}
|
||||
|
||||
@ -737,10 +737,10 @@ index 0000000..7971e18
|
||||
+
|
||||
+exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 192f776..8053397 100644
|
||||
index b98694b..a76c808 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -544,6 +544,7 @@ all_tests = \
|
||||
@@ -575,6 +575,7 @@ all_tests = \
|
||||
tests/du/threshold.sh \
|
||||
tests/du/trailing-slash.sh \
|
||||
tests/du/two-args.sh \
|
||||
@ -748,7 +748,7 @@ index 192f776..8053397 100644
|
||||
tests/id/gnu-zero-uids.sh \
|
||||
tests/id/no-context.sh \
|
||||
tests/id/context.sh \
|
||||
@@ -684,6 +685,7 @@ all_tests = \
|
||||
@@ -726,6 +727,7 @@ all_tests = \
|
||||
tests/touch/read-only.sh \
|
||||
tests/touch/relative.sh \
|
||||
tests/touch/trailing-slash.sh \
|
||||
@ -860,5 +860,5 @@ index 0000000..60d4c1a
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
--
|
||||
2.7.4
|
||||
2.31.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 29117b2d07af00f4d4b87cf778e4294588ab1a83 Mon Sep 17 00:00:00 2001
|
||||
From 25a1f8ac25f8ad4d204d40f372636adf5b03e083 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 1 Dec 2016 15:10:04 +0100
|
||||
Subject: [PATCH] coreutils-i18n.patch
|
||||
@ -6,7 +6,7 @@ Subject: [PATCH] coreutils-i18n.patch
|
||||
TODO: merge upstream
|
||||
---
|
||||
lib/linebuffer.h | 8 +
|
||||
src/fold.c | 308 +++++++++++++--
|
||||
src/fold.c | 310 +++++++++++++--
|
||||
src/join.c | 359 ++++++++++++++---
|
||||
src/pr.c | 443 +++++++++++++++++++--
|
||||
src/sort.c | 764 ++++++++++++++++++++++++++++++++++--
|
||||
@ -22,16 +22,16 @@ TODO: merge upstream
|
||||
tests/misc/unexpand.pl | 39 ++
|
||||
tests/misc/uniq.pl | 55 +++
|
||||
tests/pr/pr-tests.pl | 49 +++
|
||||
17 files changed, 2290 insertions(+), 154 deletions(-)
|
||||
17 files changed, 2291 insertions(+), 155 deletions(-)
|
||||
create mode 100755 tests/i18n/sort.sh
|
||||
create mode 100755 tests/misc/sort-mb-tests.sh
|
||||
|
||||
diff --git a/lib/linebuffer.h b/lib/linebuffer.h
|
||||
index 64181af..9b8fe5a 100644
|
||||
index 5fa5ad2..2bdbcab 100644
|
||||
--- a/lib/linebuffer.h
|
||||
+++ b/lib/linebuffer.h
|
||||
@@ -21,6 +21,11 @@
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
# include "idx.h"
|
||||
# include <stdio.h>
|
||||
|
||||
+/* Get mbstate_t. */
|
||||
@ -42,9 +42,9 @@ index 64181af..9b8fe5a 100644
|
||||
/* A 'struct linebuffer' holds a line of text. */
|
||||
|
||||
struct linebuffer
|
||||
@@ -28,6 +33,9 @@ struct linebuffer
|
||||
size_t size; /* Allocated. */
|
||||
size_t length; /* Used. */
|
||||
@@ -29,6 +34,9 @@ struct linebuffer
|
||||
idx_t size; /* Allocated. */
|
||||
idx_t length; /* Used. */
|
||||
char *buffer;
|
||||
+# if HAVE_WCHAR_H
|
||||
+ mbstate_t state;
|
||||
@ -53,7 +53,7 @@ index 64181af..9b8fe5a 100644
|
||||
|
||||
/* Initialize linebuffer LINEBUFFER for use. */
|
||||
diff --git a/src/fold.c b/src/fold.c
|
||||
index 8cd0d6b..d23edd5 100644
|
||||
index 94a6d37..ead3c03 100644
|
||||
--- a/src/fold.c
|
||||
+++ b/src/fold.c
|
||||
@@ -22,12 +22,34 @@
|
||||
@ -203,16 +203,19 @@ index 8cd0d6b..d23edd5 100644
|
||||
/* Look for the last blank. */
|
||||
while (logical_end)
|
||||
{
|
||||
@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t width)
|
||||
@@ -215,13 +252,223 @@ fold_file (char const *filename, size_t width)
|
||||
line_out[offset_out++] = c;
|
||||
}
|
||||
|
||||
- saved_errno = errno;
|
||||
+ *saved_errno = errno;
|
||||
|
||||
if (offset_out)
|
||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
|
||||
if (!ferror (istream))
|
||||
- saved_errno = 0;
|
||||
+ *saved_errno = 0;
|
||||
+
|
||||
+ if (offset_out)
|
||||
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#if HAVE_MBRTOWC
|
||||
@ -384,10 +387,10 @@ index 8cd0d6b..d23edd5 100644
|
||||
+ }
|
||||
+
|
||||
+ *saved_errno = errno;
|
||||
+
|
||||
+ if (offset_out)
|
||||
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
+
|
||||
|
||||
if (offset_out)
|
||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
@ -423,9 +426,9 @@ index 8cd0d6b..d23edd5 100644
|
||||
+#endif
|
||||
+ fold_text (istream, width, &saved_errno);
|
||||
+
|
||||
if (ferror (istream))
|
||||
{
|
||||
error (0, saved_errno, "%s", quotef (filename));
|
||||
if (STREQ (filename, "-"))
|
||||
clearerr (istream);
|
||||
else if (fclose (istream) != 0 && !saved_errno)
|
||||
@@ -252,7 +499,8 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
@ -454,7 +457,7 @@ index 8cd0d6b..d23edd5 100644
|
||||
|
||||
case 's': /* Break at word boundaries. */
|
||||
diff --git a/src/join.c b/src/join.c
|
||||
index 98b461c..9990f38 100644
|
||||
index f22ffda..ad5dc0d 100644
|
||||
--- a/src/join.c
|
||||
+++ b/src/join.c
|
||||
@@ -22,19 +22,33 @@
|
||||
@ -947,7 +950,7 @@ index 98b461c..9990f38 100644
|
||||
break;
|
||||
|
||||
diff --git a/src/pr.c b/src/pr.c
|
||||
index 26f221f..633f50e 100644
|
||||
index 8f84d0f..4bb5195 100644
|
||||
--- a/src/pr.c
|
||||
+++ b/src/pr.c
|
||||
@@ -311,6 +311,24 @@
|
||||
@ -1017,8 +1020,8 @@ index 26f221f..633f50e 100644
|
||||
static bool print_page (void);
|
||||
static bool print_stored (COLUMN *p);
|
||||
@@ -429,6 +472,7 @@ static void add_line_number (COLUMN *p);
|
||||
static void getoptnum (const char *n_str, int min, int *num,
|
||||
const char *errfmt);
|
||||
static void getoptnum (char const *n_str, int min, int *num,
|
||||
char const *errfmt);
|
||||
static void getoptarg (char *arg, char switch_char, char *character,
|
||||
+ int *character_length, int *character_width,
|
||||
int *number);
|
||||
@ -1031,7 +1034,7 @@ index 26f221f..633f50e 100644
|
||||
-static void print_char (char c);
|
||||
static void cleanup (void);
|
||||
static void print_sep_string (void);
|
||||
static void separator_string (const char *optarg_S);
|
||||
static void separator_string (char const *optarg_S);
|
||||
@@ -454,7 +497,7 @@ static COLUMN *column_vector;
|
||||
we store the leftmost columns contiguously in buff.
|
||||
To print a line from buff, get the index of the first character
|
||||
@ -1085,7 +1088,7 @@ index 26f221f..633f50e 100644
|
||||
static char *column_separator = (char *) " ";
|
||||
static char *line_separator = (char *) "\t";
|
||||
|
||||
@@ -852,6 +905,13 @@ separator_string (const char *optarg_S)
|
||||
@@ -852,6 +905,13 @@ separator_string (char const *optarg_S)
|
||||
integer_overflow ();
|
||||
col_sep_length = len;
|
||||
col_sep_string = optarg_S;
|
||||
@ -1170,7 +1173,7 @@ index 26f221f..633f50e 100644
|
||||
use_col_separator = true;
|
||||
if (optarg)
|
||||
separator_string (optarg);
|
||||
@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
|
||||
@@ -1166,10 +1250,45 @@ getoptnum (char const *n_str, int min, int *num, char const *err)
|
||||
a number. */
|
||||
|
||||
static void
|
||||
@ -1239,7 +1242,7 @@ index 26f221f..633f50e 100644
|
||||
use_col_separator = true;
|
||||
}
|
||||
/* It's rather pointless to define a TAB separator with column
|
||||
@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files)
|
||||
@@ -1260,11 +1384,11 @@ init_parameters (int number_of_files)
|
||||
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
|
||||
|
||||
/* Estimate chars_per_text without any margin and keep it constant. */
|
||||
@ -1253,7 +1256,7 @@ index 26f221f..633f50e 100644
|
||||
|
||||
/* The number is part of the column width unless we are
|
||||
printing files in parallel. */
|
||||
@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files)
|
||||
@@ -1273,7 +1397,7 @@ init_parameters (int number_of_files)
|
||||
}
|
||||
|
||||
int sep_chars, useful_chars;
|
||||
@ -1262,7 +1265,7 @@ index 26f221f..633f50e 100644
|
||||
sep_chars = INT_MAX;
|
||||
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
|
||||
&useful_chars))
|
||||
@@ -1294,7 +1418,7 @@ init_parameters (int number_of_files)
|
||||
@@ -1296,7 +1420,7 @@ init_parameters (int number_of_files)
|
||||
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
|
||||
to expand a tab which is not an input_tab-char. */
|
||||
free (clump_buff);
|
||||
@ -1271,7 +1274,7 @@ index 26f221f..633f50e 100644
|
||||
}
|
||||
|
||||
/* Open the necessary files,
|
||||
@@ -1400,7 +1524,7 @@ init_funcs (void)
|
||||
@@ -1402,7 +1526,7 @@ init_funcs (void)
|
||||
|
||||
/* Enlarge p->start_position of first column to use the same form of
|
||||
padding_not_printed with all columns. */
|
||||
@ -1280,7 +1283,7 @@ index 26f221f..633f50e 100644
|
||||
|
||||
/* This loop takes care of all but the rightmost column. */
|
||||
|
||||
@@ -1434,7 +1558,7 @@ init_funcs (void)
|
||||
@@ -1436,7 +1560,7 @@ init_funcs (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1289,7 +1292,7 @@ index 26f221f..633f50e 100644
|
||||
h_next = h + chars_per_column;
|
||||
}
|
||||
}
|
||||
@@ -1725,9 +1849,9 @@ static void
|
||||
@@ -1733,9 +1857,9 @@ static void
|
||||
align_column (COLUMN *p)
|
||||
{
|
||||
padding_not_printed = p->start_position;
|
||||
@ -1301,7 +1304,7 @@ index 26f221f..633f50e 100644
|
||||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2002,13 +2126,13 @@ store_char (char c)
|
||||
@@ -2010,13 +2134,13 @@ store_char (char c)
|
||||
/* May be too generous. */
|
||||
buff = X2REALLOC (buff, &buff_allocated);
|
||||
}
|
||||
@ -1317,7 +1320,7 @@ index 26f221f..633f50e 100644
|
||||
char *s;
|
||||
int num_width;
|
||||
|
||||
@@ -2025,22 +2149,24 @@ add_line_number (COLUMN *p)
|
||||
@@ -2033,22 +2157,24 @@ add_line_number (COLUMN *p)
|
||||
/* Tabification is assumed for multiple columns, also for n-separators,
|
||||
but 'default n-separator = TAB' hasn't been given priority over
|
||||
equal column_width also specified by POSIX. */
|
||||
@ -1346,7 +1349,7 @@ index 26f221f..633f50e 100644
|
||||
output_position = POS_AFTER_TAB (chars_per_output_tab,
|
||||
output_position);
|
||||
}
|
||||
@@ -2199,7 +2325,7 @@ print_white_space (void)
|
||||
@@ -2207,7 +2333,7 @@ print_white_space (void)
|
||||
while (goal - h_old > 1
|
||||
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
||||
{
|
||||
@ -1355,7 +1358,7 @@ index 26f221f..633f50e 100644
|
||||
h_old = h_new;
|
||||
}
|
||||
while (++h_old <= goal)
|
||||
@@ -2219,6 +2345,7 @@ print_sep_string (void)
|
||||
@@ -2227,6 +2353,7 @@ print_sep_string (void)
|
||||
{
|
||||
char const *s = col_sep_string;
|
||||
int l = col_sep_length;
|
||||
@ -1363,7 +1366,7 @@ index 26f221f..633f50e 100644
|
||||
|
||||
if (separators_not_printed <= 0)
|
||||
{
|
||||
@@ -2230,6 +2357,7 @@ print_sep_string (void)
|
||||
@@ -2238,6 +2365,7 @@ print_sep_string (void)
|
||||
{
|
||||
for (; separators_not_printed > 0; --separators_not_printed)
|
||||
{
|
||||
@ -1371,7 +1374,7 @@ index 26f221f..633f50e 100644
|
||||
while (l-- > 0)
|
||||
{
|
||||
/* 3 types of sep_strings: spaces only, spaces and chars,
|
||||
@@ -2243,12 +2371,15 @@ print_sep_string (void)
|
||||
@@ -2251,12 +2379,15 @@ print_sep_string (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1388,7 +1391,7 @@ index 26f221f..633f50e 100644
|
||||
/* sep_string ends with some spaces */
|
||||
if (spaces_not_printed > 0)
|
||||
print_white_space ();
|
||||
@@ -2276,7 +2407,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
||||
@@ -2284,7 +2415,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
||||
required number of tabs and spaces. */
|
||||
|
||||
static void
|
||||
@ -1397,7 +1400,7 @@ index 26f221f..633f50e 100644
|
||||
{
|
||||
if (tabify_output)
|
||||
{
|
||||
@@ -2300,6 +2431,74 @@ print_char (char c)
|
||||
@@ -2308,6 +2439,74 @@ print_char (char c)
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
@ -1472,7 +1475,7 @@ index 26f221f..633f50e 100644
|
||||
/* Skip to page PAGE before printing.
|
||||
PAGE may be larger than total number of pages. */
|
||||
|
||||
@@ -2477,9 +2676,9 @@ read_line (COLUMN *p)
|
||||
@@ -2485,9 +2684,9 @@ read_line (COLUMN *p)
|
||||
align_empty_cols = false;
|
||||
}
|
||||
|
||||
@ -1484,7 +1487,7 @@ index 26f221f..633f50e 100644
|
||||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2548,7 +2747,7 @@ print_stored (COLUMN *p)
|
||||
@@ -2556,7 +2755,7 @@ print_stored (COLUMN *p)
|
||||
COLUMN *q;
|
||||
|
||||
int line = p->current_line++;
|
||||
@ -1493,7 +1496,7 @@ index 26f221f..633f50e 100644
|
||||
/* FIXME
|
||||
UMR: Uninitialized memory read:
|
||||
* This is occurring while in:
|
||||
@@ -2560,7 +2759,7 @@ print_stored (COLUMN *p)
|
||||
@@ -2568,7 +2767,7 @@ print_stored (COLUMN *p)
|
||||
xmalloc [xmalloc.c:94]
|
||||
init_store_cols [pr.c:1648]
|
||||
*/
|
||||
@ -1502,7 +1505,7 @@ index 26f221f..633f50e 100644
|
||||
|
||||
pad_vertically = true;
|
||||
|
||||
@@ -2580,9 +2779,9 @@ print_stored (COLUMN *p)
|
||||
@@ -2588,9 +2787,9 @@ print_stored (COLUMN *p)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1514,7 +1517,7 @@ index 26f221f..633f50e 100644
|
||||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2595,8 +2794,8 @@ print_stored (COLUMN *p)
|
||||
@@ -2603,8 +2802,8 @@ print_stored (COLUMN *p)
|
||||
if (spaces_not_printed == 0)
|
||||
{
|
||||
output_position = p->start_position + end_vector[line];
|
||||
@ -1525,7 +1528,7 @@ index 26f221f..633f50e 100644
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2615,7 +2814,7 @@ print_stored (COLUMN *p)
|
||||
@@ -2623,7 +2822,7 @@ print_stored (COLUMN *p)
|
||||
number of characters is 1.) */
|
||||
|
||||
static int
|
||||
@ -1534,7 +1537,7 @@ index 26f221f..633f50e 100644
|
||||
{
|
||||
unsigned char uc = c;
|
||||
char *s = clump_buff;
|
||||
@@ -2625,10 +2824,10 @@ char_to_clump (char c)
|
||||
@@ -2633,10 +2832,10 @@ char_to_clump (char c)
|
||||
int chars;
|
||||
int chars_per_c = 8;
|
||||
|
||||
@ -1547,7 +1550,7 @@ index 26f221f..633f50e 100644
|
||||
{
|
||||
width = TAB_WIDTH (chars_per_c, input_position);
|
||||
|
||||
@@ -2709,6 +2908,164 @@ char_to_clump (char c)
|
||||
@@ -2717,6 +2916,164 @@ char_to_clump (char c)
|
||||
return chars;
|
||||
}
|
||||
|
||||
@ -1713,7 +1716,7 @@ index 26f221f..633f50e 100644
|
||||
looking for more options and printing the next batch of files.
|
||||
|
||||
diff --git a/src/sort.c b/src/sort.c
|
||||
index 6d2eec5..f189a0d 100644
|
||||
index 5f4c817..f631704 100644
|
||||
--- a/src/sort.c
|
||||
+++ b/src/sort.c
|
||||
@@ -29,6 +29,14 @@
|
||||
@ -1836,7 +1839,7 @@ index 6d2eec5..f189a0d 100644
|
||||
/* Clean up any remaining temporary files. */
|
||||
|
||||
static void
|
||||
@@ -1270,7 +1341,7 @@ zaptemp (char const *name)
|
||||
@@ -1269,7 +1340,7 @@ zaptemp (char const *name)
|
||||
free (node);
|
||||
}
|
||||
|
||||
@ -1845,7 +1848,7 @@ index 6d2eec5..f189a0d 100644
|
||||
|
||||
static int
|
||||
struct_month_cmp (void const *m1, void const *m2)
|
||||
@@ -1285,7 +1356,7 @@ struct_month_cmp (void const *m1, void const *m2)
|
||||
@@ -1284,7 +1355,7 @@ struct_month_cmp (void const *m1, void const *m2)
|
||||
/* Initialize the character class tables. */
|
||||
|
||||
static void
|
||||
@ -1854,7 +1857,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -1297,7 +1368,7 @@ inittables (void)
|
||||
@@ -1296,7 +1367,7 @@ inittables (void)
|
||||
fold_toupper[i] = toupper (i);
|
||||
}
|
||||
|
||||
@ -1863,7 +1866,7 @@ index 6d2eec5..f189a0d 100644
|
||||
/* If we're not in the "C" locale, read different names for months. */
|
||||
if (hard_LC_TIME)
|
||||
{
|
||||
@@ -1379,6 +1450,84 @@ specify_nmerge (int oi, char c, char const *s)
|
||||
@@ -1378,6 +1449,84 @@ specify_nmerge (int oi, char c, char const *s)
|
||||
xstrtol_fatal (e, oi, c, long_options, s);
|
||||
}
|
||||
|
||||
@ -1948,7 +1951,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)
|
||||
@@ -1610,7 +1759,7 @@ buffer_linelim (struct buffer const *buf)
|
||||
@@ -1609,7 +1758,7 @@ buffer_linelim (struct buffer const *buf)
|
||||
by KEY in LINE. */
|
||||
|
||||
static char *
|
||||
@ -1957,7 +1960,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
size_t sword = key->sword;
|
||||
@@ -1619,10 +1768,10 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1618,10 +1767,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 +1973,7 @@ index 6d2eec5..f189a0d 100644
|
||||
++ptr;
|
||||
if (ptr < lim)
|
||||
++ptr;
|
||||
@@ -1648,11 +1797,70 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1647,11 +1796,70 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -2036,13 +2039,13 @@ index 6d2eec5..f189a0d 100644
|
||||
/* Return the limit of (a pointer to the first character after) the field
|
||||
in LINE specified by KEY. */
|
||||
|
||||
static char *
|
||||
static char * _GL_ATTRIBUTE_PURE
|
||||
-limfield (struct line const *line, struct keyfield const *key)
|
||||
+limfield_uni (const struct line *line, const struct keyfield *key)
|
||||
+limfield_uni (struct line const *line, struct keyfield const *key)
|
||||
{
|
||||
char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
size_t eword = key->eword, echar = key->echar;
|
||||
@@ -1667,10 +1875,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1666,10 +1874,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 +2058,7 @@ index 6d2eec5..f189a0d 100644
|
||||
++ptr;
|
||||
if (ptr < lim && (eword || echar))
|
||||
++ptr;
|
||||
@@ -1716,10 +1924,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1715,10 +1923,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 +2071,7 @@ index 6d2eec5..f189a0d 100644
|
||||
if (newlim)
|
||||
lim = newlim;
|
||||
}
|
||||
@@ -1750,6 +1958,130 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1749,6 +1957,130 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -2199,7 +2202,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
|
||||
@@ -1836,8 +2168,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
|
||||
@@ -1835,8 +2167,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
|
||||
else
|
||||
{
|
||||
if (key->skipsblanks)
|
||||
@ -2224,7 +2227,7 @@ index 6d2eec5..f189a0d 100644
|
||||
line->keybeg = line_start;
|
||||
}
|
||||
}
|
||||
@@ -1987,7 +2333,7 @@ human_numcompare (char const *a, char const *b)
|
||||
@@ -1986,7 +2332,7 @@ human_numcompare (char const *a, char const *b)
|
||||
hideously fast. */
|
||||
|
||||
static int
|
||||
@ -2233,7 +2236,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
while (blanks[to_uchar (*a)])
|
||||
a++;
|
||||
@@ -1997,6 +2343,25 @@ numcompare (char const *a, char const *b)
|
||||
@@ -1996,6 +2342,25 @@ numcompare (char const *a, char const *b)
|
||||
return strnumcmp (a, b, decimal_point, thousands_sep);
|
||||
}
|
||||
|
||||
@ -2259,7 +2262,7 @@ 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 if
|
||||
@@ -2047,7 +2412,7 @@ general_numcompare (char const *sa, char const *sb)
|
||||
@@ -2046,7 +2411,7 @@ general_numcompare (char const *sa, char const *sb)
|
||||
Return 0 if the name in S is not recognized. */
|
||||
|
||||
static int
|
||||
@ -2268,7 +2271,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
size_t lo = 0;
|
||||
size_t hi = MONTHS_PER_YEAR;
|
||||
@@ -2323,15 +2688,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
||||
@@ -2322,15 +2687,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
||||
char saved = *lim;
|
||||
*lim = '\0';
|
||||
|
||||
@ -2286,7 +2289,7 @@ index 6d2eec5..f189a0d 100644
|
||||
else if (key->general_numeric)
|
||||
ignore_value (strtold (beg, &tighter_lim));
|
||||
else if (key->numeric || key->human_numeric)
|
||||
@@ -2465,7 +2829,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
@@ -2464,7 +2828,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 +2298,7 @@ index 6d2eec5..f189a0d 100644
|
||||
&& ((!key->skipsblanks && !implicit_skip)
|
||||
|| (!key->skipsblanks && key->schar)
|
||||
|| (!key->skipeblanks && key->echar)))
|
||||
@@ -2523,11 +2887,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
@@ -2522,11 +2886,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
error (0, 0, _("option '-r' only applies to last-resort comparison"));
|
||||
}
|
||||
|
||||
@ -2384,7 +2387,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
struct keyfield *key = keylist;
|
||||
|
||||
@@ -2612,7 +3052,7 @@ keycompare (struct line const *a, struct line const *b)
|
||||
@@ -2611,7 +3051,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 +2396,7 @@ index 6d2eec5..f189a0d 100644
|
||||
else if (key->random)
|
||||
diff = compare_random (ta, tlena, tb, tlenb);
|
||||
else if (key->version)
|
||||
@@ -2728,6 +3168,211 @@ keycompare (struct line const *a, struct line const *b)
|
||||
@@ -2727,6 +3167,211 @@ keycompare (struct line const *a, struct line const *b)
|
||||
return key->reverse ? -diff : diff;
|
||||
}
|
||||
|
||||
@ -2605,7 +2608,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. */
|
||||
|
||||
@@ -2755,7 +3400,7 @@ compare (struct line const *a, struct line const *b)
|
||||
@@ -2754,7 +3399,7 @@ compare (struct line const *a, struct line const *b)
|
||||
diff = - NONZERO (blen);
|
||||
else if (blen == 0)
|
||||
diff = 1;
|
||||
@ -2614,7 +2617,7 @@ index 6d2eec5..f189a0d 100644
|
||||
{
|
||||
/* xmemcoll0 is a performance enhancement as
|
||||
it will not unconditionally write '\0' after the
|
||||
@@ -4145,6 +4790,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
||||
@@ -4144,6 +4789,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
||||
break;
|
||||
case 'f':
|
||||
key->translate = fold_toupper;
|
||||
@ -2622,7 +2625,7 @@ index 6d2eec5..f189a0d 100644
|
||||
break;
|
||||
case 'g':
|
||||
key->general_numeric = true;
|
||||
@@ -4224,7 +4870,7 @@ main (int argc, char **argv)
|
||||
@@ -4223,7 +4869,7 @@ main (int argc, char **argv)
|
||||
initialize_exit_failure (SORT_FAILURE);
|
||||
|
||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||
@ -2631,7 +2634,7 @@ index 6d2eec5..f189a0d 100644
|
||||
hard_LC_TIME = hard_locale (LC_TIME);
|
||||
#endif
|
||||
|
||||
@@ -4245,6 +4891,29 @@ main (int argc, char **argv)
|
||||
@@ -4244,6 +4890,29 @@ main (int argc, char **argv)
|
||||
thousands_sep = -1;
|
||||
}
|
||||
|
||||
@ -2661,7 +2664,7 @@ index 6d2eec5..f189a0d 100644
|
||||
have_read_stdin = false;
|
||||
inittables ();
|
||||
|
||||
@@ -4519,13 +5188,34 @@ main (int argc, char **argv)
|
||||
@@ -4518,13 +5187,34 @@ main (int argc, char **argv)
|
||||
|
||||
case 't':
|
||||
{
|
||||
@ -2700,7 +2703,7 @@ index 6d2eec5..f189a0d 100644
|
||||
else
|
||||
{
|
||||
/* Provoke with 'sort -txx'. Complain about
|
||||
@@ -4536,9 +5226,11 @@ main (int argc, char **argv)
|
||||
@@ -4535,9 +5225,11 @@ main (int argc, char **argv)
|
||||
quote (optarg));
|
||||
}
|
||||
}
|
||||
@ -2714,7 +2717,7 @@ index 6d2eec5..f189a0d 100644
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4767,12 +5459,10 @@ main (int argc, char **argv)
|
||||
@@ -4766,12 +5458,10 @@ main (int argc, char **argv)
|
||||
sort (files, nfiles, outfile, nthreads);
|
||||
}
|
||||
|
||||
@ -2728,7 +2731,7 @@ index 6d2eec5..f189a0d 100644
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
sort_die (_("close failed"), "-");
|
||||
diff --git a/src/uniq.c b/src/uniq.c
|
||||
index 87a0c93..9f755d9 100644
|
||||
index 8f6e973..752797a 100644
|
||||
--- a/src/uniq.c
|
||||
+++ b/src/uniq.c
|
||||
@@ -21,6 +21,17 @@
|
||||
@ -2928,10 +2931,10 @@ index 0000000..26c95de
|
||||
+
|
||||
+Exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 568944e..192f776 100644
|
||||
index 228d0e3..b98694b 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -369,6 +369,8 @@ all_tests = \
|
||||
@@ -375,6 +375,8 @@ all_tests = \
|
||||
tests/misc/sort-discrim.sh \
|
||||
tests/misc/sort-files0-from.pl \
|
||||
tests/misc/sort-float.sh \
|
||||
@ -2941,7 +2944,7 @@ index 568944e..192f776 100644
|
||||
tests/misc/sort-merge.pl \
|
||||
tests/misc/sort-merge-fdlimit.sh \
|
||||
diff --git a/tests/misc/expand.pl b/tests/misc/expand.pl
|
||||
index 8a9cad1..9293e39 100755
|
||||
index a10ff19..e1706c1 100755
|
||||
--- a/tests/misc/expand.pl
|
||||
+++ b/tests/misc/expand.pl
|
||||
@@ -27,6 +27,15 @@ my $prog = 'expand';
|
||||
@ -3008,7 +3011,7 @@ index 8a9cad1..9293e39 100755
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
diff --git a/tests/misc/fold.pl b/tests/misc/fold.pl
|
||||
index 7b192b4..76f073f 100755
|
||||
index beacec9..b56afca 100755
|
||||
--- a/tests/misc/fold.pl
|
||||
+++ b/tests/misc/fold.pl
|
||||
@@ -20,9 +20,18 @@ use strict;
|
||||
@ -3081,7 +3084,7 @@ index 7b192b4..76f073f 100755
|
||||
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
||||
exit $fail;
|
||||
diff --git a/tests/misc/join.pl b/tests/misc/join.pl
|
||||
index 4d399d8..07f2823 100755
|
||||
index bfd9e6f..75788c9 100755
|
||||
--- a/tests/misc/join.pl
|
||||
+++ b/tests/misc/join.pl
|
||||
@@ -25,6 +25,15 @@ my $limits = getlimits ();
|
||||
@ -3202,7 +3205,7 @@ index 0000000..11836ba
|
||||
+
|
||||
+Exit $fail
|
||||
diff --git a/tests/misc/sort-merge.pl b/tests/misc/sort-merge.pl
|
||||
index 23f6ed2..402a987 100755
|
||||
index 70d8af1..6b4840a 100755
|
||||
--- a/tests/misc/sort-merge.pl
|
||||
+++ b/tests/misc/sort-merge.pl
|
||||
@@ -26,6 +26,15 @@ my $prog = 'sort';
|
||||
@ -3262,7 +3265,7 @@ index 23f6ed2..402a987 100755
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
diff --git a/tests/misc/sort.pl b/tests/misc/sort.pl
|
||||
index c3e7f8e..6ecd3ff 100755
|
||||
index 86970ff..c016ff7 100755
|
||||
--- a/tests/misc/sort.pl
|
||||
+++ b/tests/misc/sort.pl
|
||||
@@ -24,10 +24,15 @@ my $prog = 'sort';
|
||||
@ -3330,7 +3333,7 @@ index c3e7f8e..6ecd3ff 100755
|
||||
my $save_temps = $ENV{DEBUG};
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
diff --git a/tests/misc/unexpand.pl b/tests/misc/unexpand.pl
|
||||
index 6ba6d40..de86723 100755
|
||||
index 1c8e308..9f8ab89 100755
|
||||
--- a/tests/misc/unexpand.pl
|
||||
+++ b/tests/misc/unexpand.pl
|
||||
@@ -27,6 +27,14 @@ my $limits = getlimits ();
|
||||
@ -3387,7 +3390,7 @@ index 6ba6d40..de86723 100755
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
diff --git a/tests/misc/uniq.pl b/tests/misc/uniq.pl
|
||||
index f028036..8eaf59a 100755
|
||||
index 74d3815..aae4c7e 100755
|
||||
--- a/tests/misc/uniq.pl
|
||||
+++ b/tests/misc/uniq.pl
|
||||
@@ -23,9 +23,17 @@ my $limits = getlimits ();
|
||||
@ -3463,7 +3466,7 @@ index f028036..8eaf59a 100755
|
||||
@Tests = triple_test \@Tests;
|
||||
|
||||
diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
|
||||
index ec3980a..136657d 100755
|
||||
index d0ac405..ff7d472 100755
|
||||
--- a/tests/pr/pr-tests.pl
|
||||
+++ b/tests/pr/pr-tests.pl
|
||||
@@ -24,6 +24,15 @@ use strict;
|
||||
@ -3482,9 +3485,9 @@ index ec3980a..136657d 100755
|
||||
my @tv = (
|
||||
|
||||
# -b option is no longer an official option. But it's still working to
|
||||
@@ -474,8 +483,48 @@ push @Tests,
|
||||
{IN=>{2=>"a\n"}},
|
||||
{OUT=>"a\t\t\t\t \t\t\ta\n"} ];
|
||||
@@ -512,8 +521,48 @@ push @Tests,
|
||||
{IN=>"x\tx\tx\tx\tx\nx\tx\tx\tx\tx\n"},
|
||||
{OUT=>"x\tx\tx\tx\tx\tx\tx\tx\tx\tx\n"} ];
|
||||
|
||||
+# Add _POSIX2_VERSION=199209 to the environment of each test
|
||||
+# that uses an old-style option like +1.
|
||||
@ -3532,5 +3535,5 @@ index ec3980a..136657d 100755
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
--
|
||||
2.7.4
|
||||
2.31.1
|
||||
|
||||
|
@ -1,3 +1,32 @@
|
||||
From d70ddb3eb845c494280e7365e2b889242e7e1bb9 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Mon, 4 Oct 2021 08:45:53 +0200
|
||||
Subject: [PATCH] coreutils-selinux.patch
|
||||
|
||||
---
|
||||
doc/coreutils.texi | 5 +++++
|
||||
man/chcon.x | 2 +-
|
||||
man/runcon.x | 2 +-
|
||||
src/cp.c | 16 +++++++++++++++-
|
||||
src/install.c | 10 ++++++++--
|
||||
5 files changed, 30 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 6810c15..19b535c 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -8766,6 +8766,11 @@ done
|
||||
exit $fail
|
||||
@end example
|
||||
|
||||
+@item -c
|
||||
+@cindex SELinux security context information, preserving
|
||||
+Preserve SELinux security context of the original files if possible.
|
||||
+Some file systems don't support storing of SELinux security context.
|
||||
+
|
||||
@item --copy-contents
|
||||
@cindex directories, copying recursively
|
||||
@cindex copying directories recursively
|
||||
diff --git a/man/chcon.x b/man/chcon.x
|
||||
index 8c1ff6f..c84fb96 100644
|
||||
--- a/man/chcon.x
|
||||
@ -20,20 +49,20 @@ index d2df13e..5c5f5d8 100644
|
||||
Run COMMAND with completely-specified CONTEXT, or with current or
|
||||
transitioned security context modified by one or more of LEVEL,
|
||||
diff --git a/src/cp.c b/src/cp.c
|
||||
index 1b528c6..25dbb88 100644
|
||||
index c97a675..89fb8ec 100644
|
||||
--- a/src/cp.c
|
||||
+++ b/src/cp.c
|
||||
@@ -203,6 +203,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
@@ -191,6 +191,9 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
|
||||
additional attributes: context, links, xattr,\
|
||||
\n\
|
||||
all\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
+ -c deprecated, same as --preserve=context\n\
|
||||
+"), stdout);
|
||||
+ fputs (_("\
|
||||
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
|
||||
--parents use full source file name under DIRECTORY\n\
|
||||
+ -c deprecated, same as --preserve=context\n\
|
||||
"), stdout);
|
||||
@@ -929,7 +932,7 @@ main (int argc, char **argv)
|
||||
fputs (_("\
|
||||
--no-preserve=ATTR_LIST don't preserve the specified attributes\n\
|
||||
@@ -954,7 +957,7 @@ main (int argc, char **argv)
|
||||
selinux_enabled = (0 < is_selinux_enabled ());
|
||||
cp_option_init (&x);
|
||||
|
||||
@ -42,7 +71,7 @@ index 1b528c6..25dbb88 100644
|
||||
long_opts, NULL))
|
||||
!= -1)
|
||||
{
|
||||
@@ -977,6 +980,17 @@ main (int argc, char **argv)
|
||||
@@ -1002,6 +1005,17 @@ main (int argc, char **argv)
|
||||
copy_contents = true;
|
||||
break;
|
||||
|
||||
@ -60,27 +89,11 @@ index 1b528c6..25dbb88 100644
|
||||
case 'd':
|
||||
x.preserve_links = true;
|
||||
x.dereference = DEREF_NEVER;
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 47e4480..cff2ead 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -8083,6 +8083,11 @@ done
|
||||
exit $fail
|
||||
@end example
|
||||
|
||||
+@item -c
|
||||
+@cindex SELinux security context information, preserving
|
||||
+Preserve SELinux security context of the original files if possible.
|
||||
+Some file systems don't support storing of SELinux security context.
|
||||
+
|
||||
@item --copy-contents
|
||||
@cindex directories, copying recursively
|
||||
@cindex copying directories recursively
|
||||
diff --git a/src/install.c b/src/install.c
|
||||
index d79d597..437889a 100644
|
||||
index c9456fe..2b1bee9 100644
|
||||
--- a/src/install.c
|
||||
+++ b/src/install.c
|
||||
@@ -673,7 +673,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
|
||||
@@ -638,7 +638,7 @@ In the 4th form, create all components of the given DIRECTORY(ies).\n\
|
||||
-v, --verbose print the name of each directory as it is created\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
@ -89,7 +102,7 @@ index d79d597..437889a 100644
|
||||
-Z set SELinux security context of destination\n\
|
||||
file and each created directory to default type\n\
|
||||
--context[=CTX] like -Z, or if CTX is specified then set the\n\
|
||||
@@ -824,7 +824,7 @@ main (int argc, char **argv)
|
||||
@@ -790,7 +790,7 @@ main (int argc, char **argv)
|
||||
dir_arg = false;
|
||||
umask (0);
|
||||
|
||||
@ -98,7 +111,7 @@ index d79d597..437889a 100644
|
||||
NULL)) != -1)
|
||||
{
|
||||
switch (optc)
|
||||
@@ -885,6 +885,8 @@ main (int argc, char **argv)
|
||||
@@ -851,6 +851,8 @@ main (int argc, char **argv)
|
||||
no_target_directory = true;
|
||||
break;
|
||||
|
||||
@ -107,7 +120,7 @@ index d79d597..437889a 100644
|
||||
case PRESERVE_CONTEXT_OPTION:
|
||||
if (! selinux_enabled)
|
||||
{
|
||||
@@ -892,6 +894,10 @@ main (int argc, char **argv)
|
||||
@@ -858,6 +860,10 @@ main (int argc, char **argv)
|
||||
"this kernel is not SELinux-enabled"));
|
||||
break;
|
||||
}
|
||||
@ -118,3 +131,6 @@ index d79d597..437889a 100644
|
||||
x.preserve_security_context = true;
|
||||
use_default_selinux_context = false;
|
||||
break;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Name: coreutils
|
||||
Version: 8.32
|
||||
Release: 32%{?dist}
|
||||
Version: 9.0
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3+
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
||||
@ -17,57 +17,6 @@ Source106: coreutils-colorls.csh
|
||||
# do not make coreutils-single depend on /usr/bin/coreutils
|
||||
%global __requires_exclude ^%{_bindir}/coreutils$
|
||||
|
||||
# ls: restore 8.31 behavior on removed directories
|
||||
Patch1: coreutils-8.32-ls-removed-dir.patch
|
||||
|
||||
# du: simplify leaf optimization for XFS (#1823247)
|
||||
Patch2: coreutils-8.32-leaf-opt-xfs.patch
|
||||
|
||||
# cp: default to --reflink=auto (#1861108)
|
||||
Patch3: coreutils-8.32-cp-reflink-auto.patch
|
||||
|
||||
# eliminate unportable gnulib tests
|
||||
Patch4: coreutils-8.32-gnulib-perror-test.patch
|
||||
|
||||
# df,stat,tail: recognize more file system types
|
||||
Patch5: coreutils-8.32-new-fs-types.patch
|
||||
|
||||
# rm: do not skip files upon failure to remove an empty dir (#1905481)
|
||||
Patch6: coreutils-8.32-rm-stray-skip.patch
|
||||
|
||||
# expr: fix invalid read with unmatched \(...\) (#1919775)
|
||||
Patch7: coreutils-8.32-expr-unmatched-par.patch
|
||||
|
||||
# split: fix --number=K/N to output correct part of file (#1921246)
|
||||
Patch8: coreutils-8.32-split-number.patch
|
||||
|
||||
# ls: fix crash printing SELinux context for unstatable files (#1921249)
|
||||
Patch9: coreutils-8.32-ls-scontext-crash.patch
|
||||
|
||||
# stat: add support for the exfat file system (#1921427)
|
||||
Patch10: coreutils-8.32-stat-exfat.patch
|
||||
|
||||
# cp: use copy_file_range if available
|
||||
Patch11: coreutils-8.32-cp-file-range.patch
|
||||
|
||||
# hostname,ln: fix memory leaks detected by Coverity
|
||||
Patch12: coreutils-8.32-mem-leaks.patch
|
||||
|
||||
# utimens: fix confusing arg type in internal func
|
||||
Patch13: coreutils-8.32-coverity-utimens.patch
|
||||
|
||||
# fix false positives in the upstrem test-suite (#1960792)
|
||||
Patch14: coreutils-8.32-tests-false-positives.patch
|
||||
|
||||
# mountlist: recognize fuse.portal as dummy file system (#1913358)
|
||||
Patch15: coreutils-8.32-fuse-portal.patch
|
||||
|
||||
# tail: fix stack out-of-bounds write with --follow
|
||||
Patch16: coreutils-8.32-tail-use-poll.patch
|
||||
|
||||
# df: fix duplicated remote entries due to bind mounts (#1979814)
|
||||
Patch17: coreutils-8.32-df-duplicated-entries.patch
|
||||
|
||||
# disable the test-lock gnulib test prone to deadlock
|
||||
Patch100: coreutils-8.26-test-lock.patch
|
||||
|
||||
@ -328,6 +277,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
%license COPYING
|
||||
|
||||
%changelog
|
||||
* Sun Sep 26 2021 Kamil Dudka <kdudka@redhat.com> - 9.0-1
|
||||
- new upstream release 9.0
|
||||
|
||||
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com>
|
||||
- Rebuilt with OpenSSL 3.0.0
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (coreutils-8.32.tar.xz) = 1c8f3584efd61b4b02e7ac5db8e103b63cfb2063432caaf1e64cb2dcc56d8c657d1133bbf10bd41468d6a1f31142e6caa81d16ae68fa3e6e84075c253613a145
|
||||
SHA512 (coreutils-9.0.tar.xz) = 9be08212891dbf48e5b22e7689dc27dac50df4631ebf29313470b72b7921f0b2aa5242917d05587785358495ca56e3b21f5b3ca81043d53cab92354da6c53a03
|
||||
|
Loading…
Reference in New Issue
Block a user