]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: suppress ENOENT errors when reading ACL info
authorPádraig Brady <P@draigBrady.com>
Sun, 30 Mar 2025 14:16:54 +0000 (15:16 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 31 Mar 2025 16:17:01 +0000 (17:17 +0100)
* src/ls.c (gobble_file): Indicating unknown ACL info with '?'
suffices for the edge case of a file being removed while reading,
or older cygwin when reading through dangling symlinks.
Reported by Corinna Vinschen.

src/ls.c

index 46ec42037b82f1ed3a0bf2ea96c8829003c7720d..2cf4ee444437ef5e192db5610dd3534efffaea29 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3538,8 +3538,14 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
 
       /* Let the user know via '?' if errno is EACCES, which can
          happen with Linux kernel 6.12 on an NFS file system.
-         That's better than a longwinded diagnostic.  */
-      bool cannot_access_acl = n < 0 && errno == EACCES;
+         That's better than a longwinded diagnostic.
+
+         Similarly, ignore ENOENT which may happen on some versions
+         of cygwin when processing dangling symlinks for example.
+         Also if a file is removed while we're reading ACL info,
+         ACL_T_UNKNOWN is sufficient indication for that edge case.  */
+      bool cannot_access_acl = n < 0
+           && (errno == EACCES || errno == ENOENT);
 
       f->acl_type = (!have_scontext && !have_acl
                      ? (cannot_access_acl ? ACL_T_UNKNOWN : ACL_T_NONE)