File coreutils-ls-avoid-triggering-automounts.patch of Package coreutils.33724
From 85c975df2c25bd799370b04bb294e568e001102f Mon Sep 17 00:00:00 2001
From: Rohan Sable <rsable@redhat.com>
Date: Mon, 7 Mar 2022 14:14:13 +0000
Subject: [PATCH] ls: avoid triggering automounts
Commit: 85c975df2c25bd799370b04bb294e568e001102f
Patch-mainline: v9.1
References: bsc#1221632
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.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/54286
Signed-off-by: Rohan Sable <rsable@redhat.com>
Acked-by: Thomas Abraham <tabraham@suse.com>
---
NEWS | 3 +++
src/ls.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index af6596b06..a3442c5dd 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ GNU coreutils NEWS -*- outline -*-
** Bug fixes
+ ls no longer tries to automount files, reverting to the behavior
+ before the statx() call was introduced in coreutils-8.32.
+
cp now copies /dev/fd/N correctly on platforms like Solaris where
it is a character-special file whose minor device number is N.
[bug introduced in fileutils-4.1.6]
diff --git a/src/ls.c b/src/ls.c
index 1930e4abb..255789061 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1177,7 +1177,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.35.3