* Fixed panic in who > /dev/full
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* More sctrictly test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* numfmt: fix --to=auto to return with exitcode=1
* numfmt: update direct variable use in format macro
* numfmt_test: remove extra test
* numfmt: replacing format in translate directly
* Update format.rs
* numfmt fix#11667
* numfmt --format fix
* remove ignore of test for #11667 in test_numfmt.rs
* Add space after slashes in a comment
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* change is_precision with a more understandable name
* Leave an empty line between functions
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* forbid scientific notation arguments in numfmt
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Edit solution of #116555
* add scientific notation test
* change variable name
* use is_ascii_digit() instead of checking manually
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Apply suggestion from @cakebaker
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* fix(numfmt):fix recision loss for large numbers in #11654
* numfmt: fix some tests in format.rs caused by importing numeric.rs
* add a file header and remove a redundant comment
* remove a redundant comment
* add a empty line between two functions
* refactor(numfmt): rename helper functions for accuracy; fix double negation logic
* tests/by-util/test_tail.rs (test_follow_name_multiple): Increase
the delay on macOS to 2000ms to avoid intermittent failures due to
slower follow-name change detection on macOS CI.
* numfmt: fix zero-padding placement before sign for negative numbers
When using zero-padded format (e.g. %018.2f), the sign character is now
placed before the padding zeros, matching C printf behavior.
Fixes#11664
* numfmt: simplify sign handling with combined strip_prefix
* numfmt: preserve fractional digits when --from-unit is used without suffix and fixed String format
* numfmt: simplify redundant if branches caught by clippy
* numfmt: fix precision condition to only preserve decimals when input has no unit suffix
- Changed FormatError::FieldWidthTooLarge to store width as String instead of usize
- Updated error message generation to use FluentArgs for proper localization
- Fixed width parsing to return FormatError instead of panicking on parse failure
- Updated error message formatting to use get_message_with_args for consistency
- Fixed test assertions to compare width as String instead of usize
Added proper error handling for format modifier width calculations that could overflow or fail allocation. The change replaces generic error messages with a specific error type `FieldWidthTooLarge` that includes the problematic width and specifier values, improving error reporting for date format operations.
Update `apply_modifiers` to return `Result<String, FormatError>` and check for integer overflow when calculating padding length. This prevents potential panics or incorrect formatting when very large width values are specified. The change adds proper error handling for the "field width too large" case and propagates errors through the formatting pipeline.
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