Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
bbdd3ae330
!194 [sync] PR-191: fix overflows in elide_tail_bytes_pipe
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-11-28 06:49:55 +00:00
h30032433
8c49094ed2 fix overflows in elide_tail_bytes_pipe
(cherry picked from commit eac10224f7e1de466fa1ba54e7c2637f927ce328)
2024-11-28 11:55:53 +08:00
openeuler-ci-bot
c7203275ae
!188 [sync] PR-180: 同步上游社区补丁
From: @openeuler-sync-bot 
Reviewed-by: @yue-yuankun 
Signed-off-by: @yue-yuankun
2024-11-22 08:44:07 +00:00
h30032433
7f730a12d7 sync patches from community
(cherry picked from commit 9b10aba3eda41a43254c49a09380cccefcdb1503)
2024-11-21 19:48:59 +08:00
openeuler-ci-bot
1fd605a3e3
!174 fix alias sm3sum not working on bash; delete redundant backport-chmod-fix-exit-status-when-ignoring-symlinks.patch
From: @huyubiao 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-08-13 07:13:09 +00:00
h30032433
0ec9dd261a fix alias sm3sum not working on bash; delete redundant backport-chmod-fix-exit-status-when-ignoring-symlinks.patch 2024-08-13 11:34:47 +08:00
openeuler-ci-bot
20d518c39b
!169 remove arch judgement at patch that support sw
From: @huyubiao 
Reviewed-by: @overweight 
Signed-off-by: @overweight
2024-07-17 11:13:10 +00:00
h30032433
feefd31306 remove arch judgement at patch that support sw 2024-07-17 17:12:47 +08:00
openeuler-ci-bot
d16b2e361d
!165 [sync] PR-144: Add a workaround for fixing clang building issues
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-07-11 03:57:01 +00:00
jchzhou
91d54669b7 add a workaround for fixing the stdbuf detection issue when building with clang
Signed-off-by: jchzhou <zhoujiacheng@iscas.ac.cn>
(cherry picked from commit 4787c1b0d7d83bd3716ce8b1ea414a2863149c6b)
2024-07-11 11:04:22 +08:00
13 changed files with 856 additions and 142 deletions

View File

