Compare commits
No commits in common. "c8" and "c8-beta" have entirely different histories.
@ -1,163 +0,0 @@
|
||||
From 9a8a119858b8df497155cd2948494ea8580b4de4 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||
Date: Wed, 15 Apr 2020 20:50:32 -0700
|
||||
Subject: [PATCH] fts: remove NOSTAT_LEAF_OPTIMIZATION
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It caused ‘find’ and ‘du’ to dump core, and it was useful
|
||||
only for obsolescent Linux filesystems anyway. Problem reported in:
|
||||
https://lists.gnu.org/r/bug-gnulib/2020-04/msg00068.html
|
||||
Quite possibly there is still a serious underlying fts bug with
|
||||
tight-loop-check and mutating file systems, but if so this patch
|
||||
should cause the bug to be triggered less often.
|
||||
* lib/fts.c (enum leaf_optimization): Remove
|
||||
NOSTAT_LEAF_OPTIMIZATION, as it’s problematic.
|
||||
(S_MAGIC_REISERFS, S_MAGIC_XFS): Remove; no longer needed.
|
||||
(leaf_optimization): Remove special cases for ReiserFS and XFS.
|
||||
(fts_read): Remove NOSTAT_LEAF_OPTIMIZATION code.
|
||||
* lib/fts_.h (struct _ftsent.fts_n_dirs_remaining):
|
||||
Remove. All uses removed.
|
||||
|
||||
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
|
||||
Upstream-commit: 47bf2cf3184027c1eb9c1dfeea5c5b8b2d69710d
|
||||
---
|
||||
lib/fts.c | 56 ++++++++----------------------------------------------
|
||||
lib/fts_.h | 5 -----
|
||||
2 files changed, 8 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/lib/fts.c b/lib/fts.c
|
||||
index 1ccc78c..e469ea3 100644
|
||||
--- a/lib/fts.c
|
||||
+++ b/lib/fts.c
|
||||
@@ -471,7 +471,6 @@ fts_open (char * const *argv,
|
||||
if ((parent = fts_alloc(sp, "", 0)) == NULL)
|
||||
goto mem2;
|
||||
parent->fts_level = FTS_ROOTPARENTLEVEL;
|
||||
- parent->fts_n_dirs_remaining = -1;
|
||||
}
|
||||
|
||||
/* The classic fts implementation would call fts_stat with
|
||||
@@ -660,9 +659,8 @@ fts_close (FTS *sp)
|
||||
}
|
||||
|
||||
/* Minimum link count of a traditional Unix directory. When leaf
|
||||
- optimization is OK and MIN_DIR_NLINK <= st_nlink, then st_nlink is
|
||||
- an upper bound on the number of subdirectories (counting "." and
|
||||
- ".."). */
|
||||
+ optimization is OK and a directory's st_nlink == MIN_DIR_NLINK,
|
||||
+ then the directory has no subdirectories. */
|
||||
enum { MIN_DIR_NLINK = 2 };
|
||||
|
||||
/* Whether leaf optimization is OK for a directory. */
|
||||
@@ -671,12 +669,8 @@ enum leaf_optimization
|
||||
/* st_nlink is not reliable for this directory's subdirectories. */
|
||||
NO_LEAF_OPTIMIZATION,
|
||||
|
||||
- /* Leaf optimization is OK, but is not useful for avoiding stat calls. */
|
||||
- OK_LEAF_OPTIMIZATION,
|
||||
-
|
||||
- /* Leaf optimization is not only OK: it is useful for avoiding
|
||||
- stat calls, because dirent.d_type does not work. */
|
||||
- NOSTAT_LEAF_OPTIMIZATION
|
||||
+ /* st_nlink == 2 means the directory lacks subdirectories. */
|
||||
+ OK_LEAF_OPTIMIZATION
|
||||
};
|
||||
|
||||
#if defined __linux__ \
|
||||
@@ -689,9 +683,7 @@ enum leaf_optimization
|
||||
# define S_MAGIC_CIFS 0xFF534D42
|
||||
# define S_MAGIC_NFS 0x6969
|
||||
# define S_MAGIC_PROC 0x9FA0
|
||||
-# define S_MAGIC_REISERFS 0x52654973
|
||||
# define S_MAGIC_TMPFS 0x1021994
|
||||
-# define S_MAGIC_XFS 0x58465342
|
||||
|
||||
# ifdef HAVE___FSWORD_T
|
||||
typedef __fsword_t fsword;
|
||||
@@ -808,23 +800,15 @@ dirent_inode_sort_may_be_useful (FTSENT const *p, int dir_fd)
|
||||
}
|
||||
|
||||
/* Given an FTS entry P for a directory with descriptor DIR_FD,
|
||||
- return true if it is both useful and valid to apply leaf optimization.
|
||||
- The optimization is useful only for file systems that lack usable
|
||||
- dirent.d_type info. The optimization is valid if an st_nlink value
|
||||
- of at least MIN_DIR_NLINK is an upper bound on the number of
|
||||
- subdirectories of D, counting "." and ".." as subdirectories.
|
||||
+ return whether it is valid to apply leaf optimization.
|
||||
+ The optimization is valid if a directory's st_nlink value equal
|
||||
+ to MIN_DIR_NLINK means the directory has no subdirectories.
|
||||
DIR_FD is negative if unavailable. */
|
||||
static enum leaf_optimization
|
||||
leaf_optimization (FTSENT const *p, int dir_fd)
|
||||
{
|
||||
switch (filesystem_type (p, dir_fd))
|
||||
{
|
||||
- /* List here the file system types that may lack usable dirent.d_type
|
||||
- info, yet for which the optimization does apply. */
|
||||
- case S_MAGIC_REISERFS:
|
||||
- case S_MAGIC_XFS: /* XFS lacked it until 2013-08-22 commit. */
|
||||
- return NOSTAT_LEAF_OPTIMIZATION;
|
||||
-
|
||||
case 0:
|
||||
/* Leaf optimization is unsafe if the file system type is unknown. */
|
||||
FALLTHROUGH;
|
||||
@@ -1049,26 +1033,7 @@ check_for_dir:
|
||||
if (p->fts_info == FTS_NSOK)
|
||||
{
|
||||
if (p->fts_statp->st_size == FTS_STAT_REQUIRED)
|
||||
- {
|
||||
- FTSENT *parent = p->fts_parent;
|
||||
- if (parent->fts_n_dirs_remaining == 0
|
||||
- && ISSET(FTS_NOSTAT)
|
||||
- && ISSET(FTS_PHYSICAL)
|
||||
- && (leaf_optimization (parent, sp->fts_cwd_fd)
|
||||
- == NOSTAT_LEAF_OPTIMIZATION))
|
||||
- {
|
||||
- /* nothing more needed */
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- p->fts_info = fts_stat(sp, p, false);
|
||||
- if (S_ISDIR(p->fts_statp->st_mode)
|
||||
- && p->fts_level != FTS_ROOTLEVEL
|
||||
- && 0 < parent->fts_n_dirs_remaining
|
||||
- && parent->fts_n_dirs_remaining != (nlink_t) -1)
|
||||
- parent->fts_n_dirs_remaining--;
|
||||
- }
|
||||
- }
|
||||
+ p->fts_info = fts_stat(sp, p, false);
|
||||
else
|
||||
fts_assert (p->fts_statp->st_size == FTS_NO_STAT_REQUIRED);
|
||||
}
|
||||
@@ -1853,11 +1818,6 @@ err: memset(sbp, 0, sizeof(struct stat));
|
||||
}
|
||||
|
||||
if (S_ISDIR(sbp->st_mode)) {
|
||||
- p->fts_n_dirs_remaining
|
||||
- = ((sbp->st_nlink < MIN_DIR_NLINK
|
||||
- || p->fts_level <= FTS_ROOTLEVEL)
|
||||
- ? -1
|
||||
- : sbp->st_nlink - (ISSET (FTS_SEEDOT) ? 0 : MIN_DIR_NLINK));
|
||||
if (ISDOT(p->fts_name)) {
|
||||
/* Command-line "." and ".." are real directories. */
|
||||
return (p->fts_level == FTS_ROOTLEVEL ? FTS_D : FTS_DOT);
|
||||
diff --git a/lib/fts_.h b/lib/fts_.h
|
||||
index 70cc9e3..d78eabb 100644
|
||||
--- a/lib/fts_.h
|
||||
+++ b/lib/fts_.h
|
||||
@@ -221,11 +221,6 @@ typedef struct _ftsent {
|
||||
|
||||
size_t fts_namelen; /* strlen(fts_name) */
|
||||
|
||||
- /* If not (nlink_t) -1, an upper bound on the number of
|
||||
- remaining subdirectories of interest. If this becomes
|
||||
- zero, some work can be avoided. */
|
||||
- nlink_t fts_n_dirs_remaining;
|
||||
-
|
||||
# define FTS_D 1 /* preorder directory */
|
||||
# define FTS_DC 2 /* directory that causes cycles */
|
||||
# define FTS_DEFAULT 3 /* none of the above */
|
||||
--
|
||||
2.51.1
|
||||
0
SOURCES/coreutils-colorls.csh
Normal file → Executable file
0
SOURCES/coreutils-colorls.csh
Normal file → Executable file
0
SOURCES/coreutils-colorls.sh
Normal file → Executable file
0
SOURCES/coreutils-colorls.sh
Normal file → Executable file
@ -7,15 +7,14 @@ Subject: [PATCH] coreutils-df-direct.patch
|
||||
doc/coreutils.texi | 7 ++++++
|
||||
src/df.c | 34 ++++++++++++++++++++++++++--
|
||||
tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/local.mk | 1 +
|
||||
4 files changed, 95 insertions(+), 2 deletions(-)
|
||||
3 files changed, 94 insertions(+), 2 deletions(-)
|
||||
create mode 100755 tests/df/direct.sh
|
||||
|
||||
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
|
||||
index 576dfbe..e246bd3 100644
|
||||
index 5b9a597..6810c15 100644
|
||||
--- a/doc/coreutils.texi
|
||||
+++ b/doc/coreutils.texi
|
||||
@@ -11722,6 +11722,13 @@ some systems (notably SunOS), doing this yields more up to date results,
|
||||
@@ -11898,6 +11898,13 @@ some systems (notably SunOS), doing this yields more up to date results,
|
||||
but in general this option makes @command{df} much slower, especially when
|
||||
there are many or very busy file systems.
|
||||
|
||||
@ -30,10 +29,10 @@ index 576dfbe..e246bd3 100644
|
||||
@opindex --total
|
||||
@cindex grand total of disk size, usage and available space
|
||||
diff --git a/src/df.c b/src/df.c
|
||||
index 2ca487e..fd6e66e 100644
|
||||
index 48025b9..c8efa5b 100644
|
||||
--- a/src/df.c
|
||||
+++ b/src/df.c
|
||||
@@ -121,6 +121,9 @@ static bool print_type;
|
||||
@@ -125,6 +125,9 @@ static bool print_type;
|
||||
/* If true, print a grand total at the end. */
|
||||
static bool print_grand_total;
|
||||
|
||||
@ -43,7 +42,7 @@ index 2ca487e..fd6e66e 100644
|
||||
/* Grand total data. */
|
||||
static struct fs_usage grand_fsu;
|
||||
|
||||
@@ -248,13 +251,15 @@ enum
|
||||
@@ -252,13 +255,15 @@ enum
|
||||
NO_SYNC_OPTION = CHAR_MAX + 1,
|
||||
SYNC_OPTION,
|
||||
TOTAL_OPTION,
|
||||
@ -60,7 +59,7 @@ index 2ca487e..fd6e66e 100644
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
@@ -510,7 +515,10 @@ get_header (void)
|
||||
@@ -561,7 +566,10 @@ get_header (void)
|
||||
for (col = 0; col < ncolumns; col++)
|
||||
{
|
||||
char *cell = NULL;
|
||||
@ -72,7 +71,7 @@ index 2ca487e..fd6e66e 100644
|
||||
|
||||
if (columns[col]->field == SIZE_FIELD
|
||||
&& (header_mode == DEFAULT_MODE
|
||||
@@ -1411,6 +1419,17 @@ get_point (const char *point, const struct stat *statp)
|
||||
@@ -1464,6 +1472,17 @@ get_point (const char *point, const struct stat *statp)
|
||||
static void
|
||||
get_entry (char const *name, struct stat const *statp)
|
||||
{
|
||||
@ -90,7 +89,7 @@ index 2ca487e..fd6e66e 100644
|
||||
if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
|
||||
&& get_disk (name))
|
||||
return;
|
||||
@@ -1481,6 +1500,7 @@ or all file systems by default.\n\
|
||||
@@ -1534,6 +1553,7 @@ or all file systems by default.\n\
|
||||
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
|
||||
'-BM' prints sizes in units of 1,048,576 bytes;\n\
|
||||
see SIZE format below\n\
|
||||
@ -98,7 +97,7 @@ index 2ca487e..fd6e66e 100644
|
||||
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
|
||||
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
|
||||
"), stdout);
|
||||
@@ -1571,6 +1591,9 @@ main (int argc, char **argv)
|
||||
@@ -1624,6 +1644,9 @@ main (int argc, char **argv)
|
||||
xstrtol_fatal (e, oi, c, long_options, optarg);
|
||||
}
|
||||
break;
|
||||
@ -108,7 +107,7 @@ index 2ca487e..fd6e66e 100644
|
||||
case 'i':
|
||||
if (header_mode == OUTPUT_MODE)
|
||||
{
|
||||
@@ -1667,6 +1690,13 @@ main (int argc, char **argv)
|
||||
@@ -1720,6 +1743,13 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +123,7 @@ index 2ca487e..fd6e66e 100644
|
||||
if (posix_format)
|
||||
diff --git a/tests/df/direct.sh b/tests/df/direct.sh
|
||||
new file mode 100755
|
||||
index 0000000..8373705
|
||||
index 0000000..8e4cfb8
|
||||
--- /dev/null
|
||||
+++ b/tests/df/direct.sh
|
||||
@@ -0,0 +1,55 @@
|
||||
@ -146,7 +145,7 @@ index 0000000..8373705
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
||||
+print_ver_ df
|
||||
+
|
||||
+df || skip_ "df fails"
|
||||
@ -183,18 +182,6 @@ index 0000000..8373705
|
||||
+compare file_out file_exp || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index 48d7aff..c106102 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -513,6 +513,7 @@ all_tests = \
|
||||
tests/df/no-mtab-status.sh \
|
||||
tests/df/skip-duplicates.sh \
|
||||
tests/df/skip-rootfs.sh \
|
||||
+ tests/df/direct.sh \
|
||||
tests/dd/ascii.sh \
|
||||
tests/dd/direct.sh \
|
||||
tests/dd/misc.sh \
|
||||
--
|
||||
2.53.0
|
||||
2.31.1
|
||||
|
||||
|
||||
@ -20,14 +20,14 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
|
||||
bootstrap.conf | 1 +
|
||||
configure.ac | 2 +
|
||||
lib/mbfile.c | 3 +
|
||||
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++
|
||||
lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
m4/mbfile.m4 | 14 +++
|
||||
src/expand.c | 43 +++++---
|
||||
src/unexpand.c | 59 ++++++----
|
||||
tests/expand/mb.sh | 98 +++++++++++++++++
|
||||
src/expand.c | 43 +++++----
|
||||
src/unexpand.c | 54 +++++++----
|
||||
tests/expand/mb.sh | 98 ++++++++++++++++++++
|
||||
tests/local.mk | 2 +
|
||||
tests/unexpand/mb.sh | 114 +++++++++++++++++++
|
||||
10 files changed, 555 insertions(+), 36 deletions(-)
|
||||
tests/unexpand/mb.sh | 97 ++++++++++++++++++++
|
||||
10 files changed, 535 insertions(+), 34 deletions(-)
|
||||
create mode 100644 lib/mbfile.c
|
||||
create mode 100644 lib/mbfile.h
|
||||
create mode 100644 m4/mbfile.m4
|
||||
@ -35,10 +35,10 @@ Co-authored-by: Pádraig Brady <pbrady@redhat.com>
|
||||
create mode 100755 tests/unexpand/mb.sh
|
||||
|
||||
diff --git a/bootstrap.conf b/bootstrap.conf
|
||||
index fcf29dc..3eaedc3 100644
|
||||
index 8a0ff31..a1c78b2 100644
|
||||
--- a/bootstrap.conf
|
||||
+++ b/bootstrap.conf
|
||||
@@ -153,6 +153,7 @@ gnulib_modules="
|
||||
@@ -152,6 +152,7 @@ gnulib_modules="
|
||||
maintainer-makefile
|
||||
malloc-gnu
|
||||
manywarnings
|
||||
@ -47,10 +47,10 @@ index fcf29dc..3eaedc3 100644
|
||||
mbrtowc
|
||||
mbsalign
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 9b1ead0..c24ce2a 100644
|
||||
index 1e74b36..24c9725 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -439,6 +439,8 @@ fi
|
||||
@@ -427,6 +427,8 @@ fi
|
||||
# I'm leaving it here for now. This whole thing needs to be modernized...
|
||||
gl_WINSIZE_IN_PTEM
|
||||
|
||||
@ -350,7 +350,7 @@ index 0000000..8589902
|
||||
+ :
|
||||
+])
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 6183fb8..34a559b 100644
|
||||
index 9fa2e10..380e020 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -37,6 +37,9 @@
|
||||
@ -363,7 +363,7 @@ index 6183fb8..34a559b 100644
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "xstrndup.h"
|
||||
@@ -98,19 +101,19 @@ expand (void)
|
||||
@@ -100,19 +103,19 @@ expand (void)
|
||||
{
|
||||
/* Input stream. */
|
||||
FILE *fp = next_file (NULL);
|
||||
@ -387,7 +387,7 @@ index 6183fb8..34a559b 100644
|
||||
/* The following variables have valid values only when CONVERT
|
||||
is true: */
|
||||
|
||||
@@ -120,17 +123,23 @@ expand (void)
|
||||
@@ -122,17 +125,23 @@ expand (void)
|
||||
/* Index in TAB_LIST of next tab stop to examine. */
|
||||
size_t tab_index = 0;
|
||||
|
||||
@ -415,7 +415,7 @@ index 6183fb8..34a559b 100644
|
||||
{
|
||||
/* Column the next input tab stop is on. */
|
||||
uintmax_t next_tab_column;
|
||||
@@ -149,32 +158,34 @@ expand (void)
|
||||
@@ -151,32 +160,34 @@ expand (void)
|
||||
if (putchar (' ') < 0)
|
||||
die (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
@ -459,7 +459,7 @@ index 6183fb8..34a559b 100644
|
||||
}
|
||||
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 8fdd80f..8701eca 100644
|
||||
index 7801274..569a7ee 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -38,6 +38,9 @@
|
||||
@ -491,7 +491,7 @@ index 8fdd80f..8701eca 100644
|
||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||
- pending_blank = xmalloc (max_column_width);
|
||||
+ pending_blank = xnmalloc (max_column_width, sizeof (mbf_char_t));
|
||||
+ pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
|
||||
+
|
||||
+ mbf_init (mbf, fp);
|
||||
|
||||
@ -526,7 +526,7 @@ index 8fdd80f..8701eca 100644
|
||||
|
||||
if (blank)
|
||||
{
|
||||
@@ -180,30 +193,31 @@ unexpand (void)
|
||||
@@ -180,16 +193,16 @@ unexpand (void)
|
||||
if (next_tab_column < column)
|
||||
die (EXIT_FAILURE, 0, _("input line is too long"));
|
||||
|
||||
@ -544,10 +544,9 @@ index 8fdd80f..8701eca 100644
|
||||
- column++;
|
||||
+ column += mb_width (c);
|
||||
|
||||
- if (! (prev_blank && column == next_tab_column))
|
||||
+ if (! (prev_blank && column >= next_tab_column))
|
||||
if (! (prev_blank && column == next_tab_column))
|
||||
{
|
||||
/* It is not yet known whether the pending blanks
|
||||
@@ -197,13 +210,14 @@ unexpand (void)
|
||||
will be replaced by tabs. */
|
||||
if (column == next_tab_column)
|
||||
one_blank_before_tab_stop = true;
|
||||
@ -621,7 +620,7 @@ index 8fdd80f..8701eca 100644
|
||||
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
new file mode 100755
|
||||
index 0000000..dab27b4
|
||||
index 0000000..7971e18
|
||||
--- /dev/null
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -0,0 +1,98 @@
|
||||
@ -722,12 +721,12 @@ index 0000000..dab27b4
|
||||
+expand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+Exit $fail
|
||||
+exit $fail
|
||||
diff --git a/tests/local.mk b/tests/local.mk
|
||||
index fb74b5d..1f19f1b 100644
|
||||
index 192f776..8053397 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -561,6 +561,7 @@ all_tests = \
|
||||
@@ -544,6 +544,7 @@ all_tests = \
|
||||
tests/du/threshold.sh \
|
||||
tests/du/trailing-slash.sh \
|
||||
tests/du/two-args.sh \
|
||||
@ -735,7 +734,7 @@ index fb74b5d..1f19f1b 100644
|
||||
tests/id/gnu-zero-uids.sh \
|
||||
tests/id/no-context.sh \
|
||||
tests/id/context.sh \
|
||||
@@ -705,6 +706,7 @@ all_tests = \
|
||||
@@ -684,6 +685,7 @@ all_tests = \
|
||||
tests/touch/read-only.sh \
|
||||
tests/touch/relative.sh \
|
||||
tests/touch/trailing-slash.sh \
|
||||
@ -745,10 +744,10 @@ index fb74b5d..1f19f1b 100644
|
||||
# See tests/factor/create-test.sh.
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
new file mode 100755
|
||||
index 0000000..5b4252d
|
||||
index 0000000..60d4c1a
|
||||
--- /dev/null
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -0,0 +1,97 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+# Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
||||
@ -768,7 +767,6 @@ index 0000000..5b4252d
|
||||
+
|
||||
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
+print_ver_ unexpand
|
||||
+getlimits_
|
||||
+
|
||||
+export LC_ALL=en_US.UTF-8
|
||||
+
|
||||
@ -810,7 +808,7 @@ index 0000000..5b4252d
|
||||
+e\t|ascii(1)
|
||||
+\u00E9\t|composed(1)
|
||||
+e\u0301\t|decomposed(1)
|
||||
+\t|ideo-space(2)
|
||||
+\u3000\t|ideo-space(2)
|
||||
+\uFF0D\t|full-hypen(2)
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
@ -832,7 +830,7 @@ index 0000000..5b4252d
|
||||
+ä\xFF |
|
||||
+ ä\xFF|
|
||||
+\xFF ä|
|
||||
+äbcde\xFF |
|
||||
+äbcdef\xFF |
|
||||
+' > in || framework_failure_
|
||||
+
|
||||
+env printf '12345678
|
||||
@ -842,27 +840,11 @@ index 0000000..5b4252d
|
||||
+ä\xFF\t|
|
||||
+\tä\xFF|
|
||||
+\xFF\tä|
|
||||
+äbcde\xFF\t|
|
||||
+äbcdef\xFF\t|
|
||||
+' > exp || framework_failure_
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+for mb_mul in 4 6; do
|
||||
+ printf ' \n' | unexpand -t $(expr $SIZE_MAX / $mb_mul + 1) 2>err; ret=$?
|
||||
+ test "$ret" = 1 || test "$ret" = 0 || { cat err; fail=1; }
|
||||
+done
|
||||
+
|
||||
+# A blank whose display width exceeds the tab distance must not overrun
|
||||
+# the pending-blank buffer. With -t1 every column is a tab stop, so a
|
||||
+# width-2 ideographic space steps over the stop without landing on it;
|
||||
+# the run of blanks then grew pending_blank without bound.
|
||||
+ideo_space=$(env printf '\u3000')
|
||||
+{ yes "$ideo_space" | head -n 40000 | tr -d '\n'; echo; } |
|
||||
+ unexpand -t1 >out 2>err; ret=$?
|
||||
+test "$ret" = 0 || { cat err; fail=1; }
|
||||
+
|
||||
+Exit $fail
|
||||
--
|
||||
2.54.0
|
||||
2.7.4
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 34a559b..52d6ec1 100644
|
||||
index 380e020..310b349 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -127,15 +127,19 @@ expand (void)
|
||||
@@ -129,15 +129,19 @@ expand (void)
|
||||
|
||||
do
|
||||
{
|
||||
@ -27,7 +27,7 @@ index 34a559b..52d6ec1 100644
|
||||
if (convert)
|
||||
{
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index 6d5495f..fdef1d5 100644
|
||||
index 3bbbd66..863a90a 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -164,15 +164,19 @@ unexpand (void)
|
||||
@ -55,7 +55,7 @@ index 6d5495f..fdef1d5 100644
|
||||
if (convert)
|
||||
{
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
index dab27b4..3a5eb95 100755
|
||||
index 7971e18..031be7a 100755
|
||||
--- a/tests/expand/mb.sh
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -44,6 +44,20 @@ EOF
|
||||
@ -80,7 +80,7 @@ index dab27b4..3a5eb95 100755
|
||||
env printf '12345678
|
||||
e\t|ascii(1)
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
index a7b6ad0..92962f6 100755
|
||||
index 60d4c1a..8d75652 100755
|
||||
--- a/tests/unexpand/mb.sh
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -44,6 +44,22 @@ EOF
|
||||
|
||||
@ -4,16 +4,16 @@ Date: Thu, 7 Jul 2016 12:53:26 +0200
|
||||
Subject: [PATCH] coreutils-i18n-un-expand-BOM.patch
|
||||
|
||||
---
|
||||
src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++
|
||||
src/expand-common.h | 12 +++++
|
||||
src/expand.c | 45 ++++++++++++++++-
|
||||
src/unexpand.c | 43 +++++++++++++++-
|
||||
tests/expand/mb.sh | 71 +++++++++++++++++++++++++++
|
||||
tests/unexpand/mb.sh | 58 ++++++++++++++++++++++
|
||||
6 files changed, 341 insertions(+), 2 deletions(-)
|
||||
src/expand-common.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/expand-common.h | 12 ++++++
|
||||
src/expand.c | 45 +++++++++++++++++++-
|
||||
src/unexpand.c | 43 ++++++++++++++++++-
|
||||
tests/expand/mb.sh | 71 ++++++++++++++++++++++++++++++++
|
||||
tests/unexpand/mb.sh | 59 ++++++++++++++++++++++++++
|
||||
6 files changed, 342 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/expand-common.c b/src/expand-common.c
|
||||
index 20ab023..e1c8943 100644
|
||||
index 4657e46..97cbb09 100644
|
||||
--- a/src/expand-common.c
|
||||
+++ b/src/expand-common.c
|
||||
@@ -19,6 +19,7 @@
|
||||
@ -145,7 +145,7 @@ index 20ab023..e1c8943 100644
|
||||
to the list of tab stops. */
|
||||
extern void
|
||||
diff --git a/src/expand-common.h b/src/expand-common.h
|
||||
index cd32509..2ecf5e6 100644
|
||||
index 8cb2079..763bfda 100644
|
||||
--- a/src/expand-common.h
|
||||
+++ b/src/expand-common.h
|
||||
@@ -34,6 +34,18 @@ extern size_t max_column_width;
|
||||
@ -168,7 +168,7 @@ index cd32509..2ecf5e6 100644
|
||||
extern void
|
||||
add_tab_stop (uintmax_t tabval);
|
||||
diff --git a/src/expand.c b/src/expand.c
|
||||
index 52d6ec1..50a4590 100644
|
||||
index 310b349..4136824 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -103,11 +103,33 @@ expand (void)
|
||||
@ -235,7 +235,7 @@ index 52d6ec1..50a4590 100644
|
||||
}
|
||||
else
|
||||
diff --git a/src/unexpand.c b/src/unexpand.c
|
||||
index a818773..b37b319 100644
|
||||
index 863a90a..5681b58 100644
|
||||
--- a/src/unexpand.c
|
||||
+++ b/src/unexpand.c
|
||||
@@ -116,16 +116,36 @@ unexpand (void)
|
||||
@ -266,7 +266,7 @@ index a818773..b37b319 100644
|
||||
/* The worst case is a non-blank character, then one blank, then a
|
||||
tab stop, then MAX_COLUMN_WIDTH - 1 blanks, then a non-blank; so
|
||||
allocate MAX_COLUMN_WIDTH bytes to store the blanks. */
|
||||
pending_blank = xnmalloc (max_column_width, sizeof (mbf_char_t));
|
||||
pending_blank = xmalloc (max_column_width * sizeof (mbf_char_t));
|
||||
|
||||
- mbf_init (mbf, fp);
|
||||
+ if (found_bom == true)
|
||||
@ -305,7 +305,7 @@ index a818773..b37b319 100644
|
||||
}
|
||||
else
|
||||
diff --git a/tests/expand/mb.sh b/tests/expand/mb.sh
|
||||
index 3a5eb95..6d6497a 100755
|
||||
index 031be7a..1621c84 100755
|
||||
--- a/tests/expand/mb.sh
|
||||
+++ b/tests/expand/mb.sh
|
||||
@@ -109,4 +109,75 @@ env printf '12345678
|
||||
@ -383,15 +383,16 @@ index 3a5eb95..6d6497a 100755
|
||||
+LC_ALL=C expand in1 in1 > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
Exit $fail
|
||||
exit $fail
|
||||
diff --git a/tests/unexpand/mb.sh b/tests/unexpand/mb.sh
|
||||
index b1f0b2e..4d31ffd 100755
|
||||
index 8d75652..9d4ee3e 100755
|
||||
--- a/tests/unexpand/mb.sh
|
||||
+++ b/tests/unexpand/mb.sh
|
||||
@@ -127,4 +127,62 @@ ideo_space=$(env printf '\u3000')
|
||||
unexpand -t1 >out 2>err; ret=$?
|
||||
test "$ret" = 0 || { cat err; fail=1; }
|
||||
@@ -111,3 +111,62 @@ env printf '12345678
|
||||
|
||||
unexpand -a < in > out || fail=1
|
||||
compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+#BOM header test 1
|
||||
+printf "\xEF\xBB\xBF" > in; cat <<\EOF >> in || framework_failure_
|
||||
+1234567812345678123456781
|
||||
@ -402,6 +403,7 @@ index b1f0b2e..4d31ffd 100755
|
||||
+. . . .
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+env printf ' äöü\t. öüä. \tä xx\n' >> in || framework_failure_
|
||||
+
|
||||
+printf "\xEF\xBB\xBF" > exp; cat <<\EOF >> exp || framework_failure_
|
||||
+1234567812345678123456781
|
||||
@ -413,13 +415,13 @@ index b1f0b2e..4d31ffd 100755
|
||||
+ äöü . öüä. ä xx
|
||||
+EOF
|
||||
+
|
||||
+unexpand -a < in > out || fail=1
|
||||
+unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C unexpand -a < in > out || fail=1
|
||||
+LANG=C unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C unexpand -a < in > out || fail=1
|
||||
+LC_ALL=C unexpand < in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+
|
||||
@ -441,16 +443,14 @@ index b1f0b2e..4d31ffd 100755
|
||||
+EOF
|
||||
+
|
||||
+
|
||||
+unexpand -a in in > out || fail=1
|
||||
+unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LANG=C unexpand -a in in > out || fail=1
|
||||
+LANG=C unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
+LC_ALL=C unexpand -a in in > out || fail=1
|
||||
+LC_ALL=C unexpand in in > out || fail=1
|
||||
+compare exp out > /dev/null 2>&1 || fail=1
|
||||
+
|
||||
Exit $fail
|
||||
--
|
||||
2.54.0
|
||||
2.9.3
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ index 8cd0d6b..d23edd5 100644
|
||||
/* Look for the last blank. */
|
||||
while (logical_end)
|
||||
{
|
||||
@@ -215,11 +252,222 @@ fold_file (char const *filename, size_t width)
|
||||
@@ -215,11 +252,221 @@ fold_file (char const *filename, size_t width)
|
||||
line_out[offset_out++] = c;
|
||||
}
|
||||
|
||||
@ -282,7 +282,6 @@ index 8cd0d6b..d23edd5 100644
|
||||
+
|
||||
+ /* Get a wide character. */
|
||||
+ state_bak = state;
|
||||
+ convfail = 0;
|
||||
+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state);
|
||||
+
|
||||
+ switch (mblength)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Name: coreutils
|
||||
Version: 8.30
|
||||
Release: 20%{?dist}
|
||||
Release: 15%{?dist}
|
||||
License: GPLv3+
|
||||
Group: System Environment/Base
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
@ -62,9 +62,6 @@ Patch18: coreutils-9.0-autofs-no-mount.patch
|
||||
# basic support for checking NFSv4 ACLs (#2158747)
|
||||
Patch19: coreutils-nfsv4-acls.patch
|
||||
|
||||
# fix du being killed by SIGABRT on mutating xfs systems (RHEL-124174)
|
||||
Patch20: coreutils-8.30-du-fts-xfs-sigabrt.patch
|
||||
|
||||
# disable the test-lock gnulib test prone to deadlock
|
||||
Patch100: coreutils-8.26-test-lock.patch
|
||||
|
||||
@ -296,21 +293,6 @@ fi
|
||||
%license COPYING
|
||||
|
||||
%changelog
|
||||
* Wed Jun 10 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-20
|
||||
- unexpand: fix heap overflow when a wide blank overshoots a tab stop (RHEL-182699)
|
||||
|
||||
* Mon Jun 08 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-19
|
||||
- unexpand: fix stack overflow with large tabsizes (RHEL-182699)
|
||||
|
||||
* Sat Mar 21 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-18
|
||||
- fix df/direct.sh and unexpand/mb.sh tests (RHEL-151533)
|
||||
|
||||
* Mon Jan 26 2026 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-17
|
||||
- fold: fix processing of malformed UTF-8 sequences (RHEL-140117)
|
||||
|
||||
* Wed Oct 29 2025 Lukáš Zaoral <lzaoral@redhat.com> - 8.30-16
|
||||
- fix du being killed by SIGABRT on mutating xfs systems (RHEL-124174)
|
||||
|
||||
* Mon Jan 02 2023 Kamil Dudka <kdudka@redhat.com> - 8.30-15
|
||||
- basic support for checking NFSv4 ACLs (#2158747)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user