Running ls -l on a path that has autofs mounts, triggers a mount or in case of unmountable shares, triggers errors : ~~~ [root@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@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 <rsa...@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