Commit graph

16061 commits

Author SHA1 Message Date
Daniel Hofstetter
5244b5e0f5
Merge pull request #8397 from uutils/renovate/rstest-0.x-lockfile
chore(deps): update rust crate rstest to v0.26.1
2025-07-27 13:35:41 +02:00
renovate[bot]
2371542b01
chore(deps): update rust crate rstest to v0.26.1 2025-07-27 10:31:27 +00:00
Sylvestre Ledru
d4034047a5
Merge pull request #8393 from cakebaker/od_improve_file_names
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/nightly (push) Blocked by required conditions
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
od: use underscores in filenames, adapt modules
2025-07-27 08:49:48 +09:00
Sylvestre Ledru
06a422338e
Merge pull request #8394 from uutils/renovate/rstest-0.x
chore(deps): update rust crate rstest to 0.26.0
2025-07-27 08:49:00 +09:00
Sylvestre Ledru
0eecc5f379
Merge pull request #8379 from drinkcat/makefiles-locales-after
Makefile: Copy locales _after_ build
2025-07-27 08:48:50 +09:00
Sylvestre Ledru
ded761d334
Merge pull request #8390 from drinkcat/ls-bigtime
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
du/ls: Merge date formatting code, and handle timestamps far in the future/past by just printing them
2025-07-27 08:01:29 +09:00
renovate[bot]
001a91fbe6
chore(deps): update rust crate rstest to 0.26.0 2025-07-26 22:00:01 +00:00
Nicolas Boichat
f327174539 .github/workflows: Check that target/CACHEDIR.TAG is created
There was a small bug in `Makefile` that caused the `target`
directory to be created by `install`, not `cargo`, which
lead to a missing `target/CACHEDIR.TAG`.

Test for that in CI, so that the issue does not recur.
2025-07-26 23:40:13 +08:00
Nicolas Boichat
d1c07806a8 uucore: time: Add show_error parameter to format_system_time
du prints a warning when the time is out of bounds.
2025-07-26 22:54:26 +08:00
Nicolas Boichat
64565ba0d6 du: convert to use uucore time formatting function
Indirectly switches to jiff, which conveniently doesn't crash on
large timestamps. Also correctly prints timestamp for time far in
the future or past.

Removes chrono dependency.
2025-07-26 22:54:09 +08:00
Nicolas Boichat
7cd4907719 Makefile: Copy locales _after_ build
When creating the `target` directory, `cargo` also creates
`target/CACHEDIR.TAG` which is important for backup tools to
know to ignore the directory.

This doesn't happen if something else creates the `target`
directory (e.g. `locales` Makefile target).

Swap the execution order to fix this.
2025-07-26 16:53:56 +08:00
Daniel Hofstetter
f60b310b6c od: use underscores in filenames, adapt modules 2025-07-26 08:19:10 +02:00
Nicolas Boichat
72d172d2b4 uucore: time: Take Write trait as parameter, return UResult
Gives us more flexiblity to print directly to stdout, and
removes the need to similar error handling across utilities.
2025-07-25 23:29:06 +08:00
Nicolas Boichat
3b4c472c02 uucore: time: add tests 2025-07-25 22:35:30 +08:00
Nicolas Boichat
c9b8635279 uucore: Add time feature
We'll move some common time handling code there, to be shared
between du and ls as a start.

Starting with format_system_time from from `ls`.
2025-07-25 22:35:30 +08:00
Nicolas Boichat
4907396c10 ls: Refactor date/time printing
TimeStyle was more useful when we were using chrono instead of
jiff.

Also, refactor some of the functions to isolate more of them from
the details of `ls` implementation, so that we can move them
to uucore.
2025-07-25 22:35:30 +08:00
Nicolas Boichat
395cbb1357 ls: Handle timestamps far in the future/past by just printing them
Fold get_time into display_date to make that easier, the split
was a remnant of previous refactoring.

The allowed timestamp range is different from what GNU coreutils
allows, but should not really matter for practical purposes, we
could fix later if needed.

