GNU bug report logs - #54286
[PATCH] Fix ls -l triggering automounts.

Previous Next

Package: coreutils;

Reported by: Rohan Sable <rsable <at> redhat.com>

Date: Mon, 7 Mar 2022 07:57:02 UTC

Severity: normal

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rohan Sable <rsable <at> redhat.com>
To: bug-coreutils <at> gnu.org
Cc: ikent <at> redhat.com, rohanjsable <at> gmail.com, kdudka <at> redhat.com
Subject: [PATCH] Fix ls -l triggering automounts.
Date: Mon, 7 Mar 2022 13:24:02 +0530
Running ls -l on a path that has autofs mounts,
triggers a mount or in case of unmountable shares,
triggers errors :
~~~
[root <at> rsablerhel85 mnt2]# ll
ls: cannot access 'testshare2': No such file or directory     <<<<< Error
total 0
drwxrwxrwx. 3 1000 1000 15 Jan 17 12:08 testshare             <<<<< mount is triggerd for testshare
d?????????? ? ?    ?     ?            ? testshare2            <<<<< Path we know that is inaccessible throws an error

[root <at> rsablerhel85 mnt2]# mount | grep -i test
rsable76server:/testshare on /mnt2/testshare type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=6,sec=sys,mountaddr=192.168.122.58,mountvers=3,mountport=20048,mountproto=tcp,local_lock=none,addr=192.168.122.58)
~~~

Added AT_NO_AUTOMOUNT flag to do_lstat to fix this behavior.

Signed-off-by: Rohan Sable <rsable <at> redhat.com>
---
 src/ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ls.c b/src/ls.c
index 1930e4abb..bf79ef8b9 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1204,7 +1204,7 @@ do_stat (char const *name, struct stat *st)
 static int
 do_lstat (char const *name, struct stat *st)
 {
-  return do_statx (AT_FDCWD, name, st, AT_SYMLINK_NOFOLLOW, calc_req_mask ());
+  return do_statx (AT_FDCWD, name, st, AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT, calc_req_mask ());
 }
 
 static int
-- 
2.34.1





This bug report was last modified 3 years and 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.