This prevents an attacker from spoofing argv[0] to bypass apparmor restrictions.
- `env -a false ls` now correctly runs `ls` instead of dispatching as `false`
- Also works under masked `/proc` (does not rely on /proc/self/exe).
Closes#10135
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 https://github.com/uutils/coreutils/commit/21d5cef15308c018bcb0b34fcbdff47a24aa9fa6
- 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>
- Make colorize() function private since only used internally
- Remove redundant colors_enabled checks
- Add apply_color helper closure to reduce code duplication
- Remove try_ prefix from function names for consistency
- Update all utilities to use renamed functions
- Fix app variable reference in mv utility
Minor cleanup using clippy autofix. This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs.
```
cargo clippy --fix --workspace -- -A clippy::all -W clippy::uninlined_format_args && cargo fmt
```