Skip to content

fix: fall back when macOS bulk directory reads are unavailable - #418

Merged
Byron merged 1 commit into
mainfrom
conditional-bulk-macos
Oct 25, 2026
Merged

Byron merged 1 commit into
mainfrom
conditional-bulk-macos

Conversation

@Byron

@Byron Byron commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-6.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Fixes #417.

dua-core unconditionally linked getattrlistbulk, which is unavailable on PowerPC and macOS before 10.10. A build script now checks the target architecture and MACOSX_DEPLOYMENT_TARGET, querying the target compiler's default when the environment variable is absent. Older targets and unknown compiler defaults use the existing ordinary-directory fallback while retaining the macOS entry/metadata API. The fallback also honors requested APFS clone metadata.

clock_gettime is separately excluded before macOS 10.12; the existing metadata probe already handles an unavailable CPU clock.

Fallback builds use a zero-sized bulk buffer to avoid an unused 64 KiB allocation per directory, as identified by the commit review.

Validation:

  • The regression failed before the fix: an Intel macOS 10.9-targeted build passed its tests but still referenced _getattrlistbulk and _clock_gettime.
  • The new macOS CI job runs workspace tests and verifies both symbols are absent for 10.9. Rebuilding for 10.10 verifies bulk reading returns while clock_gettime remains absent, including build-script reruns when the deployment target changes.
  • Local workspace checks, unit and journey tests, formatting, native and fallback Clippy, and a Linux dua-core cross-check passed.
  • Build-script tests cover version boundaries, invalid/unknown versions, and PowerPC. They also pass on Rust 1.88.

The legacy deployment tests run on modern macOS. Modern Rust raises these binaries' effective minimum OS version to its own supported floor; CI validates the selected backend's behavior and absence of unavailable dua-core symbols, rather than end-to-end legacy OS runtime compatibility. Actual legacy macOS/PowerPC hardware and mrustc were unavailable, and this does not lower the supported OS version of Rust's standard library or other dependencies.

…ble (#417)

The new implementation can have a performance impact if the bulk reads are turned
off, but this can be controlled with configuration so shouldn't be a problem.
Also, it's for old systems.

<!-- agent -->
PowerPC and macOS before 10.10 do not provide getattrlistbulk, so
unconditional native directory enumeration leaves dua-core consumers
with an undefined symbol at link time.

Select bulk reads from the target architecture and deployment version in
build.rs. Respect MACOSX_DEPLOYMENT_TARGET, otherwise query the target
compiler's default; unknown versions and architectures use ordinary
directory reads. Keep the existing macOS entry/metadata API and preserve
requested APFS clone metadata in the fallback.

Review identified an unused 64 KiB allocation per directory in fallback
builds. Make that buffer zero-sized, avoiding the heap allocation while
keeping the shared reader layout and fallback behavior.

Also omit clock_gettime before macOS 10.12, leaving the metadata probe's
existing missing-clock behavior in place.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron
Byron force-pushed the conditional-bulk-macos branch from fc7caf9 to 67c8576 Compare October 25, 2026 10:36
@Byron
Byron marked this pull request as ready for review October 25, 2026 11:39
@Byron
Byron merged commit fb5d863 into main Oct 25, 2026
4 checks passed
@Byron
Byron deleted the conditional-bulk-macos branch October 25, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS] getattrlistbulk is used unconditionally but may not be available, which breaks linking

1 participant