You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
segfault on macOS 26.3 when compiled against SDK 26.4Â #229
Environment: macOS 26.3.1 (build 25D2128, Darwin 25.3.0), arm64, Apple clang 17.0.0.
Reproduced on 4.1.2 installed from Homebrew and on current main (0cd3d15) built from source.
$ SDKROOT=/path/to/MacOSX26.4.sdk ./configure
$ SDKROOT=/path/to/MacOSX26.4.sdk make
...
$ mkdir -p /tmp/t/a/b
$ ./bin/bfs /tmp/t -maxdepth 1 -type d ;echo"exit=$?"# exit=0, prints fine
$ ./bin/bfs /tmp/t -type d ;echo"exit=$?"# exit=139 (SIGSEGV on descent)
Building against the 26.2 SDK produces a correct binary. The crash appears only the moment bfs descends into a subdirectory; -maxdepth 1 is fine.
Commentary
config.h diff shows fdclosedir is the sole difference:
The configure probe build/has/fdclosedir.c only checks that the symbol compiles and links. Against the 26.4 SDK this links (the symbol is weak-imported), but at runtime on 26.3.x the symbol is absent and resolves to NULL, so directory descent segfaults.
The compiler already flags this during the probe build, but the warning is non-fatal so the probe ignores it:
warning: 'fdclosedir' is only available on macOS 26.4 or newer [-Wunguarded-availability-new]
note: ... introduced in macOS 26.4 here, but the deployment target is macOS 26.0.0
note: enclose 'fdclosedir' in a __builtin_available check to silence this warning
The fix should probably be to beef up the configure check (as a fallback path exists), or to gate the symbol at runtime on macOS.
I didn't submit a PR because I didn't observe any existing pattern in the repo for either solution, but am happy to do so with guidance.
Thanks for the report! I was able to reproduce and fix on a new macOS. But now I don't have 26.3 lying around so if you feel like checking that it no longer segfaults, I'd appreciate it
Activity
dir: Check for fdclosedir() availability at runtime on macOS
tavianator commentedon Jun 15, 2026
Thanks for the report! I was able to reproduce and fix on a new macOS. But now I don't have 26.3 lying around so if you feel like checking that it no longer segfaults, I'd appreciate it
bmwalters commentedon Jun 15, 2026
Works great, thank you!
tavianator commentedon Jun 16, 2026
Fix released in bfs 4.1.3