@ -1,90 +0,0 @@
From e8b56ebd536e82b15542a00c888109471936bfda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Fri, 24 Sep 2021 20:57:41 +0100
Subject: [PATCH] chmod: fix exit status when ignoring symlinks
* src/chmod.c: Reorder enum so CH_NOT_APPLIED
can be treated as a non error.
* tests/chmod/ignore-symlink.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/50784
---
src/chmod.c | 4 ++--
tests/chmod/ignore-symlink.sh | 31 +++++++++++++++++++++++++++++++
tests/local.mk | 1 +
4 files changed, 40 insertions(+), 2 deletions(-)
create mode 100755 tests/chmod/ignore-symlink.sh
diff --git a/src/chmod.c b/src/chmod.c
index 37b04f5006..57ac47f33a 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -44,8 +44,8 @@ struct change_status
enum
{
CH_NO_STAT,
- CH_NOT_APPLIED,
CH_FAILED,
+ CH_NOT_APPLIED,
CH_NO_CHANGE_REQUESTED,
CH_SUCCEEDED
}
@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent)
if ( ! recurse)
fts_set (fts, ent, FTS_SKIP);
- return CH_NO_CHANGE_REQUESTED <= ch.status;
+ return CH_NOT_APPLIED <= ch.status;
}
/* Recursively change the modes of the specified FILES (the last entry
diff --git a/tests/chmod/ignore-symlink.sh b/tests/chmod/ignore-symlink.sh
new file mode 100755
index 0000000000..5ce3de8163
--- /dev/null
+++ b/tests/chmod/ignore-symlink.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Test for proper exit code of chmod on a processed symlink.
+
+# Copyright (C) 2021 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_ chmod
+
+mkdir dir || framework_failure_
+touch dir/f || framework_failure_
+ln -s f dir/l || framework_failure_
+
+# This operation ignores symlinks but should succeed.
+chmod u+w -R dir 2> out || fail=1
+
+compare /dev/null out || fail=1
+
+Exit $fail
diff --git a/tests/local.mk b/tests/local.mk
index 228d0e3688..b5b893fb77 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -456,6 +456,7 @@ all_tests = \
tests/chmod/c-option.sh \
tests/chmod/equal-x.sh \
tests/chmod/equals.sh \
+ tests/chmod/ignore-symlink.sh \
tests/chmod/inaccessible.sh \
tests/chmod/octal.sh \
tests/chmod/setgid.sh \

View File

@ -0,0 +1,64 @@
From fea833591ba787b1232d13ac4b985bea1e7601de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 4 Mar 2024 16:33:23 +0000
Subject: [PATCH] cksum: consistently validate --length attributes
* src/digest.c (main): Only validate the last used --length
for being a multiple of 8.
* tests/cksum/b2sum.sh: Add a test case.
Fixes https://bugs.gnu.org/69546
Reference:https://github.com/coreutils/coreutils/commit/fea833591ba787b1232d13ac4b985bea1e7601de
Conflict:NA
---
src/digest.c | 10 +++++-----
tests/cksum/b2sum.sh | 4 ++++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/digest.c b/src/digest.c
index 0d82eb6b4..96b811b6c 100644
--- a/src/digest.c
+++ b/src/digest.c
@@ -1397,11 +1397,6 @@ main (int argc, char **argv)
digest_length = xdectoumax (optarg, 0, UINTMAX_MAX, "",
_("invalid length"), 0);
digest_length_str = optarg;
- if (digest_length % 8 != 0)
- {
- error (0, 0, _("invalid length: %s"), quote (digest_length_str));
- error (EXIT_FAILURE, 0, _("length is not a multiple of 8"));
- }
break;
#endif
#if !HASH_ALGO_SUM
@@ -1476,6 +1471,11 @@ main (int argc, char **argv)
error (EXIT_FAILURE, 0,
_("--length is only supported with --algorithm=blake2b"));
# endif
+ if (digest_length % 8 != 0)
+ {
+ error (0, 0, _("invalid length: %s"), quote (digest_length_str));
+ error (EXIT_FAILURE, 0, _("length is not a multiple of 8"));
+ }
if (digest_length > BLAKE2B_MAX_LEN * 8)
{
error (0, 0, _("invalid length: %s"), quote (digest_length_str));
diff --git a/tests/cksum/b2sum.sh b/tests/cksum/b2sum.sh
index cc480a478..43a62d2fb 100755
--- a/tests/cksum/b2sum.sh
+++ b/tests/cksum/b2sum.sh
@@ -65,6 +65,10 @@ returns_ 1 $prog -c crash.check || fail=1
printf '0A0BA0' > overflow.check || framework_failure_
returns_ 1 $prog -c overflow.check || fail=1
+# This would fail before coreutil-9.4
+# Only validate the last specified, used length
+$prog -l 123 -l 128 /dev/null || fail=1
+
done
Exit $fail
--
2.43.0

View File

@ -0,0 +1,252 @@
From 8fe800a06e50be3c905ab1694a2d1bfd6e70be42 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 10 Aug 2024 22:19:17 -0700
Subject: [PATCH] head: fix overflows in elide_tail_bytes_pipe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Not clear that the overflows could be exploited,
but they made the code confusing.
* src/head.c (elide_tail_bytes_pipe): Dont convert uintmax_t
to size_t first thing; wait until its known the value will fit,
and then use idx_t rather than size_t to prefer signed types.
Prefer idx_t in nearby code, too.
Rename locals n_elide_0 to n_elide (for consistency elsewhere)
and n_elide to in_elide.
Remove bogus (SIZE_MAX < n_elide + READ_BUFSIZE) test;
in the typical case where n_elides type was the same as
that of SIZE_MAX, the test never succeeded, and in the
less-common case where n_elide was wider than size_t,
the addition could silently overflow, causing the test
to fail when it should succeed. The test is not needed anyway now.
Add static asserts to document code assumptions.
Redo the ! (n_elide <= HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD) case
so that it works with enormous values of n_elide even on
32-bit platforms; for example, n_bufs is now uintmax_t not size_t.
Simplify by using xpalloc instead of by-hand code.
Remove bogus if (rem) test, as rem is always nonzero.
---
src/head.c | 129 ++++++++++++++++++++++++-----------------------------
1 file changed, 58 insertions(+), 71 deletions(-)
diff --git a/src/head.c b/src/head.c
index a9155c24c..9715b7b73 100644
--- a/src/head.c
+++ b/src/head.c
@@ -237,17 +237,16 @@ elseek (int fd, off_t offset, int whence, char const *filename)
}
/* For an input file with name FILENAME and descriptor FD,
- output all but the last N_ELIDE_0 bytes.
+ output all but the last N_ELIDE bytes.
If CURRENT_POS is nonnegative, assume that the input file is
positioned at CURRENT_POS and that it should be repositioned to
just before the elided bytes before returning.
Return true upon success.
Give a diagnostic and return false upon error. */
static bool
-elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
+elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide,
off_t current_pos)
{
- size_t n_elide = n_elide_0;
uintmax_t desired_pos = current_pos;
bool ok = true;
@@ -265,16 +264,9 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
#endif
#if HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD < 2 * READ_BUFSIZE
- "HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD must be at least 2 * READ_BUFSIZE"
+# error "HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD must be at least 2 * READ_BUFSIZE"
#endif
- if (SIZE_MAX < n_elide_0 + READ_BUFSIZE)
- {
- char umax_buf[INT_BUFSIZE_BOUND (n_elide_0)];
- error (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
- umaxtostr (n_elide_0, umax_buf));
- }
-
/* Two cases to consider...
1) n_elide is small enough that we can afford to double-buffer:
allocate 2 * (READ_BUFSIZE + n_elide) bytes
@@ -286,11 +278,14 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
CAUTION: do not fail (out of memory) when asked to elide
a ridiculous amount, but when given only a small input. */
+ static_assert (READ_BUFSIZE <= IDX_MAX);
+ static_assert (HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD <= IDX_MAX - READ_BUFSIZE);
if (n_elide <= HEAD_TAIL_PIPE_BYTECOUNT_THRESHOLD)
{
+ idx_t in_elide = n_elide;
bool first = true;
bool eof = false;
- size_t n_to_read = READ_BUFSIZE + n_elide;
+ size_t n_to_read = READ_BUFSIZE + in_elide;
bool i;
char *b[2];
b[0] = xnmalloc (2, n_to_read);
@@ -310,7 +305,7 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
}
/* reached EOF */
- if (n_read <= n_elide)
+ if (n_read <= in_elide)
{
if (first)
{
@@ -320,7 +315,7 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
}
else
{
- delta = n_elide - n_read;
+ delta = in_elide - n_read;
}
}
eof = true;
@@ -330,15 +325,15 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
the previous round. */
if (! first)
{
- desired_pos += n_elide - delta;
- xwrite_stdout (b[!i] + READ_BUFSIZE, n_elide - delta);
+ desired_pos += in_elide - delta;
+ xwrite_stdout (b[!i] + READ_BUFSIZE, in_elide - delta);
}
first = false;
- if (n_elide < n_read)
+ if (in_elide < n_read)
{
- desired_pos += n_read - n_elide;
- xwrite_stdout (b[i], n_read - n_elide);
+ desired_pos += n_read - in_elide;
+ xwrite_stdout (b[i], n_read - in_elide);
}
}
@@ -350,31 +345,24 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
bytes. Then, for each new buffer we read, also write an old one. */
bool eof = false;
- size_t n_read;
- bool buffered_enough;
- size_t i, i_next;
+ idx_t n_read;
char **b = nullptr;
- /* Round n_elide up to a multiple of READ_BUFSIZE. */
- size_t rem = READ_BUFSIZE - (n_elide % READ_BUFSIZE);
- size_t n_elide_round = n_elide + rem;
- size_t n_bufs = n_elide_round / READ_BUFSIZE + 1;
- size_t n_alloc = 0;
- size_t n_array_alloc = 0;
-
- buffered_enough = false;
+
+ idx_t remainder = n_elide % READ_BUFSIZE;
+ /* The number of buffers needed to hold n_elide bytes plus one
+ extra buffer. They are allocated lazily, so don't report
+ overflow now simply because the number does not fit into idx_t. */
+ uintmax_t n_bufs = n_elide / READ_BUFSIZE + (remainder != 0) + 1;
+ idx_t n_alloc = 0;
+ idx_t n_array_alloc = 0;
+
+ bool buffered_enough = false;
+ idx_t i, i_next;
for (i = 0, i_next = 1; !eof; i = i_next, i_next = (i_next + 1) % n_bufs)
{
if (n_array_alloc == i)
- {
- /* reallocate between 16 and n_bufs entries. */
- if (n_array_alloc == 0)
- n_array_alloc = MIN (n_bufs, 16);
- else if (n_array_alloc <= n_bufs / 2)
- n_array_alloc *= 2;
- else
- n_array_alloc = n_bufs;
- b = xnrealloc (b, n_array_alloc, sizeof *b);
- }
+ b = xpalloc (b, &n_array_alloc, 1, MIN (n_bufs, PTRDIFF_MAX),
+ sizeof *b);
if (! buffered_enough)
{
@@ -403,43 +391,42 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
}
}
- /* Output any remainder: rem bytes from b[i] + n_read. */
- if (rem)
+ /* Output the remainder: rem bytes from b[i] + n_read. */
+ idx_t rem = READ_BUFSIZE - remainder;
+ if (buffered_enough)
{
- if (buffered_enough)
+ idx_t n_bytes_left_in_b_i = READ_BUFSIZE - n_read;
+ desired_pos += rem;
+ if (rem < n_bytes_left_in_b_i)
{
- size_t n_bytes_left_in_b_i = READ_BUFSIZE - n_read;
- desired_pos += rem;
- if (rem < n_bytes_left_in_b_i)
- {
- xwrite_stdout (b[i] + n_read, rem);
- }
- else
- {
- xwrite_stdout (b[i] + n_read, n_bytes_left_in_b_i);
- xwrite_stdout (b[i_next], rem - n_bytes_left_in_b_i);
- }
+ xwrite_stdout (b[i] + n_read, rem);
}
- else if (i + 1 == n_bufs)
+ else
{
- /* This happens when n_elide < file_size < n_elide_round.
-
- |READ_BUF.|
- | | rem |
- |---------!---------!---------!---------|
- |---- n_elide ---------|
- | | x |
- | |y |
- |---- file size -----------|
- | |n_read|
- |---- n_elide_round ----------|
- */
- size_t y = READ_BUFSIZE - rem;
- size_t x = n_read - y;
- desired_pos += x;
- xwrite_stdout (b[i_next], x);
+ xwrite_stdout (b[i] + n_read, n_bytes_left_in_b_i);
+ xwrite_stdout (b[i_next], rem - n_bytes_left_in_b_i);
}
}
+ else if (i + 1 == n_bufs)
+ {
+ /* This happens when
+ n_elide < file_size < (n_bufs - 1) * READ_BUFSIZE.
+
+ |READ_BUF.|
+ | | rem |
+ |---------!---------!---------!---------|
+ |---- n_elide----------|
+ | | x |
+ | |y |
+ |---- file size -----------|
+ | |n_read|
+ |(n_bufs - 1) * READ_BUFSIZE--|
+ */
+ idx_t y = READ_BUFSIZE - rem;
+ idx_t x = n_read - y;
+ desired_pos += x;
+ xwrite_stdout (b[i_next], x);
+ }
free_mem:
for (i = 0; i < n_alloc; i++)
--
2.33.0

