From 338c7128365883f2d0c29141fbf998e4caf5c6d1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 15 2022 06:56:25 +0000 Subject: import coreutils-8.32-32.el9 --- diff --git a/SOURCES/coreutils-9.0-autofs-no-mount.patch b/SOURCES/coreutils-9.0-autofs-no-mount.patch new file mode 100644 index 0000000..b6d6523 --- /dev/null +++ b/SOURCES/coreutils-9.0-autofs-no-mount.patch @@ -0,0 +1,87 @@ +From f4422844dbcd839ce486bcbc15b7bd5b72c9198d Mon Sep 17 00:00:00 2001 +From: Rohan Sable +Date: Mon, 7 Mar 2022 14:14:13 +0000 +Subject: [PATCH 1/2] ls: avoid triggering automounts + +statx() has different defaults wrt automounting +compared to stat() or lstat(), so explicitly +set the AT_NO_AUTOMOUNT flag to suppress that behavior, +and avoid unintended operations or potential errors. + +* src/ls.c (do_statx): Pass AT_NO_AUTOMOUNT to avoid this behavior. +Fixes https://bugs.gnu.org/54286 + +Signed-off-by: Rohan Sable + +Upstream-commit: 85c975df2c25bd799370b04bb294e568e001102f +Signed-off-by: Kamil Dudka +--- + src/ls.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ls.c b/src/ls.c +index 1047801..fe0e9f8 100644 +--- a/src/ls.c ++++ b/src/ls.c +@@ -1175,7 +1175,7 @@ do_statx (int fd, char const *name, struct stat *st, int flags, + { + struct statx stx; + bool want_btime = mask & STATX_BTIME; +- int ret = statx (fd, name, flags, mask, &stx); ++ int ret = statx (fd, name, flags | AT_NO_AUTOMOUNT, mask, &stx); + if (ret >= 0) + { + statx_to_stat (&stx, st); +-- +2.34.1 + + +From 3d227f9e4f3fe806064721e4b9451ee06526bc80 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Mon, 7 Mar 2022 23:29:20 +0000 +Subject: [PATCH 2/2] stat: only automount with --cached=never + +Revert to the default behavior before the introduction of statx(). + +* src/stat.c (do_stat): Set AT_NO_AUTOMOUNT without --cached=never. +* doc/coreutils.texi (stat invocation): Mention the automount +behavior with --cached=never. + +Fixes https://bugs.gnu.org/54287 + +Upstream-commit: 92cb8427c537f37edd43c5cef1909585201372ab +Signed-off-by: Kamil Dudka +--- + doc/coreutils.texi | 1 + + src/stat.c | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/doc/coreutils.texi b/doc/coreutils.texi +index 19b535c..0f5c16a 100644 +--- a/doc/coreutils.texi ++++ b/doc/coreutils.texi +@@ -12564,6 +12564,7 @@ Always read the already cached attributes if available. + + @item never + Always sychronize with the latest file system attributes. ++This also mounts automounted files. + + @item default + Leave the caching behavior to the underlying file system. +diff --git a/src/stat.c b/src/stat.c +index 0c34501..803340a 100644 +--- a/src/stat.c ++++ b/src/stat.c +@@ -1381,6 +1381,9 @@ do_stat (char const *filename, char const *format, char const *format2) + else if (force_sync) + flags |= AT_STATX_FORCE_SYNC; + ++ if (! force_sync) ++ flags |= AT_NO_AUTOMOUNT; ++ + fd = statx (fd, pathname, flags, format_to_mask (format), &stx); + if (fd < 0) + { +-- +2.34.1 + diff --git a/SOURCES/coreutils-df-direct.patch b/SOURCES/coreutils-df-direct.patch index 248a6ae..88015a1 100644 --- a/SOURCES/coreutils-df-direct.patch +++ b/SOURCES/coreutils-df-direct.patch @@ -1,8 +1,20 @@ +From 6e36198f10a2f63b89c89ebb5d5c185b20fb3a63 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Mon, 29 Mar 2010 17:20:34 +0000 +Subject: [PATCH] coreutils-df-direct.patch + +--- + doc/coreutils.texi | 7 ++++++ + src/df.c | 34 ++++++++++++++++++++++++++-- + tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++ + 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 a507280..400e135 100644 +index 5b9a597..6810c15 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi -@@ -11303,6 +11303,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. @@ -17,10 +29,10 @@ index a507280..400e135 100644 @opindex --total @cindex grand total of disk size, usage and available space diff --git a/src/df.c b/src/df.c -index 8f760db..a7385fd 100644 +index 48025b9..c8efa5b 100644 --- a/src/df.c +++ b/src/df.c -@@ -120,6 +120,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; @@ -30,7 +42,7 @@ index 8f760db..a7385fd 100644 /* Grand total data. */ static struct fs_usage grand_fsu; -@@ -247,13 +250,15 @@ enum +@@ -252,13 +255,15 @@ enum NO_SYNC_OPTION = CHAR_MAX + 1, SYNC_OPTION, TOTAL_OPTION, @@ -47,7 +59,7 @@ index 8f760db..a7385fd 100644 {"inodes", no_argument, NULL, 'i'}, {"human-readable", no_argument, NULL, 'h'}, {"si", no_argument, NULL, 'H'}, -@@ -509,7 +514,10 @@ get_header (void) +@@ -561,7 +566,10 @@ get_header (void) for (col = 0; col < ncolumns; col++) { char *cell = NULL; @@ -59,7 +71,7 @@ index 8f760db..a7385fd 100644 if (columns[col]->field == SIZE_FIELD && (header_mode == DEFAULT_MODE -@@ -1397,6 +1405,19 @@ 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) { @@ -68,9 +80,7 @@ index 8f760db..a7385fd 100644 + char *resolved = canonicalize_file_name (name); + if (resolved) + { -+ char *mp = find_mount_point (name, statp); -+ get_dev (NULL, mp, resolved, NULL, NULL, false, false, NULL, false); -+ free(mp); ++ get_dev (NULL, resolved, name, NULL, NULL, false, false, NULL, false); + free (resolved); + return; + } @@ -79,7 +89,7 @@ index 8f760db..a7385fd 100644 if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode)) && get_disk (name)) return; -@@ -1467,6 +1488,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\ @@ -87,7 +97,7 @@ index 8f760db..a7385fd 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); -@@ -1557,6 +1579,9 @@ main (int argc, char **argv) +@@ -1624,6 +1644,9 @@ main (int argc, char **argv) xstrtol_fatal (e, oi, c, long_options, optarg); } break; @@ -97,7 +107,7 @@ index 8f760db..a7385fd 100644 case 'i': if (header_mode == OUTPUT_MODE) { -@@ -1653,6 +1678,13 @@ main (int argc, char **argv) +@@ -1720,6 +1743,13 @@ main (int argc, char **argv) } } @@ -172,3 +182,6 @@ index 0000000..8e4cfb8 +compare file_out file_exp || fail=1 + +Exit $fail +-- +2.31.1 + diff --git a/SPECS/coreutils.spec b/SPECS/coreutils.spec index d357a71..16c70c0 100644 --- a/SPECS/coreutils.spec +++ b/SPECS/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.32 -Release: 31%{?dist} +Release: 32%{?dist} License: GPLv3+ Url: https://www.gnu.org/software/coreutils/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz @@ -64,6 +64,9 @@ Patch16: coreutils-8.32-tail-use-poll.patch # df: fix duplicated remote entries due to bind mounts (#1979814) Patch17: coreutils-8.32-df-duplicated-entries.patch +# ls, stat: avoid triggering automounts (#2044981) +Patch18: coreutils-9.0-autofs-no-mount.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch @@ -320,6 +323,10 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %license COPYING %changelog +* Tue Mar 01 2022 Kamil Dudka - 8.32-32 +- ls, stat: avoid triggering automounts (#2044981) +- make `df --direct` work again (#2058686) + * Mon Aug 09 2021 Mohan Boddu - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688