Bug 270419 - Executable files act as if they are empty directories for some operations
Summary: Executable files act as if they are empty directories for some operations
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Mateusz Guzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-23 16:30 UTC by Oliver Kiddle
Modified: 2023-03-23 20:23 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Kiddle 2023-03-23 16:30:01 UTC
Appending a slash and either one or two dots to an executable file is not producing errors about the file not being a directory as it does on FreeBSD 12. For example. ls -l /bin/df/.. will actually list the contents of /bin.

I might have assumed this was some odd historical quirk but testing FreeBSD 12.3 and 12.4, they don't exhibit this behaviour. I see the issue on 13.1 but have confirmed that it isn't specific to me or my system.

I found this because a Makefile was checking for the existence of file/. to test whether something is a file or a directory. For what it's worth, this works correctly on Solaris and Linux.
Comment 1 Dave Hayes 2023-03-23 18:56:04 UTC
As of FreeBSD 13.2-STABLE #0 stable/13-dc1ba2a43 I can confirm this bug is present on said system.
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-03-23 19:32:26 UTC
A commit in branch main references this bug:

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

commit c16c4ea6d399332d4a023df6e423be61fdb875a5
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-23 19:19:48 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-23 19:31:18 +0000

    vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups

    Reported by:    Oliver Kiddle
    PR:     270419
    MFC:    3 days

 sys/kern/vfs_cache.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 3 Mateusz Guzik freebsd_committer freebsd_triage 2023-03-23 19:32:39 UTC
Hello,

confirmed and fixed:  https://cgit.FreeBSD.org/src/commit/?id=c16c4ea6d399332d4a023df6e423be61fdb875a5

will make sure it lands in 13.2
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-03-23 19:59:33 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5d83656c09f522d6bf4f1050be60f270ddef04af

commit 5d83656c09f522d6bf4f1050be60f270ddef04af
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-23 19:19:48 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-23 19:59:08 +0000

    vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups

    Reported by:    Oliver Kiddle
    PR:     270419
    MFC:    3 days

    (cherry picked from commit c16c4ea6d399332d4a023df6e423be61fdb875a5)

 sys/kern/vfs_cache.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-03-23 20:23:38 UTC
A commit in branch releng/13.2 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=276e405a50d36229df308642b30e6e66372d39f2

commit 276e405a50d36229df308642b30e6e66372d39f2
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-23 19:19:48 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-23 20:22:20 +0000

    vfs cache: return ENOTDIR for not_a_dir/{.,..} lookups

    Reported by:    Oliver Kiddle
    PR:     270419
    MFC:    3 days
    Approved by:    re (gjb)

    (cherry picked from commit c16c4ea6d399332d4a023df6e423be61fdb875a5)
    (cherry picked from commit 5d83656c09f522d6bf4f1050be60f270ddef04af)

 sys/kern/vfs_cache.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 6 Mateusz Guzik freebsd_committer freebsd_triage 2023-03-23 20:23:58 UTC
All relevant commits landed:
- fix to main
- fix to stable/13
- fix to upcomming 13.2

as such I'm closing this bz

thanks for reporting