It is better to check whether we're actually compiling libstdbuf, rather than to check whether
we're on windows, in order to decide whether libstdbuf should get installed.
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
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 (#8581, #7996, #7695, #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 #8795
The make build was failing when the list of UTILS didn't contain stdbuf.
This fixes this issue by adding feat_externa_libstdbuf only when stdbuf is being compiled.
Fixes https://github.com/uutils/coreutils/issues/8701
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
In the context of musl, users are typically expecting statically-linked tools,
as this is one of musl's strong suits and one of the biggest reasons to use it
instead of glibc (that is not static-link-friendly for reasons).
- remove the build-flag which was causing musl libc to be linked dynamically
- re-add feat_os_unix_musl which was removed in 21d5cef153
- exclude stdbuf from feat_os_unix_musl, since libstdbuf.so can't be built with a statically linked musl libc
- add test_musl_no_dynamic_deps so that this does not regress in the future
Fixes https://github.com/uutils/coreutils/issues/8572
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* add support for systemd-logind
Add support for systemd-logind for systems where `/var/run/utmp` does not exist any more (e.g. Ubuntu 25.04).
Here is some context explaining the switch from utmp to systemd-logind:
https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/
Fixes https://github.com/uutils/coreutils/issues/8376
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* fix duplicated boot record
When feature feat_systemd_logind is enabled and utmp is present, two boot records were printed.
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* improve error forwarding
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* remove unnecessary negation in if/else block
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* use getpwuid_r() instead of getpwuid()
getpwuid() is not thread-safe.
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* improve error handling
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* use Path instead of string
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* use closure to reduce the number of clones() calls
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* use MaybeUninit instead of mem::zeroed()
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* systemd-logind: add some unit-tests
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* use sysconf(_SC_GETPW_R_SIZE_MAX) instead of 1024
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* fix cspell
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* add auto-enablement of feat_systemd_logind in GNUmakefile
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* Revert "add auto-enablement of feat_systemd_logind in GNUmakefile"
This breaks "Tests/BusyBox test suite" in CI.
This reverts commit 16626d4653.
---------
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
- Added devcontainer configuration based on Ubuntu 24.04
- Added GitHub Actions workflow for devcontainer testing
- Update cSpell configuration to ingore spelling in devcontainer configs
- Update pre-commit hooks to exclude cSpell.json because pre-commit
fails for that file due to json with comments format
- Fix filename for cSpell config in vscode settings
- Two tests in `test_dd.rs` are now skipped if /dev/sda1 is not
available, which is the case in devcontainer
- Update check for existing gnu clone in build-gnu.sh, not checking the
existence of the directory but the presence of the .git directory.
This allows us to have the directly as a volume mount in devcontainer
- Remove temporary file `g` after use in build-gnu.sh