coreutils/backport-ls-avoid-triggering-automounts.patch

54 lines
1.8 KiB
Diff
Raw Normal View History

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
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>
Reference:https://github.com/coreutils/coreutils/commit/85c975df2c25bd799370b04bb294e568e001102f
Conflict:Context adaptation
---
NEWS | 2 ++
src/ls.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index d1fd1dc..0ce883f 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,8 @@ GNU coreutils NEWS -*- outline -*-
invalid speed arguments. Now they're validated against both the
general accepted set, and the system supported set of valid speeds.
[This bug was present in "the beginning".]
+ ls no longer tries to automount files, reverting to the behavior
+ before the statx() call was introduced in coreutils-8.32.
chmod -v no longer misreports modes of dangling symlinks.
[bug introduced in coreutils-5.3.0]
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.33.0