[Bug 287451] [/bin/ls] readdir() errors delivered via fts_children() are silently discarded

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 12 Apr 2026 03:17:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287451

--- Comment #2 from commit-hook@FreeBSD.org ---
A commit in branch stable/15 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=7bb6c194c9695377a643b26b59be4af4852c8227

commit 7bb6c194c9695377a643b26b59be4af4852c8227
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-02-11 19:55:55 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-04-12 03:15:15 +0000

    ls: check fts_children() for errors that may not surface otherwise

    In particular, if one simply does a non-recursive `ls` on a directory
    that is not accessible, there are some classes of errors that may cause
    it to fail that wouldn't be surfaced unless we do an fts_read() that
    will recurse into the inaccessible directory.  Catch those kinds of
    errors here since we cannot expect to an FTS_ERR/FTS_DNR entry to follow
    up on them.

    PR:             287451
    Reviewed by:    kib
    Discusssed with:        des

    (cherry picked from commit 7bf81e39d83087dc7f984077b5eed5a48df794d4)

 bin/ls/ls.c              | 17 +++++++++++++++++
 bin/ls/tests/ls_tests.sh | 30 ++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

-- 
You are receiving this mail because:
You are on the CC list for the bug.