View File

@ -0,0 +1,28 @@
From 0f9e2719e0dd2366f0381daa832f9415f3162af2 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 10 Aug 2024 18:55:09 -0700
Subject: [PATCH] head: off_t not uintmax_t for file offset
* src/head.c (elide_tail_lines_pipe):
Use off_t, not uintmax_t, for a local var that is
a file offset.
---
src/head.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/head.c b/src/head.c
index 2795ae486..a9155c24c 100644
--- a/src/head.c
+++ b/src/head.c
@@ -504,7 +504,7 @@ elide_tail_lines_pipe (char const *filename, int fd, uintmax_t n_elide,
size_t nlines;
struct linebuffer *next;
};
- uintmax_t desired_pos = current_pos;
+ off_t desired_pos = current_pos;
typedef struct linebuffer LBUFFER;
LBUFFER *first, *last, *tmp;
size_t total_lines = 0; /* Total number of newlines in all buffers. */
--
2.43.0

View File

@ -0,0 +1,74 @@
From a46f34bb56d545369a6b1321c2d78ac08b676c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Tue, 19 Mar 2024 15:55:18 +0000
Subject: [PATCH] maint: basenc: consistently check buffer bounds when encoding
* src/basenc.c (base16_encode, base2msbf_encode, base2lsbf_encode):
Ensure we don't overflow the output buffer, whose length is
passed in the OUTLEN parameter. This issue was flagged by clang
with -Wunused-but-set-parameter.
Reference:https://github.com/coreutils/coreutils/commit/a46f34bb56d545369a6b1321c2d78ac08b676c06
Conflict:Adapt to context.
---
src/basenc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/basenc.c b/src/basenc.c
index f4ca872..a3f89da 100644
--- a/src/basenc.c
+++ b/src/basenc.c
@@ -508,12 +508,14 @@ static void
base16_encode (char const *restrict in, idx_t inlen,
char *restrict out, idx_t outlen)
{
- while (inlen--)
+ while (inlen && outlen)
{
unsigned char c = *in;
*out++ = base16[c >> 4];
*out++ = base16[c & 0x0F];
++in;
+ inlen--;
+ outlen -= 2;
}
}
@@ -784,7 +786,7 @@ inline static void
base2msbf_encode (char const *restrict in, idx_t inlen,
char *restrict out, idx_t outlen)
{
- while (inlen--)
+ while (inlen && outlen)
{
unsigned char c = *in;
for (int i = 0; i < 8; i++)
@@ -792,6 +794,7 @@ base2msbf_encode (char const *restrict in, idx_t inlen,
*out++ = c & 0x80 ? '1' : '0';
c <<= 1;
}
+ inlen--;
outlen -= 8;
++in;
}
@@ -801,7 +804,7 @@ inline static void
base2lsbf_encode (char const *restrict in, idx_t inlen,
char *restrict out, idx_t outlen)
{
- while (inlen--)
+ while (inlen && outlen)
{
unsigned char c = *in;
for (int i = 0; i < 8; i++)
@@ -809,6 +812,7 @@ base2lsbf_encode (char const *restrict in, idx_t inlen,
*out++ = c & 0x01 ? '1' : '0';
c >>= 1;
}
+ inlen--;
outlen -= 8;
++in;
}
--
2.33.0

View File

@ -0,0 +1,66 @@
From 3e0d7787e67d4f732298d99eee772fc2631ddfb8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 11 Nov 2023 00:17:11 -0800
Subject: [PATCH] pinky: fix string size calculation
* src/pinky.c (count_ampersands): Simplify and return idx_t.
(create_fullname): Compute proper destination string size,
basically, by adding (ulen - 1) * ampersands rather than ulen *
(ampersands - 1). Problem found on CHERI-64.
Reference:https://github.com/coreutils/coreutils/commit/3e0d7787e67d4f732298d99eee772fc2631ddfb8
Conflict:NA
---
src/pinky.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/pinky.c b/src/pinky.c
index 8c872b2fe..82b2d842e 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -82,15 +82,12 @@ static struct option const longopts[] =
/* Count and return the number of ampersands in STR. */
ATTRIBUTE_PURE
-static size_t
+static idx_t
count_ampersands (char const *str)
{
- size_t count = 0;
- do
- {
- if (*str == '&')
- count++;
- } while (*str++);
+ idx_t count = 0;
+ for (; *str; str++)
+ count += *str == '&';
return count;
}
@@ -103,16 +100,16 @@ count_ampersands (char const *str)
static char *
create_fullname (char const *gecos_name, char const *user_name)
{
- size_t rsize = strlen (gecos_name) + 1;
+ idx_t rsize = strlen (gecos_name) + 1;
char *result;
char *r;
- size_t ampersands = count_ampersands (gecos_name);
+ idx_t ampersands = count_ampersands (gecos_name);
if (ampersands != 0)
{
- size_t ulen = strlen (user_name);
- size_t product;
- if (ckd_mul (&product, ulen, ampersands - 1)
+ idx_t ulen = strlen (user_name);
+ ptrdiff_t product;
+ if (ckd_mul (&product, ulen - 1, ampersands)
|| ckd_add (&rsize, rsize, product))
xalloc_die ();
}
--
2.43.0

View File

@ -0,0 +1,30 @@
From adb76c754290c328a88438af89e491ece7e6a9c5 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Thu, 6 Jun 2024 02:24:44 +0200
Subject: [PATCH] putenv: Don't crash upon out-of-memory.
* lib/putenv.c (_unsetenv): Handle malloc failure.
Reference:https://github.com/coreutils/gnulib/commit/adb76c754290c328a88438af89e491ece7e6a9c5
Conflict:delete ChangeLog
---
lib/putenv.c | 2 ++
1 files changed, 2 insertions(+)
diff --git a/lib/putenv.c b/lib/putenv.c
index 525d12ae..1d70717e 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -92,6 +92,8 @@ _unsetenv (const char *name)
{
int putenv_result;
char *name_ = malloc (len + 2);
+ if (name_ == NULL)
+ return -1;
memcpy (name_, name, len);
name_[len] = '=';
name_[len + 1] = 0;
--
2.43.0

View File

@ -0,0 +1,52 @@
From 1ea7255f8b0661cdfabbd13f8f443f81665a07e0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 3 Aug 2024 22:59:12 -0700
Subject: [PATCH] shuf: avoid integer overflow on huge inputs
* gl/lib/randperm.c: Include <stdckdint.h>.
(randperm_bound): Return SIZE_MAX if the multiplication overflows.
Do not overflow when converting bit count to byte count.
Reference:https://github.com/coreutils/coreutils/commit/1ea7255f8b0661cdfabbd13f8f443f81665a07e0
Conflict:change gl/lib/randperm.c to lib/randperm.c; Adaptation to floor_lg()
---
gl/lib/randperm.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/randperm.c b/lib/randperm.c
index 50328cd9a..14a304524 100644
--- a/lib/randperm.c
+++ b/lib/randperm.c
@@ -23,6 +23,7 @@
#include <limits.h>
#include <stdint.h>
+#include <stdckdint.h>
#include <stdlib.h>
#include "attribute.h"
@@ -39,13 +40,15 @@ randperm_bound (size_t h, size_t n)
{
/* Upper bound on number of bits needed to generate the first number
of the permutation. */
- uintmax_t lg_n = floor_lg (n) + 1;
+ unsigned int lg_n = floor_lg (n) + 1;
- /* Upper bound on number of bits needed to generated the first H elements. */
- uintmax_t ar = lg_n * h;
+ /* Upper bound on number of bits needed to generate the first H elements. */
+ uintmax_t ar;
+ if (ckd_mul (&ar, lg_n, h))
+ return SIZE_MAX;
/* Convert the bit count to a byte count. */
- size_t bound = (ar + CHAR_BIT - 1) / CHAR_BIT;
+ size_t bound = ar / CHAR_BIT + (ar % CHAR_BIT != 0);
return bound;
}
--
2.43.0

View File

@ -0,0 +1,40 @@
From bfbb3ec7f798b179d7fa7b42673e068b18048899 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 3 Aug 2024 22:31:20 -0700
Subject: [PATCH] shuf: fix randomness bug
Problem reported by Daniel Carpenter <https://bugs.gnu.org/72445>.
* gl/lib/randread.c (randread_new): Fill the ISAAC buffer
instead of storing at most BYTES_BOUND bytes into it.
---
gl/lib/randread.c | 12 +++++++++++-
1 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/randread.c b/lib/randread.c
index cbee224bb..43c0cf09f 100644
--- a/lib/randread.c
+++ b/lib/randread.c
@@ -189,9 +189,19 @@ randread_new (char const *name, size_t bytes_bound)
setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound));
else
{
+ /* Fill the ISAAC buffer. Although it is tempting to read at
+ most BYTES_BOUND bytes, this is incorrect for two reasons.
+ First, BYTES_BOUND is just an estimate.
+ Second, even if the estimate is correct
+ ISAAC64 poorly randomizes when BYTES_BOUND is small
+ and just the first few bytes of s->buf.isaac.state.m
+ are random while the other bytes are all zero. See:
+ Aumasson J-P. On the pseudo-random generator ISAAC.
+ Cryptology ePrint Archive. 2006;438.
+ <https://eprint.iacr.org/2006/438>. */
s->buf.isaac.buffered = 0;
if (! get_nonce (s->buf.isaac.state.m,
- MIN (sizeof s->buf.isaac.state.m, bytes_bound)))
+ sizeof s->buf.isaac.state.m))
{
int e = errno;
randread_free_body (s);
--
2.43.0

View File

@ -0,0 +1,90 @@
From ab4ffc85039f7398dde2ec4b307dfb2aa0fcf4f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 11 Mar 2024 13:46:24 +0000
Subject: [PATCH] timeout: fix narrow race in failing to kill processes
* src/timeout.c (main): Block cleanup signals earlier so that cleanup()
is not runnable until monitored_pid is in a deterministic state.
This ensures we always send a termination signal to the child
once it's forked.
* NEWS: Mention the bug fix.
Reported at https://github.com/coreutils/coreutils/issues/82
Reference:https://github.com/coreutils/coreutils/commit/ab4ffc85039f7398dde2ec4b307dfb2aa0fcf4f8
Conflict:Delete NEWS.
---
src/timeout.c | 32 +++++++++++++++++++++-----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/timeout.c b/src/timeout.c
index 9aa46a4f5..68d872b12 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -248,7 +248,7 @@ cleanup (int sig)
{ /* were in the parent, so let it continue to exit below. */
}
else /* monitored_pid == 0 */
- { /* we're the child or the child is not exec'd yet. */
+ { /* parent hasn't forked yet, or child has not exec'd yet. */
_exit (128 + sig);
}
}
@@ -537,14 +537,29 @@ main (int argc, char **argv)
signal (SIGTTOU, SIG_IGN); /* Don't stop if background child needs tty. */
install_sigchld (); /* Interrupt sigsuspend() when child exits. */
+ /* We configure timers so that SIGALRM is sent on expiry.
+ Therefore ensure we don't inherit a mask blocking SIGALRM. */
+ unblock_signal (SIGALRM);
+
+ /* Block signals now, so monitored_pid is deterministic in cleanup(). */
+ sigset_t orig_set;
+ block_cleanup_and_chld (term_signal, &orig_set);
+
monitored_pid = fork ();
if (monitored_pid == -1)
{
error (0, errno, _("fork system call failed"));
return EXIT_CANCELED;
}
- else if (monitored_pid == 0)
- { /* child */
+ else if (monitored_pid == 0) /* child */
+ {
+ /* Restore signal mask for child. */
+ if (sigprocmask (SIG_SETMASK, &orig_set, nullptr) != 0)
+ {
+ error (0, errno, _("child failed to reset signal mask"));
+ return EXIT_CANCELED;
+ }
+
/* exec doesn't reset SIG_IGN -> SIG_DFL. */
signal (SIGTTIN, SIG_DFL);
signal (SIGTTOU, SIG_DFL);
@@ -561,19 +576,14 @@ main (int argc, char **argv)
pid_t wait_result;
int status;
- /* We configure timers so that SIGALRM is sent on expiry.
- Therefore ensure we don't inherit a mask blocking SIGALRM. */
- unblock_signal (SIGALRM);
-
settimeout (timeout, true);
- /* Ensure we don't cleanup() after waitpid() reaps the child,
+ /* Note signals remain blocked in parent here, to ensure
+ we don't cleanup() after waitpid() reaps the child,
to avoid sending signals to a possibly different process. */
- sigset_t cleanup_set;
- block_cleanup_and_chld (term_signal, &cleanup_set);
while ((wait_result = waitpid (monitored_pid, &status, WNOHANG)) == 0)
- sigsuspend (&cleanup_set); /* Wait with cleanup signals unblocked. */
+ sigsuspend (&orig_set); /* Wait with cleanup signals unblocked. */
if (wait_result < 0)
{
--
2.43.0

View File

@ -0,0 +1,51 @@
From c1cf5148a1c6302d27661ff0af772de1e7dbb2b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 11 Mar 2024 13:18:37 +0000
Subject: [PATCH] timeout: fix race where we might kill arbitrary processes
* src/timeout.c (cleanup): Handle the case where monitored_pid
might be -1, which could happen if a signal was received
immediately after a failed fork() call. In that case it would
send the termination signal to all processes that the timeout
process has permission to send signals too.
* NEWS: Mention the bug fix.
Reference:https://github.com/coreutils/coreutils/commit/c1cf5148a1c6302d27661ff0af772de1e7dbb2b6
Conflict:Delete NEWS.
---
src/timeout.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/timeout.c b/src/timeout.c
index 6505634..641592c 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -208,7 +208,7 @@ cleanup (int sig)
timed_out = 1;
sig = term_signal;
}
- if (monitored_pid)
+ if (0 < monitored_pid)
{
if (kill_after)
{
@@ -245,8 +245,13 @@ cleanup (int sig)
}
}
}
- else /* we're the child or the child is not exec'd yet. */
- _exit (128 + sig);
+ else if (monitored_pid == -1)
+ { /* were in the parent, so let it continue to exit below. */
+ }
+ else /* monitored_pid == 0 */
+ { /* we're the child or the child is not exec'd yet. */
+ _exit (128 + sig);
+ }
}
void
--
2.33.0

View File

@ -1,10 +1,12 @@
diff -Nuar coreutils-9.0.org/build-aux/config.guess coreutils-9.0.sw/build-aux/config.guess
--- coreutils-9.0.org/build-aux/config.guess 2022-02-17 15:38:25.880000000 +0000
+++ coreutils-9.0.sw/build-aux/config.guess 2022-02-17 16:03:14.150000000 +0000
@@ -973,6 +973,14 @@
diff --git a/build-aux/config.guess b/build-aux/config.guess
index e81d3ae..fc4976f 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -973,6 +973,16 @@ EOF
UNAME_MACHINE=aarch64_be
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
+#if defined (__sw_64)
+ sw_64:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
+ sw) UNAME_MACHINE=sw_64 ;;
@ -13,24 +15,29 @@ diff -Nuar coreutils-9.0.org/build-aux/config.guess coreutils-9.0.sw/build-aux/c
+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
+ GUESS=$UNAME_MACHINE-sunway-linux-$LIBC
+ ;;
+#endif
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
diff -Nuar coreutils-9.0.org/build-aux/config.sub coreutils-9.0.sw/build-aux/config.sub
--- coreutils-9.0.org/build-aux/config.sub 2022-02-17 15:38:25.880000000 +0000
+++ coreutils-9.0.sw/build-aux/config.sub 2022-02-17 16:03:30.560000000 +0000
@@ -1177,6 +1177,7 @@
diff --git a/build-aux/config.sub b/build-aux/config.sub
index d74fb6d..b5b01c1 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1177,6 +1177,9 @@ case $cpu-$vendor in
| a29k \
| aarch64 | aarch64_be \
| abacus \
+#if defined (__sw_64)
+ | sw_64 \
+#endif
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
| alphapca5[67] | alpha64pca5[67] \
diff -Nuar coreutils-9.0.org/configure coreutils-9.0.sw/configure
--- coreutils-9.0.org/configure 2022-02-17 15:38:26.280000000 +0000
+++ coreutils-9.0.sw/configure 2022-02-17 15:58:05.480000000 +0000
@@ -7845,6 +7845,12 @@
diff --git a/configure b/configure
index ee54aad..dd92158 100755
--- a/configure
+++ b/configure
@@ -7845,6 +7845,12 @@ printf "%s\n" "#define _LARGEFILE_SOURCE 1" >>confdefs.h
# (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
# and the GCC 4.1.2 manual).
case "$host_cpu" in
@ -43,42 +50,46 @@ diff -Nuar coreutils-9.0.org/configure coreutils-9.0.sw/configure
alpha*)
# On Alpha systems, a compiler option provides the behaviour.
# See the ieee(3) manual page, also available at
@@ -18808,7 +18814,7 @@
@@ -18808,7 +18814,7 @@ else $as_nop
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
- x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | sw_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | sw_64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
@@ -18837,7 +18843,7 @@
;;
@@ -18838,7 +18844,7 @@ else $as_nop
# CPUs that only support a 64-bit ABI.
- alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+ sw_64* | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
- | mmix )
+ | sw_64* | mmix )
gl_cv_host_cpu_c_abi_32bit=no
;;
diff -Nuar coreutils-9.0.org/lib/uname.c coreutils-9.0.sw/lib/uname.c
--- coreutils-9.0.org/lib/uname.c 2022-02-17 15:38:26.740000000 +0000
+++ coreutils-9.0.sw/lib/uname.c 2022-02-17 15:59:09.500000000 +0000
@@ -228,6 +228,10 @@
diff --git a/lib/uname.c b/lib/uname.c
index adb9d98..0d6284b 100644
--- a/lib/uname.c
+++ b/lib/uname.c
@@ -228,6 +228,12 @@ uname (struct utsname *buf)
case PROCESSOR_ARCHITECTURE_MIPS:
strcpy (buf->machine, "mips");
break;
+#if defined (__sw_64)
+ case PROCESSOR_ARCHITECTURE_SW_64:
+ case PROCESSOR_ARCHITECTURE_SW_6464:
+ strcpy (buf->machine, "sw_64");
+ break;
+#endif
case PROCESSOR_ARCHITECTURE_ALPHA:
case PROCESSOR_ARCHITECTURE_ALPHA64:
strcpy (buf->machine, "alpha");
diff -Nuar coreutils-9.0.org/m4/fpieee.m4 coreutils-9.0.sw/m4/fpieee.m4
--- coreutils-9.0.org/m4/fpieee.m4 2022-02-17 15:38:25.890000000 +0000
+++ coreutils-9.0.sw/m4/fpieee.m4 2022-02-17 15:41:57.490000000 +0000
@@ -30,6 +30,12 @@
diff --git a/m4/fpieee.m4 b/m4/fpieee.m4
index 3f16957..7a6010b 100644
--- a/m4/fpieee.m4
+++ b/m4/fpieee.m4
@@ -30,6 +30,12 @@ AC_DEFUN([gl_FP_IEEE],
# (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
# and the GCC 4.1.2 manual).
case "$host_cpu" in
@ -91,23 +102,24 @@ diff -Nuar coreutils-9.0.org/m4/fpieee.m4 coreutils-9.0.sw/m4/fpieee.m4
alpha*)
# On Alpha systems, a compiler option provides the behaviour.
# See the ieee(3) manual page, also available at
diff -Nuar coreutils-9.0.org/m4/host-cpu-c-abi.m4 coreutils-9.0.sw/m4/host-cpu-c-abi.m4
--- coreutils-9.0.org/m4/host-cpu-c-abi.m4 2022-02-17 15:38:25.900000000 +0000
+++ coreutils-9.0.sw/m4/host-cpu-c-abi.m4 2022-02-17 15:41:29.970000000 +0000
@@ -91,6 +91,12 @@
diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 64e28b1..e2833aa 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -90,6 +90,12 @@ changequote([,])dnl
[gl_cv_host_cpu_c_abi=i386])
;;
changequote(,)dnl
+changequote(,)dnl
+ sw_64* )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=sw_64
+ ;;
+
+changequote(,)dnl
changequote(,)dnl
alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
changequote([,])dnl
gl_cv_host_cpu_c_abi=alpha
@@ -355,6 +361,9 @@
@@ -355,6 +361,9 @@ EOF
#ifndef __x86_64__
#undef __x86_64__
#endif
@ -117,28 +129,29 @@ diff -Nuar coreutils-9.0.org/m4/host-cpu-c-abi.m4 coreutils-9.0.sw/m4/host-cpu-c
#ifndef __alpha__
#undef __alpha__
#endif
@@ -468,7 +477,7 @@
@@ -468,7 +477,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
case "$gl_cv_host_cpu_c_abi" in
i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
gl_cv_host_cpu_c_abi_32bit=yes ;;
- x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | sw_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | sw_64 | riscv*-lp64* | s390x | sparc64 )
gl_cv_host_cpu_c_abi_32bit=no ;;
*)
gl_cv_host_cpu_c_abi_32bit=unknown ;;
@@ -498,7 +507,7 @@
@@ -499,7 +508,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
# CPUs that only support a 64-bit ABI.
changequote(,)dnl
- alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+ sw_64* | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
| mmix )
alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
- | mmix )
+ | sw_64* | mmix )
changequote([,])dnl
gl_cv_host_cpu_c_abi_32bit=no
diff -Nuar coreutils-9.0.org/src/longlong.h coreutils-9.0.sw/src/longlong.h
--- coreutils-9.0.org/src/longlong.h 2022-02-17 15:38:26.750000000 +0000
+++ coreutils-9.0.sw/src/longlong.h 2022-02-17 15:55:26.520000000 +0000
@@ -170,6 +170,92 @@
;;
diff --git a/src/longlong.h b/src/longlong.h
index fbd3716..c99a554 100644
--- a/src/longlong.h
+++ b/src/longlong.h
@@ -170,6 +170,92 @@ along with this file. If not, see https://www.gnu.org/licenses/. */
don't need to be under !NO_ASM */
#if ! defined (NO_ASM)
@ -231,3 +244,6 @@ diff -Nuar coreutils-9.0.org/src/longlong.h coreutils-9.0.sw/src/longlong.h
#if defined (__alpha) && W_TYPE_SIZE == 64
/* Most alpha-based machines, except Cray systems. */
#if defined (__GNUC__)
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: coreutils
Version: 9.4
Release: 6
Release: 11
License: GPLv3+
Summary: A set of basic GNU tools commonly used in shell scripts
Url: https://www.gnu.org/software/coreutils/
@ -28,11 +28,18 @@ patch13: backport-sort-don-t-trust-st_size-on-proc-files.patch
patch14: backport-cat-don-t-trust-st_size-on-proc-files.patch
patch15: backport-dd-don-t-trust-st_size-on-proc-files.patch
patch16: backport-split-don-t-trust-st_size-on-proc-files.patch
Patch17: backport-pinky-fix-string-size-calculation.patch
Patch18: backport-cksum-consistently-validate-length-attributes.patch
Patch19: backport-timeout-fix-race-where-we-might-kill-arbitrary-proce.patch
Patch20: backport-timeout-fix-narrow-race-in-failing-to-kill-processes.patch
Patch21: backport-maint-basenc-consistently-check-buffer-bounds-when-e.patch
Patch22: backport-putenv-Don-t-crash-upon-out-of-memory.patch
Patch23: backport-head-off_t-not-uintmax_t-for-file-offset.patch
Patch24: backport-shuf-avoid-integer-overflow-on-huge-inputs.patch
Patch25: backport-shuf-fix-randomness-bug.patch
Patch26: backport-head-fix-overflows-in-elide_tail_bytes_pipe.patch
%ifarch sw_64
Patch9001: coreutils-9.0-sw.patch
%endif
Conflicts: filesystem < 3
# To avoid clobbering installs
@ -87,7 +94,15 @@ autoreconf -fiv
if [ %user = root ]; then
export FORCE_UNSAFE_CONFIGURE=1
fi
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic -fsigned-char"
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fpic -fsigned-char"
# add -Wno-unused-command-line-argument when building with clang
# as a workaround for stdbuf detection faliure during configuring
%if "%{?toolchain}" == "clang"
CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
%endif
export CFLAGS
# make mknod work again in chroot without /proc being mounted
export ac_cv_func_lchmod="no"
@ -123,7 +138,7 @@ install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} $RPM_BUILD_ROOT%{_sysco
install -p -c -m644 build-aux/coreutils-colorls.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
install -p -c -m644 build-aux/coreutils-colorls.csh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/sm3sum.sh << EOF
alias sm3sum 'cksum -a sm3' 2>/dev/null
alias sm3sum='cksum -a sm3' 2>/dev/null
EOF
cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/sm3sum.csh << EOF
alias sm3sum 'cksum -a sm3'
@ -163,6 +178,32 @@ fi
%{_mandir}/man*/*
%changelog
* Thu Nov 28 2024 huyubiao <huyubiao@huawei.com> - 9.4-11
- sync patches from community
- add backport-head-fix-overflows-in-elide_tail_bytes_pipe.patch
* Wed Sep 11 2024 huyubiao <huyubiao@huawei.com> - 9.4-10
- sync patches from community
- add backport-pinky-fix-string-size-calculation.patch
backport-cksum-consistently-validate-length-attributes.patch
backport-timeout-fix-race-where-we-might-kill-arbitrary-proce.patch
backport-timeout-fix-narrow-race-in-failing-to-kill-processes.patch
backport-maint-basenc-consistently-check-buffer-bounds-when-e.patch
backport-putenv-Don-t-crash-upon-out-of-memory.patch
backport-head-off_t-not-uintmax_t-for-file-offset.patch
backport-shuf-avoid-integer-overflow-on-huge-inputs.patch
backport-shuf-fix-randomness-bug.patch
* Tue Aug 13 2024 huyubiao <huyubiao@huawei.com> - 9.4-9
- fix alias sm3sum not working on bash
delete redundant backport-chmod-fix-exit-status-when-ignoring-symlinks.patch
* Wed Jul 17 2024 huyubiao <huyubiao@huawei.com> - 9.4-8
- remove arch judgement at patch that support sw
* Thu Jul 11 2024 jchzhou <zhoujiacheng@iscas.ac.cn> - 9.4-7
- add a workaround for fixing clang building issues
* Mon Jun 24 2024 huyubiao <huyubiao@huawei.com> - 9.4-6
- backport patches from community