The old RoundUp formula `fsize + fsize % size` was incorrect. For
example, `truncate -s %128K` on a 24696-byte file produced 49392
bytes instead of the correct 131072 bytes.
This was incidentally fixed in commit fe9793331 ("truncate: eliminate
duplicate stat() syscall") by replacing the formula with
`fsize.checked_next_multiple_of(size)`. However, the existing test
`test_round_up` used values (fsize=10, size=4) where both the buggy
and correct formulas give the same result (12), so the bug was never
caught by the test suite.
Add unit and integration tests that would have caught this bug:
- File smaller than rounding unit (the reported scenario)
- File larger than rounding unit but not aligned
- File already aligned to the rounding unit
- Division by zero (RoundUp with size=0)
Link: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/48210
Signed-off-by: Vincent Jardin <vjardin@free.fr>
* refactor: simplify DisplayItemName struct and improve dired position handling
This commit refactors the `display_item_name` function to return a `DisplayItemName` struct containing both the displayed name and its dired length, rather than just the OsString. This change simplifies the code by:
1. Eliminating the need to call `dired_name_len()` separately after getting the displayed name
2. Reducing redundant length calculations in the dired position handling
3. Making the code more maintainable by encapsulating related data together
The change also fixes an issue where dired positions were being calculated incorrectly for symlink names that required quoting, ensuring proper highlighting in dired mode.
Closes: #10248
* chroot: fix gid being set by uid with --userspec
* chroot: check using sync user that has uid != gid
* chroot: correct Error response on failure case
* chroot: fix test
* chroot: test failure output
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* fix: scientific notation is incorrectly parsed in general sort
* test(sort): refactor exponents_positive_general test
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* readlink: Set silent mode as default
* readlink: Add tests for verbose and silent options
* readlink: Change test to work with Windows-specific error message
* readlink: Add additional test cases
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>