It is difficult to add a test as ext4 typically doesn't support
creating files with such large timestamps.
2025-07-25 22:35:30 +08:00
Daniel Hofstetter
8bbce0d3de
Merge pull request #8386 from RenjiSann/improve-sort
Some checks failed
GnuTests / Run GNU tests (push) Has been cancelled
Android / Test builds (push) Has been cancelled
FreeBSD / Style and Lint (push) Has been cancelled
Code Quality / Style/toml (push) Has been cancelled
Code Quality / Style/Python (push) Has been cancelled
CICD / Style/cargo-deny (push) Has been cancelled
CICD / Style/deps (push) Has been cancelled
CICD / Documentation/warnings (push) Has been cancelled
CICD / MinRustV (push) Has been cancelled
CICD / Dependencies (push) Has been cancelled
CICD / Code Coverage (push) Has been cancelled
CICD / Separate Builds (push) Has been cancelled
Code Quality / Style/format (push) Has been cancelled
Code Quality / Style/lint (push) Has been cancelled
Code Quality / Style/spelling (push) Has been cancelled
Code Quality / Pre-commit hooks (push) Has been cancelled
FreeBSD / Tests (push) Has been cancelled
CICD / Build/Makefile (push) Has been cancelled
CICD / Build/stable (push) Has been cancelled
CICD / Build/nightly (push) Has been cancelled
CICD / Binary sizes (push) Has been cancelled
CICD / Build (push) Has been cancelled
CICD / Tests/BusyBox test suite (push) Has been cancelled
CICD / Tests/Toybox test suite (push) Has been cancelled
CICD / Test all features separately (push) Has been cancelled
CICD / Build/SELinux (push) Has been cancelled
sort: Handle non-utf8 sorting content
2025-07-25 14:52:05 +02:00
Dorian Peron
27faee711b test(sort): Fix fixtures 2025-07-25 13:51:53 +02:00
Dorian Peron
365f6a36fa test_util_name: ignore sort tests 2025-07-25 13:51:53 +02:00
Dorian Peron
059977f197 sort: Change &str inputs to &[u8] for the rest of the program 2025-07-25 13:51:53 +02:00
Dorian Peron
0f6985d83b sort: Make comparison functions accept byte arrays instead of strings
Updated:
- numeric sort
- custom_str_cmp
- month_compare
- random_shuffle
2025-07-25 13:51:53 +02:00
Sylvestre Ledru
98374e8021
Merge pull request #8389 from drinkcat/ci-selinux
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
.github/workflows/CICD.yml: Speed up Build/SELinux
2025-07-25 12:40:17 +09:00
Nicolas Boichat
e0eda096a1 .github/workflows/CICD.yml: Speed up Build/SELinux
We can at least use 4 cores instead of 1.
2025-07-25 01:04:27 +08:00
Dorian Péron
07b68ee0da
Merge pull request #8380 from drinkcat/cp-preserve-gid
Some checks failed
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
CheckScripts / ShellScript/Format (push) Has been cancelled
CheckScripts / ShellScript/Check (push) Has been cancelled
tests/cp/preserve-gid: Partial fix
2025-07-24 18:28:06 +02:00
Dorian Péron
5a322e12be
Merge pull request #8385 from drinkcat/cp-try-gid-only
cp: Try to change gid only if changing uid+gid fails
2025-07-24 18:27:28 +02:00
Dorian Peron
4c6aa251c4 version_cmp: Make version_cmp u8-based 2025-07-24 18:16:06 +02:00
Dorian Péron
c40395850b
Merge pull request #8384 from cakebaker/rm_improve_is_dir_empty
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
rm: improve `is_dir_empty` from O(n) to O(1)
2025-07-24 15:37:07 +02:00
Dorian Peron
d689da8251 sort: Minor improvements 2025-07-24 15:35:41 +02:00
Daniel Hofstetter
d1ec00f8fa
Merge pull request #8371 from drinkcat/df-osstr
df: Move to using `OsString`
2025-07-24 15:09:32 +02:00
Nicolas Boichat
8c45737007 cp: Try to change gid only if changing uid+gid fails
For example, if a file with ownership `root:wheel` is copied with
`-p`, we expect the copy to have ownership `$USER:wheel`
(assuming `$USER` is part of `wheel` group)

