!108 [sync] PR-107: coreutils:sync patches from community
From: @openeuler-sync-bot Reviewed-by: @ship_harbour Signed-off-by: @ship_harbour
This commit is contained in:
commit
aad5a8a5a0
52
backport-doc-od-strings-clarify-operation.patch
Normal file
52
backport-doc-od-strings-clarify-operation.patch
Normal file
@ -0,0 +1,52 @@
|
||||
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
|
||||
|
||||
47
backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
Normal file
47
backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
Normal file
@ -0,0 +1,47 @@
|
||||
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 869096eb41..48fe27441e 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.
|
||||
+
|
||||
2023-02-27 ChuanGang Jiang <jiangchuanganghw@outlook.com>
|
||||
|
||||
fts: fail gracefully when out of memory
|
||||
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
|
||||
|
||||
70
backport-tac-handle-short-reads-on-input.patch
Normal file
70
backport-tac-handle-short-reads-on-input.patch
Normal file
@ -0,0 +1,70 @@
|
||||
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 41205fa88..2b8f984ba 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -3,6 +3,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
* Noteworthy changes in release 9.0 (2021-09-24) [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
|
||||
|
||||
263
backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
Normal file
263
backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
Normal file
@ -0,0 +1,263 @@
|
||||
From 91a74d361461494dd546467e83bc36c24185d6e7 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Tue, 13 Jun 2023 21:10:24 -0700
|
||||
Subject: [PATCH] wc: port to kernels that disable XSAVE YMM
|
||||
|
||||
Problem reported by Dave Hansen <https://bugs.gnu.org/64058>.
|
||||
Apply similar change to cksum and pclmul, too.
|
||||
* NEWS: Mention wc fix.
|
||||
* configure.ac (cpuid_exists, get_cpuid_count_exists):
|
||||
Remove. All uses removed, since we no longer use __get_cpuid or
|
||||
__get_cpuid_count.
|
||||
(pclmul_intrinsic_exists, avx2_intrinsic_exists): Set to no if
|
||||
__builtin_cpu_supports calls cannot be compiled.
|
||||
(HAVE_PCLMUL_INTRINSIC, HAVE_AVX2_INTRINSIC): Remove; unused.
|
||||
Simplify surrounding code because of this.
|
||||
* src/cksum.c (pclmul_supported):
|
||||
* src/wc.c (avx2_supported):
|
||||
Use __builtin_cpu_supports instead of doing it by hand.
|
||||
Simplify surrounding code because of this.
|
||||
|
||||
Reference:https://github.com/coreutils/coreutils/commit/91a74d361461494dd546467e83bc36c24185d6e7
|
||||
Conflict:remove "a = _mm_shuffle_epi8 (a, b);" in configure.ac because it doesn't exist
|
||||
|
||||
---
|
||||
NEWS | 3 +++
|
||||
configure.ac | 67 ++++++++--------------------------------------------
|
||||
src/cksum.c | 26 +++++---------------
|
||||
src/wc.c | 50 +++++----------------------------------
|
||||
4 files changed, 25 insertions(+), 121 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 7df9ff5b0..3350f9871 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -103,6 +103,9 @@ GNU coreutils NEWS -*- outline -*-
|
||||
on (1024*5) buffer boundaries
|
||||
[bug introduced in coreutils-8.31]
|
||||
|
||||
+ 'wc -l' no longer crashes on x86 Linux kernels that disable XSAVE YMM.
|
||||
+ [bug introduced in coreutils-9.0]
|
||||
+
|
||||
** Changes in behavior
|
||||
|
||||
cp and install now default to copy-on-write (COW) if available.
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 520de8184..48dea9d01 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -527,27 +527,6 @@ CFLAGS=$ac_save_CFLAGS
|
||||
LDFLAGS=$ac_save_LDFLAGS
|
||||
ac_c_werror_flag=$cu_save_c_werror_flag
|
||||
|
||||
-AC_MSG_CHECKING([if __get_cpuid available])
|
||||
-AC_LINK_IFELSE(
|
||||
- [AC_LANG_SOURCE([[
|
||||
- #include <cpuid.h>
|
||||
-
|
||||
- int
|
||||
- main (void)
|
||||
- {
|
||||
- unsigned int eax, ebx, ecx, edx;
|
||||
- __get_cpuid (1, &eax, &ebx, &ecx, &edx);
|
||||
- return 1;
|
||||
- }
|
||||
- ]])
|
||||
- ],[
|
||||
- AC_MSG_RESULT([yes])
|
||||
- AC_DEFINE([HAVE_CPUID], [1], [__get_cpuid available])
|
||||
- cpuid_exists=yes
|
||||
- ],[
|
||||
- AC_MSG_RESULT([no])
|
||||
- ])
|
||||
-
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-mavx -mpclmul $CFLAGS"
|
||||
AC_MSG_CHECKING([if pclmul intrinsic exists])
|
||||
@@ -560,46 +539,23 @@ AC_COMPILE_IFELSE(
|
||||
{
|
||||
__m128i a, b;
|
||||
a = _mm_clmulepi64_si128 (a, b, 0x00);
|
||||
- return 1;
|
||||
+ return __builtin_cpu_supports ("pclmul");
|
||||
}
|
||||
]])
|
||||
],[
|
||||
- AC_MSG_RESULT([yes])
|
||||
- AC_DEFINE([HAVE_PCLMUL_INTRINSIC], [1], [pclmul intrinsic exists])
|
||||
pclmul_intrinsic_exists=yes
|
||||
],[
|
||||
- AC_MSG_RESULT([no])
|
||||
+ pclmul_intrinsic_exists=no
|
||||
])
|
||||
-if test "x$cpuid_exists" = "xyes" &&
|
||||
- test "x$pclmul_intrinsic_exists" = "xyes"; then
|
||||
+AC_MSG_RESULT([$pclmul_intrinsic_exists])
|
||||
+if test $pclmul_intrinsic_exists = yes; then
|
||||
AC_DEFINE([USE_PCLMUL_CRC32], [1],
|
||||
[CRC32 calculation by pclmul hardware instruction enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_PCLMUL_CRC32],
|
||||
- [test "x$cpuid_exists" = "xyes" &&
|
||||
- test "x$pclmul_intrinsic_exists" = "xyes"])
|
||||
+ [test $pclmul_intrinsic_exists = yes])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
-AC_MSG_CHECKING([if __get_cpuid_count exists])
|
||||
-AC_LINK_IFELSE(
|
||||
- [AC_LANG_SOURCE([[
|
||||
- #include <cpuid.h>
|
||||
-
|
||||
- int
|
||||
- main (void)
|
||||
- {
|
||||
- unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
- __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx);
|
||||
- return 1;
|
||||
- }
|
||||
- ]])
|
||||
- ],[
|
||||
- AC_MSG_RESULT([yes])
|
||||
- get_cpuid_count_exists=yes
|
||||
- ],[
|
||||
- AC_MSG_RESULT([no])
|
||||
- ])
|
||||
-
|
||||
CFLAGS="-mavx2 $CFLAGS"
|
||||
AC_MSG_CHECKING([if avx2 intrinstics exists])
|
||||
AC_COMPILE_IFELSE(
|
||||
@@ -611,23 +567,20 @@ AC_COMPILE_IFELSE(
|
||||
{
|
||||
__m256i a, b;
|
||||
a = _mm256_sad_epu8 (a, b);
|
||||
- return 1;
|
||||
+ return __builtin_cpu_supports ("avx2");
|
||||
}
|
||||
]])
|
||||
],[
|
||||
- AC_MSG_RESULT([yes])
|
||||
- AC_DEFINE([HAVE_AVX2_INTRINSIC], [1], [avx2 intrinsics exists])
|
||||
avx2_intrinsic_exists=yes
|
||||
],[
|
||||
- AC_MSG_RESULT([no])
|
||||
+ avx2_intrinsic_exists=no
|
||||
])
|
||||
-if test "x$get_cpuid_count_exists" = "xyes" &&
|
||||
- test "x$avx2_intrinsic_exists" = "xyes"; then
|
||||
+AC_MSG_RESULT([$avx2_intrinsic_exists])
|
||||
+if test $avx2_intrinsic_exists = yes; then
|
||||
AC_DEFINE([USE_AVX2_WC_LINECOUNT], [1], [Counting lines with AVX2 enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([USE_AVX2_WC_LINECOUNT],
|
||||
- [test "x$get_cpuid_count_exists" = "xyes" &&
|
||||
- test "x$avx2_intrinsic_exists" = "xyes"])
|
||||
+ [test $avx2_intrinsic_exists = yes])
|
||||
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
diff --git a/src/cksum.c b/src/cksum.c
|
||||
index 85afab0ac..631ac3449 100644
|
||||
--- a/src/cksum.c
|
||||
+++ b/src/cksum.c
|
||||
@@ -159,29 +159,15 @@ static bool
|
||||
pclmul_supported (void)
|
||||
{
|
||||
# if USE_PCLMUL_CRC32
|
||||
- unsigned int eax = 0;
|
||||
- unsigned int ebx = 0;
|
||||
- unsigned int ecx = 0;
|
||||
- unsigned int edx = 0;
|
||||
-
|
||||
- if (! __get_cpuid (1, &eax, &ebx, &ecx, &edx))
|
||||
- {
|
||||
- if (cksum_debug)
|
||||
- error (0, 0, "%s", _("failed to get cpuid"));
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (! (ecx & bit_PCLMUL) || ! (ecx & bit_AVX))
|
||||
- {
|
||||
- if (cksum_debug)
|
||||
- error (0, 0, "%s", _("pclmul support not detected"));
|
||||
- return false;
|
||||
- }
|
||||
+ bool pclmul_enabled = 0 < __builtin_cpu_supports ("pclmul");
|
||||
|
||||
if (cksum_debug)
|
||||
- error (0, 0, "%s", _("using pclmul hardware support"));
|
||||
+ error (0, 0, "%s",
|
||||
+ (pclmul_enabled
|
||||
+ ? _("using pclmul hardware support")
|
||||
+ : _("pclmul support not detected")));
|
||||
|
||||
- return true;
|
||||
+ return pclmul_enabled;
|
||||
# else
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s", _("using generic hardware support"));
|
||||
diff --git a/src/wc.c b/src/wc.c
|
||||
index becceda98..3708d0b8f 100644
|
||||
--- a/src/wc.c
|
||||
+++ b/src/wc.c
|
||||
@@ -132,52 +132,14 @@ static struct option const longopts[] =
|
||||
static bool
|
||||
avx2_supported (void)
|
||||
{
|
||||
- unsigned int eax = 0;
|
||||
- unsigned int ebx = 0;
|
||||
- unsigned int ecx = 0;
|
||||
- unsigned int edx = 0;
|
||||
- bool getcpuid_ok = false;
|
||||
- bool avx_enabled = false;
|
||||
-
|
||||
- if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
|
||||
- {
|
||||
- getcpuid_ok = true;
|
||||
- if (ecx & bit_OSXSAVE)
|
||||
- avx_enabled = true; /* Support is not disabled. */
|
||||
- }
|
||||
-
|
||||
-
|
||||
- if (avx_enabled)
|
||||
- {
|
||||
- eax = ebx = ecx = edx = 0;
|
||||
- if (! __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
|
||||
- getcpuid_ok = false;
|
||||
- else
|
||||
- {
|
||||
- if (! (ebx & bit_AVX2))
|
||||
- avx_enabled = false; /* Hardware doesn't support it. */
|
||||
- }
|
||||
- }
|
||||
+ bool avx_enabled = 0 < __builtin_cpu_supports ("avx2");
|
||||
|
||||
+ if (debug)
|
||||
+ error (0, 0, (avx_enabled
|
||||
+ ? _("using avx2 hardware support")
|
||||
+ : _("avx2 support not detected")));
|
||||
|
||||
- if (! getcpuid_ok)
|
||||
- {
|
||||
- if (debug)
|
||||
- error (0, 0, "%s", _("failed to get cpuid"));
|
||||
- return false;
|
||||
- }
|
||||
- else if (! avx_enabled)
|
||||
- {
|
||||
- if (debug)
|
||||
- error (0, 0, "%s", _("avx2 support not detected"));
|
||||
- return false;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- if (debug)
|
||||
- error (0, 0, "%s", _("using avx2 hardware support"));
|
||||
- return true;
|
||||
- }
|
||||
+ return avx_enabled;
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
49
backport-who-don-t-crash-if-clock-gyrates.patch
Normal file
49
backport-who-don-t-crash-if-clock-gyrates.patch
Normal file
@ -0,0 +1,49 @@
|
||||
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: 9.0
|
||||
Release: 10
|
||||
Release: 11
|
||||
License: GPLv3+
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
@ -33,6 +33,12 @@ Patch18: backport-tail-fix-support-for-F-with-non-seekable-files.patch
|
||||
Patch19: backport-fts-fail-gracefully-when-out-of-memory.patch
|
||||
Patch20: backport-pr-fix-infinite-loop-when-double-spacing.patch
|
||||
Patch21: backport-wc-ensure-we-update-file-offset.patch
|
||||
Patch22: backport-who-fix-only-theoretical-overflow.patch
|
||||
Patch23: backport-tac-handle-short-reads-on-input.patch
|
||||
Patch24: backport-setenv-Don-t-crash-if-malloc-returns-NULL.patch
|
||||
Patch25: backport-who-don-t-crash-if-clock-gyrates.patch
|
||||
Patch26: backport-doc-od-strings-clarify-operation.patch
|
||||
Patch27: backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
|
||||
|
||||
%ifarch sw_64
|
||||
Patch13: coreutils-9.0-sw.patch
|
||||
@ -161,6 +167,15 @@ fi
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Sun Oct 08 2023 fuanan <fuanan3@h-partners.com> - 9.0-11
|
||||
- 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
|
||||
backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
|
||||
|
||||
* Thu Jun 15 2023 jiangchuangang<jiangchuangang@huawei.com> - 9.0-10
|
||||
- sync patches from community
|
||||
- add backport-pr-fix-infinite-loop-when-double-spacing.patch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user