From 88ad0f28d16c4c0094b6b8c6a54351eddb623e54 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 26 Oct 2020 22:30:16 +0800 Subject: [PATCH 1/4] [patch tracking] 20201026223007632810 - https://github.com/coreutils/coreutils/commit/fe41d6c651eb0044e1d152b13f413874ba6bd731 --- ...d6c651eb0044e1d152b13f413874ba6bd731.patch | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 fe41d6c651eb0044e1d152b13f413874ba6bd731.patch diff --git a/fe41d6c651eb0044e1d152b13f413874ba6bd731.patch b/fe41d6c651eb0044e1d152b13f413874ba6bd731.patch new file mode 100644 index 0000000..de0c95a --- /dev/null +++ b/fe41d6c651eb0044e1d152b13f413874ba6bd731.patch @@ -0,0 +1,99 @@ +diff --git a/src/nl.c b/src/nl.c +index 8fe91f773..154131f36 100644 +--- a/src/nl.c ++++ b/src/nl.c +@@ -143,6 +143,9 @@ static char const *lineno_format = FORMAT_RIGHT_NOLZ; + /* Current print line number. */ + static intmax_t line_no; + ++/* Whether the current line number has incremented past limits. */ ++static bool line_no_overflow; ++ + /* True if we have ever read standard input. */ + static bool have_read_stdin; + +@@ -275,10 +278,23 @@ build_type_arg (char const **typep, + static void + print_lineno (void) + { ++ if (line_no_overflow) ++ die (EXIT_FAILURE, 0, _("line number overflow")); ++ + printf (lineno_format, lineno_width, line_no, separator_str); + + if (INT_ADD_WRAPV (line_no, page_incr, &line_no)) +- die (EXIT_FAILURE, 0, _("line number overflow")); ++ line_no_overflow = true; ++} ++ ++static void ++reset_lineno (void) ++{ ++ if (reset_numbers) ++ { ++ line_no = starting_line_number; ++ line_no_overflow = false; ++ } + } + + /* Switch to a header section. */ +@@ -288,8 +304,7 @@ proc_header (void) + { + current_type = header_type; + current_regex = &header_regex; +- if (reset_numbers) +- line_no = starting_line_number; ++ reset_lineno (); + putchar ('\n'); + } + +@@ -300,8 +315,7 @@ proc_body (void) + { + current_type = body_type; + current_regex = &body_regex; +- if (reset_numbers) +- line_no = starting_line_number; ++ reset_lineno (); + putchar ('\n'); + } + +@@ -312,8 +326,7 @@ proc_footer (void) + { + current_type = footer_type; + current_regex = &footer_regex; +- if (reset_numbers) +- line_no = starting_line_number; ++ reset_lineno (); + putchar ('\n'); + } + +diff --git a/tests/misc/nl.sh b/tests/misc/nl.sh +index 3a9919243..c134a9896 100755 +--- a/tests/misc/nl.sh ++++ b/tests/misc/nl.sh +@@ -18,7 +18,7 @@ + + . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src + print_ver_ nl +- ++getlimits_ + + echo a | nl > out || fail=1 + echo b | nl -s%n >> out || fail=1 +@@ -55,4 +55,16 @@ cat <<\EOF > exp + EOF + compare exp out || fail=1 + ++# Ensure we only indicate overflow when needing to output overflowed numbers ++returns_ 1 nl -v$INTMAX_OFLOW /dev/null || fail=1 ++printf '%s\n' a \\:\\: b > in.txt || framework_failure_ ++nl -v$INTMAX_MAX in.txt > out || fail=1 ++cat < exp ++$INTMAX_MAX a ++ ++$INTMAX_MAX b ++EOF ++compare exp out || fail=1 ++returns_ 1 nl -p -v$INTMAX_MAX in.txt > out || fail=1 ++ + Exit $fail -- Gitee From 5d4658508a24913703457def6171d23ade1ce5b1 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 26 Oct 2020 22:30:17 +0800 Subject: [PATCH 2/4] [patch tracking] 20201026223007632810 - https://github.com/coreutils/coreutils/commit/2c898597ea54b439369f0e3fabc6373729e1ea85 --- ...8597ea54b439369f0e3fabc6373729e1ea85.patch | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 2c898597ea54b439369f0e3fabc6373729e1ea85.patch diff --git a/2c898597ea54b439369f0e3fabc6373729e1ea85.patch b/2c898597ea54b439369f0e3fabc6373729e1ea85.patch new file mode 100644 index 0000000..56c42ca --- /dev/null +++ b/2c898597ea54b439369f0e3fabc6373729e1ea85.patch @@ -0,0 +1,67 @@ +diff --git a/NEWS b/NEWS +index 61b711611..7cf15498c 100644 +--- a/NEWS ++++ b/NEWS +@@ -36,6 +36,8 @@ GNU coreutils NEWS -*- outline -*- + ls --classify now supports the "always", "auto", or "never" flags, + to support only outputting classifier characters if connected to a tty. + ++ nl --line-increment can now take a negative number to decrement the count. ++ + ** Improvements + + stat and tail now know about the "vboxsf" file system type. +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index a55514d59..8d9320ca2 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -1867,6 +1867,7 @@ Analogous to @option{--body-numbering}. + @opindex -i + @opindex --line-increment + Increment line numbers by @var{number} (default 1). ++@var{number} can be negative to decrement. + + @item -l @var{number} + @itemx --join-blank-lines=@var{number} +@@ -1916,6 +1917,7 @@ Separate the line number from the text line in the output with + @opindex -v + @opindex --starting-line-number + Set the initial line number on each logical page to @var{number} (default 1). ++The starting @var{number} can be negative. + + @item -w @var{number} + @itemx --number-width=@var{number} +diff --git a/src/nl.c b/src/nl.c +index 154131f36..959909f05 100644 +--- a/src/nl.c ++++ b/src/nl.c +@@ -521,7 +521,7 @@ main (int argc, char **argv) + 0); + break; + case 'i': +- page_incr = xdectoimax (optarg, 1, INTMAX_MAX, "", ++ page_incr = xdectoimax (optarg, INTMAX_MIN, INTMAX_MAX, "", + _("invalid line number increment"), 0); + break; + case 'p': +diff --git a/tests/misc/nl.sh b/tests/misc/nl.sh +index c134a9896..fd9c5326c 100755 +--- a/tests/misc/nl.sh ++++ b/tests/misc/nl.sh +@@ -67,4 +67,16 @@ EOF + compare exp out || fail=1 + returns_ 1 nl -p -v$INTMAX_MAX in.txt > out || fail=1 + ++# Test negative iteration ++returns_ 1 nl -i$INTMAX_UFLOW /dev/null || fail=1 ++printf '%s\n' a b > in.txt || framework_failure_ ++nl -v$INTMAX_MAX -i$INTMAX_MIN in.txt > out || fail=1 ++cat < exp ++$INTMAX_MAX a ++ -1 b ++EOF ++compare exp out || fail=1 ++printf '%s\n' a b c > in.txt || framework_failure_ ++returns_ 1 nl -v$INTMAX_MAX -i$INTMAX_MIN in.txt > out || fail=1 ++ + Exit $fail -- Gitee From 9ab25f8c04a242ab25bd332c2ee8baac0e463b14 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 26 Oct 2020 22:30:17 +0800 Subject: [PATCH 3/4] [patch tracking] 20201026223007632810 - https://github.com/coreutils/coreutils/commit/4278e6615f319c13799749c37990ffb39c733edf --- ...e6615f319c13799749c37990ffb39c733edf.patch | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 4278e6615f319c13799749c37990ffb39c733edf.patch diff --git a/4278e6615f319c13799749c37990ffb39c733edf.patch b/4278e6615f319c13799749c37990ffb39c733edf.patch new file mode 100644 index 0000000..cea51a6 --- /dev/null +++ b/4278e6615f319c13799749c37990ffb39c733edf.patch @@ -0,0 +1,91 @@ +diff --git a/src/dd.c b/src/dd.c +index 4b0cddc9d..5bd28e1c3 100644 +--- a/src/dd.c ++++ b/src/dd.c +@@ -1784,59 +1784,6 @@ advance_input_offset (uintmax_t offset) + input_offset_overflow = true; + } + +-/* This is a wrapper for lseek. It detects and warns about a kernel +- bug that makes lseek a no-op for tape devices, even though the kernel +- lseek return value suggests that the function succeeded. +- +- The parameters are the same as those of the lseek function, but +- with the addition of FILENAME, the name of the file associated with +- descriptor FDESC. The file name is used solely in the warning that's +- printed when the bug is detected. Return the same value that lseek +- would have returned, but when the lseek bug is detected, return -1 +- to indicate that lseek failed. +- +- The offending behavior has been confirmed with an Exabyte SCSI tape +- drive accessed via /dev/nst0 on both Linux 2.2.17 and 2.4.16 kernels. */ +- +-#if defined __linux__ && HAVE_SYS_MTIO_H +- +-# include +- +-# define MT_SAME_POSITION(P, Q) \ +- ((P).mt_resid == (Q).mt_resid \ +- && (P).mt_fileno == (Q).mt_fileno \ +- && (P).mt_blkno == (Q).mt_blkno) +- +-static off_t +-skip_via_lseek (char const *filename, int fdesc, off_t offset, int whence) +-{ +- struct mtget s1; +- struct mtget s2; +- bool got_original_tape_position = (ioctl (fdesc, MTIOCGET, &s1) == 0); +- /* known bad device type */ +- /* && s.mt_type == MT_ISSCSI2 */ +- +- off_t new_position = lseek (fdesc, offset, whence); +- if (0 <= new_position +- && got_original_tape_position +- && ioctl (fdesc, MTIOCGET, &s2) == 0 +- && MT_SAME_POSITION (s1, s2)) +- { +- if (status_level != STATUS_NONE) +- error (0, 0, _("warning: working around lseek kernel bug for file " +- "(%s)\n of mt_type=0x%0lx -- " +- "see for the list of types"), +- filename, s2.mt_type + 0Lu); +- errno = 0; +- new_position = -1; +- } +- +- return new_position; +-} +-#else +-# define skip_via_lseek(Filename, Fd, Offset, Whence) lseek (Fd, Offset, Whence) +-#endif +- + /* Throw away RECORDS blocks of BLOCKSIZE bytes plus BYTES bytes on + file descriptor FDESC, which is open with read permission for FILE. + Store up to BLOCKSIZE bytes of the data at a time in IBUF or OBUF, if +@@ -1858,7 +1805,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, + + errno = 0; + if (records <= OFF_T_MAX / blocksize +- && 0 <= skip_via_lseek (file, fdesc, offset, SEEK_CUR)) ++ && 0 <= lseek (fdesc, offset, SEEK_CUR)) + { + if (fdesc == STDIN_FILENO) + { +@@ -1893,7 +1840,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, + Or it may not have been done at all (> OFF_T_MAX). + Therefore try to seek to the end of the file, + to avoid redundant reading. */ +- if ((skip_via_lseek (file, fdesc, 0, SEEK_END)) >= 0) ++ if (lseek (fdesc, 0, SEEK_END) >= 0) + { + /* File is seekable, and we're at the end of it, and + size <= OFF_T_MAX. So there's no point using read to advance. */ +@@ -1998,7 +1945,7 @@ advance_input_after_read_error (size_t nbytes) + diff = input_offset - offset; + if (! (0 <= diff && diff <= nbytes) && status_level != STATUS_NONE) + error (0, 0, _("warning: invalid file offset after failed read")); +- if (0 <= skip_via_lseek (input_file, STDIN_FILENO, diff, SEEK_CUR)) ++ if (0 <= lseek (STDIN_FILENO, diff, SEEK_CUR)) + return true; + if (errno == 0) + error (0, 0, _("cannot work around kernel bug after all")); -- Gitee From 24d06413da914fb7faa57e0f0d5e5668af5580ac Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 26 Oct 2020 22:30:19 +0800 Subject: [PATCH 4/4] [patch tracking] 20201026223007632810 - update spec file --- coreutils.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/coreutils.spec b/coreutils.spec index f5a08aa..61049ab 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 2 +Release: 3 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -25,6 +25,9 @@ Patch8: skip-the-tests-that-require-selinux-if-selinux-is-di.patch Patch9: coreutils-8.32-ls-removed-dir.patch Patch10: coreutils-8.32-leaf-opt-xfs.patch +Patch6000: fe41d6c651eb0044e1d152b13f413874ba6bd731.patch +Patch6001: 2c898597ea54b439369f0e3fabc6373729e1ea85.patch +Patch6002: 4278e6615f319c13799749c37990ffb39c733edf.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -135,6 +138,9 @@ fi %{_mandir}/man*/* %changelog +* 20201026223007632810 patch-tracking 8.32-3 +- append patch file of upstream repository from to <4278e6615f319c13799749c37990ffb39c733edf> + * Wed Aug 26 2020 chenbo pan - 8.32-2 - fix patch error @@ -221,4 +227,4 @@ fi - reintroduce very old Provides (mktemp, sh-utils, textwrap, fileutils, stat) * Thu Jul 12 2018 hexiaowen - 8.30-1 -- Pacakge init +- Pacakge init \ No newline at end of file -- Gitee