[Bug 276632] LLVM std::filesystem::remove_all fails to handle dangling symlinks
Date: Fri, 26 Jan 2024 02:22:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276632
Bug ID: 276632
Summary: LLVM std::filesystem::remove_all fails to handle
dangling symlinks
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: markj@FreeBSD.org
remove_all_impl() will attempt to remove a file specified by its path,
recursing if it encounters a directory.
It opens the file with O_CLOEXEC | O_RDONLY | O_DIRECTORY | O_NOFOLLOW, which
for a dangling symlink returns EMLINK on FreeBSD, contradicting POSIX (which
says it should return ELOOP in this scenario). Bug 214633 notes this problem,
but fixing it would break compatibility.
remove_all_impl() however only handles ENOTDIR and ELOOP, so it incorrectly
returns an error in this situation on FreeBSD. We should extend it to check
for EMLINK as well.
--
You are receiving this mail because:
You are the assignee for the bug.