Compare commits
10 Commits
2ae65f2dba
...
44e926993d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44e926993d | ||
|
|
ad5eab3f81 | ||
|
|
4238c0bd6a | ||
|
|
faeb32176e | ||
|
|
b8feaebf0f | ||
|
|
d381f47c3f | ||
|
|
c355e9ffd1 | ||
|
|
8a845232a2 | ||
|
|
d580277b47 | ||
|
|
389e7964fe |
52
backport-coverity-utimens.patch
Normal file
52
backport-coverity-utimens.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 6ff2aab365a19fdba9ec7f1c6083f0f9f24b8e03 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Fri, 22 Mar 2024 16:47:50 +0800
|
||||
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.27.0
|
||||
|
||||
51
backport-doc-od-strings-clarify-operation.patch
Normal file
51
backport-doc-od-strings-clarify-operation.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 66ea09b0fecb4fa1e4de78e3738bdbb1442b3f31 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Thu, 8 Jun 2023 10:58:10 +0100
|
||||
Subject: [PATCH] doc: od --strings: clarify operation
|
||||
|
||||
* doc/coreutils.texi (od invocation): Remove mention of ASCII,
|
||||
as all printable characters in unibyte locales are output.
|
||||
* src/od.c (usage): Clarify that only NUL terminated strings
|
||||
are displayed, and that it's printable chars, not only graphic chars
|
||||
that are output. I.e., spaces are output also if part of the string.
|
||||
Reported at https://bugs.ddebian.org/1037217
|
||||
|
||||
Reference:https://github.com/coreutils/coreutils/commit/66ea09b0fecb4fa1e4de78e3738bdbb1442b3f31
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
doc/coreutils.texi | 2 +-
|
||||
src/od.c | 5 ++---
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 6a693e283..e9d7b8eb4 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -2058,7 +2058,7 @@ Output at most @var{bytes} bytes of the input. Prefixes and suffixes on
|
||||
@opindex --strings
|
||||
@cindex string constants, outputting
|
||||
Instead of the normal output, output only @dfn{string constants}: at
|
||||
-least @var{bytes} consecutive ASCII graphic characters,
|
||||
+least @var{bytes} consecutive printable characters,
|
||||
followed by a zero byte (ASCII NUL).
|
||||
Prefixes and suffixes on @var{bytes} are interpreted as for the
|
||||
@option{-j} option.
|
||||
diff --git a/src/od.c b/src/od.c
|
||||
index 10a28e21f..f68407008 100644
|
||||
--- a/src/od.c
|
||||
+++ b/src/od.c
|
||||
@@ -356,9 +356,8 @@ suffixes may be . for octal and b for multiply by 512.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
-N, --read-bytes=BYTES limit dump to BYTES input bytes\n\
|
||||
- -S BYTES, --strings[=BYTES] output strings of at least BYTES graphic chars;\
|
||||
-\n\
|
||||
- 3 is implied when BYTES is not specified\n\
|
||||
+ -S BYTES, --strings[=BYTES] show only NUL terminated strings\n\
|
||||
+ of at least BYTES (3) printable characters\n\
|
||||
-t, --format=TYPE select output format or formats\n\
|
||||
-v, --output-duplicates do not use * to mark line suppression\n\
|
||||
-w[BYTES], --width[=BYTES] output BYTES bytes per output line;\n\
|
||||
--
|
||||
2.27.0
|
||||
81
backport-expr-unmatched-par.patch
Normal file
81
backport-expr-unmatched-par.patch
Normal file
@ -0,0 +1,81 @@
|
||||
From 04002b64fe0e1178bee0762fd5428625f0731d7e Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Fri, 22 Mar 2024 17:20:05 +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 bed55f7..afcc1fa 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -13518,12 +13518,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.27.0
|
||||
|
||||
146
backport-fix-mem-leaks.patch
Normal file
146
backport-fix-mem-leaks.patch
Normal file
@ -0,0 +1,146 @@
|
||||
From e54ab6ec24442eb5414fef414f0ee815efb9a9bb Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Tue, 19 Mar 2024 17:07:52 +0800
|
||||
Subject: [PATCH 1/3] 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.27.0
|
||||
|
||||
|
||||
From e1422d781d0d9da3a92f28d7294a9c8a0e45f25a Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 19 Mar 2024 17:22:26 +0800
|
||||
Subject: [PATCH 2/3] 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.27.0
|
||||
|
||||
|
||||
From 76b29ef9909cc881b99de3dd5c34e90b03385a70 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 19 Mar 2024 17:23:22 +0800
|
||||
Subject: [PATCH 3/3] 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.27.0
|
||||
38
backport-fuse-portal.patch
Normal file
38
backport-fuse-portal.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 330093d8fe5a83d85bb866cf263c671ef737a2be Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Fri, 22 Mar 2024 17:05:28 +0800
|
||||
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 7abe024..189cc81 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.27.0
|
||||
|
||||
64
backport-pr-fix-infinite-loop-when-double-spacing.patch
Normal file
64
backport-pr-fix-infinite-loop-when-double-spacing.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From 3fb0cc80fa5e1cede9ec05303a70c26d0d23ca1d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Tue, 25 Apr 2023 14:07:03 +0100
|
||||
Subject: [PATCH] pr: fix infinite loop when double spacing
|
||||
|
||||
* src/pr.c (init_parameters): Ensure we avoid a 0 lines_per_body
|
||||
which was possible when adjusting for double spacing.
|
||||
That caused print_page() to always return true,
|
||||
causing an infinite loop.
|
||||
* tests/pr/pr-tests.pl: Add a test case.
|
||||
* NEWS: Mention the fix.
|
||||
Fixes https://bugs.debian.org/1034808
|
||||
|
||||
Conflict:NEWS context adaption
|
||||
Reference:https://github.com/coreutils/coreutils/commit/3fb0cc80fa5e1cede9ec05303a70c26d0d23ca1d
|
||||
|
||||
---
|
||||
NEWS | 3 +++
|
||||
src/pr.c | 2 +-
|
||||
tests/pr/pr-tests.pl | 3 +++
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 81f5cf5..d1d0342 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -3,6 +3,8 @@ GNU coreutils NEWS -*- outline -*-
|
||||
* Noteworthy changes in release 8.32 (2020-03-05) [stable]
|
||||
|
||||
** Bug fixes
|
||||
+ 'pr --length=1 --double-space' no longer enters an infinite loop.
|
||||
+ [This bug was present in "the beginning".]
|
||||
|
||||
stat no longer tries to automount files by default, reverting to the
|
||||
behavior before the statx() call was introduced in coreutils-8.32.
|
||||
diff --git a/src/pr.c b/src/pr.c
|
||||
index 2c5cdceb1..14a368b6c 100644
|
||||
--- a/src/pr.c
|
||||
+++ b/src/pr.c
|
||||
@@ -1209,7 +1209,7 @@ init_parameters (int number_of_files)
|
||||
lines_per_body = lines_per_page;
|
||||
|
||||
if (double_space)
|
||||
- lines_per_body = lines_per_body / 2;
|
||||
+ lines_per_body = MAX (1, lines_per_body / 2);
|
||||
|
||||
/* If input is stdin, cannot print parallel files. BSD dumps core
|
||||
on this. */
|
||||
diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
|
||||
index 265e6e108..eafc13d81 100755
|
||||
--- a/tests/pr/pr-tests.pl
|
||||
+++ b/tests/pr/pr-tests.pl
|
||||
@@ -415,6 +415,9 @@ my @tv = (
|
||||
['padding2', '-t -n,64', "1\n", (" "x 63)."1,1\n", 0],
|
||||
# Ensure we handle buffer truncation correctly
|
||||
['padding3', '-t -N1000000 -n,1', "1\n", "0,1\n", 0],
|
||||
+
|
||||
+# This entered an infinite loop before coreutils-9.4
|
||||
+['page-length1', '-dl1', "", "", 0],
|
||||
);
|
||||
|
||||
# Convert the above old-style test vectors to the newer
|
||||
--
|
||||
2.36.1
|
||||
46
backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
Normal file
46
backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 6c9b59a9c20c1422346f74ae3cd558f3317deb6a Mon Sep 17 00:00:00 2001
|
||||
From: Bruno Haible <bruno@clisp.org>
|
||||
Date: Fri, 2 Jun 2023 20:11:36 +0200
|
||||
Subject: [PATCH] setenv: Don't crash if malloc() returns NULL.
|
||||
|
||||
* lib/setenv.c (rpl_setenv): Check malloca() return value.
|
||||
|
||||
Reference:https://github.com/coreutils/gnulib/commit/6c9b59a9c20c1422346f74ae3cd558f3317deb6a
|
||||
Conflict:Changelog Context adaptation
|
||||
|
||||
---
|
||||
ChangeLog | 5 +++++
|
||||
lib/setenv.c | 5 +++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 98cfffd..771b490 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,3 +1,8 @@
|
||||
+2023-06-02 Bruno Haible <bruno@clisp.org>
|
||||
+
|
||||
+ setenv: Don't crash if malloc() returns NULL.
|
||||
+ * lib/setenv.c (rpl_setenv): Check malloca() return value.
|
||||
+
|
||||
2020-03-05 Pádraig Brady <P@draigBrady.com>
|
||||
|
||||
version 8.32
|
||||
diff --git a/lib/setenv.c b/lib/setenv.c
|
||||
index f0b889969f..22b12fd018 100644
|
||||
--- a/lib/setenv.c
|
||||
+++ b/lib/setenv.c
|
||||
@@ -375,6 +375,11 @@ rpl_setenv (const char *name, const char *value, int replace)
|
||||
int saved_errno;
|
||||
size_t len = strlen (value);
|
||||
tmp = malloca (len + 2);
|
||||
+ if (tmp == NULL)
|
||||
+ {
|
||||
+ errno = ENOMEM;
|
||||
+ return -1;
|
||||
+ }
|
||||
/* Since leading '=' is eaten, double it up. */
|
||||
*tmp = '=';
|
||||
memcpy (tmp + 1, value, len + 1);
|
||||
--
|
||||
2.27.0
|
||||
32
backport-sort-don-t-trust-st_size-on-proc-files.patch
Normal file
32
backport-sort-don-t-trust-st_size-on-proc-files.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 8ff3903281e03d36dd1aa2a202a56f38af726d91 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Sat, 6 Apr 2024 15:17:14 -0700
|
||||
Subject: [PATCH] =?UTF-8?q?sort:=20don=E2=80=99t=20trust=20st=5Fsize=20on?=
|
||||
=?UTF-8?q?=20/proc=20files?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Problem and fix reported by Takashi Kusumi in:
|
||||
https://bugs.gnu.org/70231
|
||||
* src/sort.c (sort_buffer_size): Don’t trust st_size == 0.
|
||||
---
|
||||
src/sort.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/sort.c b/src/sort.c
|
||||
index e779845..b983ca2 100644
|
||||
--- a/src/sort.c
|
||||
+++ b/src/sort.c
|
||||
@@ -1538,7 +1538,7 @@ sort_buffer_size (FILE *const *fps, size_t nfps,
|
||||
!= 0)
|
||||
sort_die (_("stat failed"), files[i]);
|
||||
|
||||
- if (S_ISREG (st.st_mode))
|
||||
+ if (usable_st_size (&st) && 0 < st.st_size)
|
||||
file_size = st.st_size;
|
||||
else
|
||||
{
|
||||
--
|
||||
2.27.0
|
||||
|
||||
69
backport-tac-handle-short-reads-on-input.patch
Normal file
69
backport-tac-handle-short-reads-on-input.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From 779f34e180fdcabddb24acc2829410ce8ed50fd1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Mon, 31 Jul 2023 12:41:26 +0100
|
||||
Subject: [PATCH] tac: handle short reads on input
|
||||
|
||||
This can be reproduced by getting the read() above 2G,
|
||||
which induces a short read, thus triggering the erroneous failure.
|
||||
|
||||
$ truncate -s 5G 5G
|
||||
|
||||
$ cat 5G | TMPDIR=$PWD tac | wc -c
|
||||
tac: /tmp/tacFt7txA: read error: Illegal seek
|
||||
0
|
||||
|
||||
With the fix in place we now get:
|
||||
|
||||
$ cat 5G | TMPDIR=$PWD src/tac | wc -c
|
||||
5368709120
|
||||
|
||||
* src/tac.c (tac_seekable): Use full_read() to handle short reads.
|
||||
* NEWS: Mention the bug fix.
|
||||
Reported at https://bugs.debian.org/1042546
|
||||
|
||||
Reference:https://github.com/coreutils/coreutils/commit/779f34e180fdcabddb24acc2829410ce8ed50fd1
|
||||
Conflict:NEWS Context adaptation
|
||||
|
||||
---
|
||||
NEWS | 4 ++++
|
||||
src/tac.c | 3 ++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 7f92559..9d83e88 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -3,6 +3,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
* Noteworthy changes in release 8.32 (2020-03-05) [stable]
|
||||
|
||||
** Bug fixes
|
||||
+ tac now handles short reads on its input. Previously it may have exited
|
||||
+ erroneously, especially with large input files with no separators.
|
||||
+ [This bug was present in "the beginning".]
|
||||
+
|
||||
`wc -c` will again correctly update the read offset of inputs.
|
||||
Previously it deduced the size of inputs while leaving the offset unchanged.
|
||||
[bug introduced in coreutils-8.27]
|
||||
diff --git a/src/tac.c b/src/tac.c
|
||||
index 285f99a74..4c3655895 100644
|
||||
--- a/src/tac.c
|
||||
+++ b/src/tac.c
|
||||
@@ -46,6 +46,7 @@ tac -r -s '.\|
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
#include "filenamecat.h"
|
||||
+#include "full-read.h"
|
||||
#include "safe-read.h"
|
||||
#include "stdlib--.h"
|
||||
#include "xbinary-io.h"
|
||||
@@ -352,7 +353,7 @@ tac_seekable (int input_fd, char const *file, off_t file_pos)
|
||||
else
|
||||
match_start = past_end;
|
||||
|
||||
- if (safe_read (input_fd, G_buffer, read_size) != read_size)
|
||||
+ if (full_read (input_fd, G_buffer, read_size) != read_size)
|
||||
{
|
||||
error (0, errno, _("%s: read error"), quotef (file));
|
||||
return false;
|
||||
--
|
||||
2.27.0
|
||||
74
backport-wc-ensure-we-update-file-offset.patch
Normal file
74
backport-wc-ensure-we-update-file-offset.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From ce630dfc7ef32ff7e35c627bd061a45ce9053d9d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
|
||||
Date: Sun, 5 Feb 2023 19:52:31 +0000
|
||||
Subject: [PATCH] wc: ensure we update file offset
|
||||
|
||||
* src/wc.c (wc): Update the offset when not reading,
|
||||
and do read if we can't update the offset.
|
||||
* tests/misc/wc-proc.sh: Add a test case.
|
||||
* NEWS: Mention the bug fix.
|
||||
Fixes https://bugs.gnu.org/61300
|
||||
|
||||
Conflict:NEWS and tests/misc/wc-proc.sh context adaption
|
||||
Reference:https://github.com/coreutils/coreutils/commit/ce630dfc7ef32ff7e35c627bd061a45ce9053d9d
|
||||
|
||||
---
|
||||
NEWS | 4 ++++
|
||||
src/wc.c | 5 ++++-
|
||||
tests/misc/wc-proc.sh | 12 ++++++++++++
|
||||
3 files changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index d1d0342..7f92559 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -3,6 +3,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
* Noteworthy changes in release 8.32 (2020-03-05) [stable]
|
||||
|
||||
** Bug fixes
|
||||
+ `wc -c` will again correctly update the read offset of inputs.
|
||||
+ Previously it deduced the size of inputs while leaving the offset unchanged.
|
||||
+ [bug introduced in coreutils-8.27]
|
||||
+
|
||||
'pr --length=1 --double-space' no longer enters an infinite loop.
|
||||
[This bug was present in "the beginning".]
|
||||
|
||||
diff --git a/src/wc.c b/src/wc.c
|
||||
index 801396a15..becceda98 100644
|
||||
--- a/src/wc.c
|
||||
+++ b/src/wc.c
|
||||
@@ -450,7 +450,10 @@ wc (int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos)
|
||||
beyond the end of the file. As in the example above. */
|
||||
|
||||
bytes = end_pos < current_pos ? 0 : end_pos - current_pos;
|
||||
- skip_read = true;
|
||||
+ if (bytes && 0 <= lseek (fd, bytes, SEEK_CUR))
|
||||
+ skip_read = true;
|
||||
+ else
|
||||
+ bytes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/tests/misc/wc-proc.sh b/tests/misc/wc-proc.sh
|
||||
index 5eb43b982..2307f2c38 100755
|
||||
--- a/tests/misc/wc-proc.sh
|
||||
+++ b/tests/misc/wc-proc.sh
|
||||
@@ -42,4 +42,16 @@ cat <<\EOF > exp
|
||||
EOF
|
||||
compare exp out || fail=1
|
||||
|
||||
+# Ensure we update the offset even when not reading,
|
||||
+# which wasn't the case from coreutils-8.27 to coreutils-9.2
|
||||
+{ wc -c; wc -c; } < no_read > out || fail=1
|
||||
+{ wc -c; wc -c; } < do_read >> out || fail=1
|
||||
+cat <<\EOF > exp
|
||||
+2
|
||||
+0
|
||||
+1048576
|
||||
+0
|
||||
+EOF
|
||||
+compare exp out || fail=1
|
||||
+
|
||||
Exit $fail
|
||||
--
|
||||
2.36.1
|
||||
48
backport-who-don-t-crash-if-clock-gyrates.patch
Normal file
48
backport-who-don-t-crash-if-clock-gyrates.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 123d03dca47c4d8e0dc896dd8c5732329e6acffe Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Sat, 1 Jul 2023 11:31:41 -0700
|
||||
Subject: [PATCH] =?UTF-8?q?who:=20don=E2=80=99t=20crash=20if=20clock=20gyr?=
|
||||
=?UTF-8?q?ates?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* src/who.c (idle_string): Avoid signed integer overflow
|
||||
if the superuser messes with the clock in bizarre ways.
|
||||
Remove an ‘assume’ that wasn’t correct under this scenario.
|
||||
|
||||
Reference:https://github.com/coreutils/coreutils/commit/123d03dca47c4d8e0dc896dd8c5732329e6acffe
|
||||
Conflict:Context adaptation
|
||||
|
||||
---
|
||||
src/who.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/who.c b/src/who.c
|
||||
index 362408a42..cff1b822b 100644
|
||||
--- a/src/who.c
|
||||
+++ b/src/who.c
|
||||
@@ -189,17 +189,16 @@ idle_string (time_t when, time_t boottime)
|
||||
if (now == TYPE_MINIMUM (time_t))
|
||||
time (&now);
|
||||
|
||||
- if (boottime < when && now - 24 * 60 * 60 < when && when <= now)
|
||||
+ int seconds_idle;
|
||||
+ if (boottime < when && when <= now
|
||||
+ && ! INT_SUBTRACT_WRAPV (now, when, &seconds_idle)
|
||||
+ && seconds_idle < 24 * 60 * 60)
|
||||
{
|
||||
- int seconds_idle = now - when;
|
||||
if (seconds_idle < 60)
|
||||
return " . ";
|
||||
else
|
||||
{
|
||||
static char idle_hhmm[IDLESTR_LEN];
|
||||
- /* FIXME-in-2018: see if this assert is still required in order
|
||||
- to suppress gcc's unwarranted -Wformat-length= warning. */
|
||||
- assert (seconds_idle / (60 * 60) < 24);
|
||||
sprintf (idle_hhmm, "%02d:%02d",
|
||||
seconds_idle / (60 * 60),
|
||||
(seconds_idle % (60 * 60)) / 60);
|
||||
--
|
||||
2.27.0
|
||||
37
backport-who-fix-only-theoretical-overflow.patch
Normal file
37
backport-who-fix-only-theoretical-overflow.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 9cbda6e1f8fdd4d7ffae26edcabceb239ed14ece Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Mon, 31 Jul 2023 11:21:25 -0700
|
||||
Subject: [PATCH] who: fix only-theoretical overflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Change stzncpy’s implementation to match its comment, in the case
|
||||
where SRC + LEN would overflow. This case never happens in coreutils.
|
||||
* src/system.h (stzncpy): Work even if SRC + LEN would overflow.
|
||||
|
||||
Reference:https://github.com/coreutils/coreutils/commit/9cbda6e1f8fdd4d7ffae26edcabceb239ed14ece
|
||||
Conflict:NA
|
||||
|
||||
---
|
||||
src/system.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/system.h b/src/system.h
|
||||
index db1a6773b..2d9c47f48 100644
|
||||
--- a/src/system.h
|
||||
+++ b/src/system.h
|
||||
@@ -781,8 +781,8 @@ write_error (void)
|
||||
static inline char *
|
||||
stzncpy (char *restrict dest, char const *restrict src, size_t len)
|
||||
{
|
||||
- char const *src_end = src + len;
|
||||
- while (src < src_end && *src)
|
||||
+ size_t i;
|
||||
+ for (i = 0; i < len && *src; i++)
|
||||
*dest++ = *src++;
|
||||
*dest = 0;
|
||||
return dest;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: coreutils
|
||||
Version: 8.32
|
||||
Release: 8
|
||||
Release: 13
|
||||
License: GPLv3+
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
@ -40,6 +40,18 @@ Patch22: backport-stat-only-automount-with-cached-never.patch
|
||||
Patch23: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
||||
Patch24: 0001-basenc-fix-bug49741-using-wrong-decoding-buffer-leng.patch
|
||||
Patch25: 0002-cat-with-E-fix-handling-of-r-n-spanning-buffers.patch
|
||||
Patch26: backport-pr-fix-infinite-loop-when-double-spacing.patch
|
||||
Patch27: backport-wc-ensure-we-update-file-offset.patch
|
||||
Patch28: backport-who-fix-only-theoretical-overflow.patch
|
||||
Patch29: backport-tac-handle-short-reads-on-input.patch
|
||||
Patch30: backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
|
||||
Patch31: backport-who-don-t-crash-if-clock-gyrates.patch
|
||||
Patch32: backport-doc-od-strings-clarify-operation.patch
|
||||
Patch33: backport-fix-mem-leaks.patch
|
||||
Patch34: backport-coverity-utimens.patch
|
||||
Patch35: backport-fuse-portal.patch
|
||||
Patch36: backport-expr-unmatched-par.patch
|
||||
Patch37: backport-sort-don-t-trust-st_size-on-proc-files.patch
|
||||
|
||||
Conflicts: filesystem < 3
|
||||
# To avoid clobbering installs
|
||||
@ -158,6 +170,32 @@ fi
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Thu Jun 13 2024 yanglongkang <yanglongkang@h-partners.com> - 8.32-13
|
||||
- sort: don't trust st_size on /proc files
|
||||
|
||||
* Fri Mar 22 2024 cenhuilin <cenhuilin@kylinos.cn> - 8.32-12
|
||||
- sync patches from community
|
||||
- add backport-coverity-utimens.patch
|
||||
backport-fuse-portal.patch
|
||||
backport-expr-unmatched-par.patch
|
||||
|
||||
* Tue Mar 19 2024 cenhuilin <cenhuilin@kylinos.cn> - 8.32-11
|
||||
- sync patches from community
|
||||
- add backport-fix-mem-leaks.patch
|
||||
|
||||
* Tue Dec 5 2023 jiangchuangang <jiangchuangang@huawei.com> - 8.32-10
|
||||
- sync patches from community
|
||||
- add backport-who-fix-only-theoretical-overflow.patch
|
||||
backport-tac-handle-short-reads-on-input.patch
|
||||
backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
|
||||
backport-who-don-t-crash-if-clock-gyrates.patch
|
||||
backport-doc-od-strings-clarify-operation.patch
|
||||
|
||||
* Fri Dec 1 2023 jiangchuangang<jiangchuangang@huawei.com> - 8.32-9
|
||||
- sync patches from community
|
||||
- add backport-pr-fix-infinite-loop-when-double-spacing.patch
|
||||
backport-wc-ensure-we-update-file-offset.patch
|
||||
|
||||
* Tue Nov 28 2023 liningjie <liningjie@xfusion.com> - 8.32-8
|
||||
- cat: with -E fix handling of \r\n spanning buffers
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user