It's not possible to add a unit test for this, as it requires a
file with non-$USER ownership, which can only be created by root
(or another user).
2025-07-24 18:00:46 +08:00
Daniel Hofstetter
19c7200d34 rm: improve is_dir_empty from O(n) to O(1) 2025-07-24 11:10:00 +02:00
Nicolas Boichat
58095fa70d util/build-gnu.sh: Replace $abs_path_dir_
path_prepend_ sets $abs_path_dir_, but the sed command above removes
it. Set it manually instead.

Fixes part of tests/cp/preserve-gid.
2025-07-24 15:21:16 +08:00
Nicolas Boichat
0e74a34113 util/build.sh: Patch tests/local.mk instead of Makefile
Patching tests/local.mk instead of Makefile makes it a bit easier
to see what has been modified with a `git diff`, and Makefile
is generated anyway.
2025-07-24 15:19:50 +08:00
Nicolas Boichat
f9af783c55 df: table: Add test for non-Unicode printing 2025-07-24 10:14:01 +08:00
Nicolas Boichat
6884e29f97 test_df: Use lossy stdout string
The tests fail when a non-UTF8 path is mounted, that's... not a
common case, but using a lossy string works just as well for the
tests, so let's use that.
2025-07-24 09:39:18 +08:00
Nicolas Boichat
6cc3eda8e4 df: table: Print raw bytes
Final step, let's just print the raw bytes now.
2025-07-24 09:39:18 +08:00
Nicolas Boichat
439cf79211 df: table: Move from fmt to a non-standard write_to
Will allow us to write u8 slices directly.

Also move the last \n print to the function, simplifying the loop.
2025-07-24 09:39:18 +08:00
Nicolas Boichat
2b34f0814b df: table: Collect byte slices for Cell element
Also pre-record the cell width as getting it back in the printing
function would require some conversion back to a String.
2025-07-24 09:39:16 +08:00
Nicolas Boichat
418bf93bf6 uucore: fsext: Fix Windows/Mac
Windows handling can be done more properly, but I don't have
a machine to test this.
2025-07-24 09:26:54 +08:00
Nicolas Boichat
adffd30f13 fsext: Add parsing test for non-unicode mount point 2025-07-24 09:26:54 +08:00
Nicolas Boichat
eedd84f301 uucore: fsext: Change MountInfo's mount_root/dir to OsString
This is necessary to fix handling of non-Unicode filepath in `df`.

Note that other field might also need to be modified in the future.
2025-07-24 09:26:54 +08:00
Nicolas Boichat
6db117dc76 df: Move to use OsString
This allows us to handle non-Unicode parameters.
2025-07-24 09:26:54 +08:00
Yonatan Linik
bd2e33bb34 sort: Support hexadecimal numbers/floats correctly
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
Fixes https://github.com/uutils/coreutils/issues/8060
2025-07-23 21:14:14 +02:00
Daniel Hofstetter
d2b95eb9e5
Merge pull request #8375 from drinkcat/basename-osstr
basename: Handle non-unicode parameters
2025-07-23 16:39:20 +02:00
Nicolas Boichat
22d474f275 test_basename: Fix test_invalid_utf8_args
The test was not really testing for the right thing. If a non-unicode
string is passed, the basename should be printed as-is.
2025-07-23 21:06:02 +08:00
Nicolas Boichat
3fea7cf6ab basename: Fix basename function, print raw byte slice. 2025-07-23 21:06:01 +08:00
Nicolas Boichat
2f53d594aa basename: Take in parameters as OSString
This will allow us to handle non-Unicode strings correctly.

The logic needs to be updated, next.
2025-07-23 21:03:35 +08:00
Daniel Hofstetter
cf3fece177
Merge pull request #8374 from sylvestre/issue-8373
Some checks are pending
CICD / Build (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Style/cargo-deny (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
basename: handle a corner case with /. - Closes #8373
2025-07-23 14:47:27 +02:00
Daniel Hofstetter
5392c341b2
Merge pull request #8340 from sylvestre/adjust-mkdir-restorecon-test
mkdir: Replaced strict restorecon compatibility check with validation…
2025-07-23 14:18:36 +02:00