Repository navigation
fix(detection): use POSIX-compliant free disk space check on macOS and BSD - #5952
Closed
vaibhavsrv wants to merge 1 commit into
Closed
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
This was referenced Sep 19, 2026
Collaborator
|
Thanks for this contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
In
ods/installers/macos/lib/detection.sh,test_disk_space()usesdf -g "$path"to read available gigabytes, with a fallbackdf -BG "$path". The-Bflag is a GNU coreutils extension that is completely unsupported by BSD/macOSdf(which terminates with exit 64:df: illegal option -- B). Furthermore, the fallback was conditioned on[[ -z "$free_gb" || "$free_gb" == "0" ]], meaning that when a filesystem legitimately had zero gigabytes remaining (e.g. less than 1GB free), the script invoked the failing GNU command, clearing the variable instead of accurately reporting 0.This change conditions fallback execution on non-numeric or missing results (
[[ -z "$free_gb" || ! "$free_gb" =~ ^[0-9]+$ ]]) and replaces the GNU-BGcall with POSIX-standarddf -Pk "$path"(-Pfor portable 1-line format,-kfor 1024-byte blocks), computing gigabytes viaint($4 / 1048576). This guarantees reliable, portable disk space discovery across macOS, BSD, and containerized detection environments.Validation
df -gis unsupported or fails,df -BGexits with code 64, leavingfree_gbunpopulated. Additionally, legitimate 0GB free space erroneously triggered GNU fallback failure.df -Pk, properly computing available gigabytes without shell warnings or empty values. Legitimate 0GB values are preserved as integer 0.test_detection_disk_space_posix.pypasses cleanly (exit code 0). Wired into Linux CI workflow under Manifest Compatibility Checks.Overlap check
macos.sh. This PR ensures underlying hardware detection primitives report accurate disk metrics.Risk / AI disclosure
AI-assisted investigation, implementation, and test regressions. This aligns macOS disk space detection with the POSIX standard
df -Pkused across the rest of the installer codebase. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.Follow-up integration evidence
Composed with #5871, #5901, and #5951 at HEAD without conflicts. Production and test diffs passed together; compatibility and installer suites remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.