- remove "WaitingFailed" which is a duplicate of "CommandTimedOut"
- replace hard-coded values 126 and 127 with enum values, remove TODO
- fix misleading comment. we DO return CommandTimedOut even when preserve-status is not specified
- add tests for exit values 126 and 127
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
This FIXME comment was added in 2021 ( 5431e947bc ).
`timeout` is already in feat_require_unix_core, so having `true` and `false` on
the machine running the test is quite reasonable and does not warrant a FIXME.
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
* feat(chmod): use dirfd for recursive subdirectory traversal
- Update chmod recursive logic to use directory file descriptors instead of full paths for subdirectories
- Improves performance, avoids path length issues, and ensures dirfd-relative openat calls
- Add test to verify strace output shows no AT_FDCWD with multi-component paths
* test(chmod): add spell-check ignore for dirfd, subdirs, openat, FDCWD
Added a spell-checker ignore directive in the chmod test file to suppress false positives for legitimate technical terms used in Unix API calls.
* test(chmod): enforce strace requirement in recursive test, fail fast instead of skip
Previously, the test_chmod_recursive_uses_dirfd_for_subdirs test skipped gracefully if strace
was unavailable, without failing. This change enforces the strace dependency by failing the
test immediately if strace is not installed or runnable, ensuring the test runs reliably
in environments where it is expected to pass, and preventing silent skips.
* ci: install strace in Ubuntu CI jobs for debugging system calls
Add installation of strace tool on Ubuntu runners in both individual build/test and feature build/test jobs. This enables tracing system calls during execution, aiding in debugging and performance analysis within the CI/CD pipeline. Updated existing apt-get commands and added conditional steps for Linux-only installations.
* ci: Add strace installation to Ubuntu-based CI workflows
Install strace on ubuntu-latest runners across multiple jobs to enable system call tracing for testing purposes, ensuring compatibility with tests that require this debugging tool. This includes updating package lists in existing installation steps.
* chore(build): install strace and prevent apt prompts in Cross.toml pre-build
Modified the pre-build command to install strace utility for debugging and added -y flag to apt-get install to skip prompts, ensuring non-interactive builds.
* feat(build): support Alpine-based cross images in pre-build
Detect package manager (apt vs apk) to install tzdata and strace
in both Debian/Ubuntu and Alpine *-musl targets. Added fallback
warning for unsupported managers. This ensures strace is available
for targets using Alpine, which doesn't have apt-get.
* refactor(build): improve pre-build script readability by using multi-line strings
Replace escaped multi-line string with triple-quoted string for better readability in Cross.toml.
* feat(ci): install strace in WSL2 GitHub Actions workflow
Install strace utility in the WSL2 environment to support tracing system calls during testing. Minor update to Cross.toml spell-checker ignore list for consistency with change.
* ci(wsl2): install strace as root with non-interactive apt-get
Updated the WSL2 workflow step to use root shell (wsl-bash-root) for installing strace, removing sudo calls and adding DEBIAN_FRONTEND=noninteractive to prevent prompts. This improves CI reliability by ensuring direct root access and automated, interrupt-free package installation.
* ci: Move strace installation to user shell and update spell ignore
Fix WSL2 GitHub Actions workflow by installing strace as the user instead of root for better permission handling, and add "noninteractive" to the spell-checker ignore comment for consistency with the new apt-get command. This ensures the tool is available in the testing environment without unnecessary privilege escalation.
* chore: ci: remove unused strace installation from CI workflows
Remove strace package installation from multiple GitHub Actions workflow files (CICD.yml, l10n.yml, wsl2.yml). Strace was historically installed in Ubuntu jobs for debugging system calls, but it's no longer required for the tests and builds, reducing CI setup time and dependencies.
* ci: add strace installation and fix spell-checker comments in CI files
- Install strace package in CICD workflow to support safe traversal verification for utilities like rm, chmod, chown, chgrp, mv, and du, enabling syscall tracing for testing.
- Clean up spell-checker ignore comments in wsl2.yml and Cross.toml by removing misplaced flags.第二个测试产品**ci: add strace installation and fix spell-checker comments in CI files**
- Install strace package in CICD workflow to support safe traversal verification for utilities like rm, chmod, chown, chgrp, mv, and du, enabling syscall tracing for testing.
- Clean up spell-checker ignore comments in wsl2.yml and Cross.toml by removing misplaced flags.
* test: add regression guard for recursive chmod dirfd-relative traversal
Add a check in check-safe-traversal.sh to ensure recursive chmod operations use dirfd-relative openat calls instead of AT_FDCWD with multi-component paths, preventing potential race conditions. Ignore the corresponding Rust test as it is now covered by this shell script guard.
This commit differentiates Base64 strings that are known to be invalid
before decoding (because their length is not a multiple of 4), from
Base64 strings that are invalid at decoding (padding is invalid).
* feat: add compact float formatting for half and bfloat16 in od
Implement trim_float_repr() to remove trailing zeros from float strings while preserving signs and exponents, and pad_float_repr() to align trimmed floats to fixed width. Update format_item_f16() and format_item_bf16() to produce compact output matching GNU od. Add regression tests for float16 and bfloat16 compact printing.
* refactor(od): format multiline format! in format_item_bf16 for readability
Reformat the format! macro call in the format_item_bf16 function in prn_float.rs
to span multiple lines, improving code readability without changing functionality.
* fix(od): preserve canonical precision for f16/bf16 float formats
Remove trimming of trailing zeros from f16 and bf16 float representations
in od output to maintain original precision and align behavior with
f32/f64 formatters, ensuring stable output across platforms. Update
corresponding tests to reflect the change in expected output.
* refactor(od): simplify float padding format and update tests
- Remove redundant `width = width` parameter from `format!` macro in `pad_float_repr`
- Add "bfloat" to spell-checker ignore list for better test coverage on bf16 format
* feat(od): trim trailing zeros in float outputs for GNU compatibility
Add `trim_trailing_zeros` function to remove trailing zeros and redundant decimal points from formatted floats, ensuring compact output matching GNU od for f16 and bf16 types. Update `format_item_f16` and `format_item_bf16` to apply trimming before padding.
* fix: preserve trailing zeros in F16 and BF16 float formats to match GNU od output
Remove the `trim_trailing_zeros` function and update `format_item_f16` and `format_item_bf16` to keep the raw formatted strings without trimming trailing zeros. This ensures consistent column widths and aligns with GNU od behavior for 16-bit float representations, preventing misalignment in output tables.
* refactor(od/prn_float): combine multiline format! into single line in format_item_f16
The format! macro call in format_item_f16 was split across multiple lines with newlines. This change consolidates it into a single line for improved code readability and consistency with similar patterns in the file, without altering the function's output or logic.
* feat(od): trim trailing zeros in half-precision and bfloat16 float outputs
- Add `trim_float_repr` function to remove unnecessary trailing zeros and padding from normalized float strings, leaving exponents unchanged.
- Update `format_item_f16` and `format_item_bf16` to apply trimming while maintaining column alignment via re-padding.
- Update test expectations to reflect the more compact float representations (e.g., "1" instead of "1.0000000").
* refactor: simplify float trimming condition in prn_float.rs
Replace `if let Some(_) = s.find('.')` with `s.find('.').is_some()` in the `trim_float_repr` function to improve code clarity and idiomatic Rust usage while maintaining the same logic for checking decimal presence=black.
* Update src/uu/od/src/prn_float.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>