-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: Add cross-platform stubs and gate SELinux to Linux-only #8795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add cross-platform stubs and gate SELinux to Linux-only #8795
Conversation
GNU testsuite comparison:
|
CodSpeed Performance ReportMerging #8795 will not alter performanceComparing Summary
Footnotes
|
GNU testsuite comparison:
|
The selinux and fts-sys crates should only be required on Linux platforms. This change moves these dependencies from the unconditional [dependencies] section to [target.'cfg(target_os = "linux")'.dependencies] in both chcon and runcon Cargo.toml files. Without this fix, macOS builds fail because Cargo attempts to resolve Linux-only dependencies on non-Linux platforms, even though the Rust code itself is properly gated with #[cfg(target_os = "linux")]. Changes: - chcon: Move selinux and fts-sys to Linux-only dependencies - runcon: Move selinux to Linux-only dependencies - runcon: Move selinux feature in uucore to Linux-only section This ensures that on non-Linux platforms (macOS, Windows): - chcon and runcon build as stubs with empty main() - No SELinux libraries are linked - The workspace builds successfully without SELinux dependencies On Linux platforms: - All SELinux functionality remains unchanged - selinux and fts-sys are included as before - No regression in behavior Resolves the macOS CI build failure (exit code 101) in PR uutils#8795.
GNU testsuite comparison:
|
GNU testsuite comparison:
|
Could you please add a test in github action to make it works? |
…ssages Address maintainer feedback to verify SELinux utilities build as stubs on non-Linux platforms (macOS, Windows). Changes: - Add dedicated GitHub Actions job 'test_selinux_stubs' to verify chcon/runcon build successfully on macOS and Windows - Enhance stub implementations with user-friendly error messages instead of silent success - Test binary creation, compilation, and workspace integration Benefits: - Ensures cross-platform builds remain functional in CI - Provides clear feedback to users on unsupported platforms - Matches GNU coreutils behavior (error message + exit code 1) - Prevents confusion when utilities are accidentally invoked Test coverage: - Builds uu_chcon and uu_runcon explicitly on macOS/Windows - Verifies stub binaries are created - Validates cargo check succeeds - Ensures full workspace builds with stubs present Addresses feedback from @sylvestre in PR uutils#8795
0441999
to
caf9d42
Compare
Gate SELinux functionality to Linux-only and provide stub implementations for chcon/runcon on non-Linux platforms to maintain cross-platform builds. Changes: - Gate all SELinux code with target_os = "linux" checks - Add stub main() for chcon/runcon on non-Linux with user-friendly errors - Add CI job to verify stubs build correctly on macOS and Windows - Update ls to check both selinux feature AND target_os Benefits: - Fixes build failures on macOS/Windows (uutils#8581, uutils#7996, uutils#7695, uutils#6491) - Maintains workspace buildability across all platforms - Provides clear error messages instead of silent failures - Prevents accidental SELinux usage on unsupported platforms CI Testing: - New 'Build/SELinux-Stubs (Non-Linux)' job tests macOS and Windows - Verifies stub binaries are created and compilation succeeds - Validates full workspace builds with stubs present Addresses maintainer feedback in PR uutils#8795
GNU testsuite comparison:
|
Gate SELinux functionality to Linux-only and provide stub implementations for chcon/runcon on non-Linux platforms to maintain cross-platform builds. Changes: - Gate all SELinux code with target_os = "linux" checks - Add stub main() for chcon/runcon on non-Linux with user-friendly errors - Add CI job to verify stubs build correctly on macOS and Windows - Update ls to check both selinux feature AND target_os Benefits: - Fixes build failures on macOS/Windows (uutils#8581, uutils#7996, uutils#7695, uutils#6491) - Maintains workspace buildability across all platforms - Provides clear error messages instead of silent failures - Prevents accidental SELinux usage on unsupported platforms CI Testing: - New 'Build/SELinux-Stubs (Non-Linux)' job tests macOS and Windows - Verifies stub binaries are created and compilation succeeds - Validates full workspace builds with stubs present Addresses maintainer feedback in PR uutils#8795
caf9d42
to
e01cb60
Compare
GNU testsuite comparison:
|
please write the PR description yourself |
GNU testsuite comparison:
|
I have reverted the body of PR to the old version |
in general, please keep in mind that you are exchanging with a human and not an ai ... |
It seems we still need |
Summary
Why
Issues Resolved
Closes #8581
Closes #7996
Closes #7695
Closes #6491
Files Changed
Testing
Verified that chcon and runcon build successfully on macOS as stub implementations that exit gracefully.