From 85c975df2c25bd799370b04bb294e568e001102f Mon Sep 17 00:00:00 2001 From: Rohan Sable 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 Reference: https://github.com/coreutils/coreutils/commit/85c975df2c25bd799370b04bb294e568e001102f Conflict: NEWS Context adaptation --- NEWS | 3 +++ src/ls.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index bae6ced..76a6986 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,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. + df no longer outputs duplicate remote mounts in the presence of bind mounts. [bug introduced in coreutils-8.26] diff --git a/src/ls.c b/src/ls.c index 8eb483d..cd23446 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1154,7 +1154,7 @@ do_statx (int fd, const char *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.27.0