Commit graph

4126 commits

Author SHA1 Message Date
Daniel Hofstetter
30f300c52b clippy: fix "hiding a lifetime" warnings
from mismatched_lifetime_syntaxes lint
2025-08-07 16:12:03 +02:00
yuankunzhang
5825e5e346 mkfifo: support symbolic mode 2025-08-06 22:19:01 +08:00
Nicolas Boichat
01819d021e
Merge pull request #8334 from cakebaker/ci_use_macos_latest
ci: use `macos-latest` instead of `macos-13`
2025-08-06 20:59:04 +08:00
Daniel Hofstetter
72a3ed4605
Merge pull request #8433 from drinkcat/od-f16-f32-width
Some checks are pending
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 (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
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
L10n (Localization) / L10n/Build and Test (push) Waiting to run
L10n (Localization) / L10n/Fluent Syntax Check (push) Waiting to run
L10n (Localization) / L10n/French Integration Test (push) Waiting to run
L10n (Localization) / L10n/Multi-call Binary Install Test (push) Waiting to run
L10n (Localization) / L10n/Installation Test (Make & Cargo) (push) Waiting to run
L10n (Localization) / L10n/Locale Support Verification (push) Waiting to run
L10n (Localization) / L10n/Locale Embedding Regression Test (push) Waiting to run
WSL2 / Test (push) Waiting to run
od: Switch f16 print to width=15/16, precision=8
2025-08-06 10:57:56 +02:00
Nicolas Boichat
991ba21510 od: Switch f16 print to width=15/16, precision=8
While I think precision=4 is enough to print f16 unambiguously,
being consistent with GNU implementation does not hurt.

Also, change width to 16 for f32 as well.

Fixes #8370.
2025-08-06 15:14:56 +08:00
Martin Kunkel
ff001139ea more: tests: cleanup processes in test_valid_arg
Added cleanup in test_alive to ensure all spawned processes are
terminated on successful test execution.

This also fixes a race condition that could occur: the check for
process is_alive might be executing while more is still parsing
the arguments.
2025-08-04 21:39:02 +02:00
Martin Kunkel
3b4b769976
tests: fix execution on WSL2, Ubuntu 24.04 (#8235)
* tests: fix execution on WSL2, Ubuntu 24.04

Skip incompatible parts of tests to ensure that
    cargo nextest run --features unix
executes successfully in WSL2, Ubuntu 24.04 distribution.

Changes
* Skip tests that required sys/kernel/profiling which is not
available in WSL2 default configuration.
* Use timezones in tests that are part of the standard tzdata
list and not only available in backwards list. Backwards list is
not installed by default in Ubuntu 24.04 (package tzdata-legacy).
* check that /proc/modules is not empty when expecting content,
because it is empty in WSL2 default configuration.
* Skip logname test not only in WSL1, also in WSL2.

* Add workflow for WSL2

This will setup WSL2 on windows-latest runner, install
Ubuntu-24.04, and run the feat_os_unix tests.

* wsl2: implemented review findings

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-08-03 14:38:49 +02:00
Daniel Hofstetter
d9af611a9f install: disable two tests on macOS x86_64
they run in timeouts in the CI with macos-latest
2025-08-02 17:33:41 +02:00
Daniel Hofstetter
7dc20bbdb0 touch: adapt tests to changes in parse_datetime 2025-08-01 10:23:30 +02:00
Daniel Hofstetter
9938db39bc
Merge pull request #8333 from sylvestre/selinux-mv
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Dependencies (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 / Test all features separately (push) Blocked by required conditions
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 (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
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
mv: add support for selinux and add minor refactor
2025-08-01 09:36:06 +02:00
Dorian Péron
d90f3a4ec3
Merge pull request #8416 from drinkcat/cp-attr
Some checks are pending
CICD / Build (push) Blocked by required conditions
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 / 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 (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
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
`cp`: Properly preserves fifos and symlink attributes
2025-07-31 18:04:17 +02:00
Sylvestre Ledru
6e930966fb selinux: introduce get_getfattr_output to verify the output of getfatt 2025-07-31 17:45:34 +02:00
Sylvestre Ledru
ad8fdbdb77 mv: implement selinux options (-Z/--context) 2025-07-31 17:45:34 +02:00
Daniel Hofstetter
1e50dc4c33 pr: reduce nesting to improve readability
of file_last_modified_time_format()
2025-07-31 17:00:28 +02:00
Daniel Hofstetter
7003b1d3fc
Merge pull request #8418 from drinkcat/pr-time
pr: Add support for -D/--date-format parameter
2025-07-31 16:34:44 +02:00
Nicolas Boichat
82cb88ac0d test_pr: Use new_ucmd!() directly 2025-07-31 22:08:56 +08:00
Daniel Hofstetter
b5f453a562
Merge pull request #8417 from drinkcat/du-ls-time-test
ls: -u/-c/--time control sorting when -l is not used
2025-07-31 15:55:40 +02:00
Daniel Hofstetter
f33244321a rm: use clap to handle --interactive args 2025-07-31 09:49:05 +02:00
Nicolas Boichat
d35a60e5e2 pr: Add support for -D/--date-format parameter 2025-07-31 15:45:31 +08:00
Nicolas Boichat
4878e65ea7 pr: Set date format depending on environment.
Based on GNU manual.
2025-07-31 15:45:31 +08:00
Nicolas Boichat
ec11b68543 ls: -u/-c/--time control sorting when -l is not used
Fallback on those flags if --sort is not otherwise set.
2025-07-31 09:00:15 +02:00
Nicolas Boichat
f4bf8987cd
tests/by-util/test_cp.rs: Merge #[cfg]
Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>
2025-07-30 21:04:03 +08:00
Nicolas Boichat
4b11692db3 cp: Also copy attributes in copy_symlink
Most attributes can actually be applied to symlinks (mode and
xattr are exceptions), so try to copy them, if possible.

Fort those 2 exceptions, we don't need any special handling as:
 - Mode errors would be ignored anyway.
 - The source symlink cannot have any xattr anyway, so no
   attribute is attempted to be set on the destination.
2025-07-30 20:03:22 +08:00
Nicolas Boichat
4d48626eeb cp: File logic error when preserving attributes for fifos
There was a mismatch between the test, the comment, and the code.

The intention was to _preserve_ attributes if the source of a
fifo/pipe still exists. Perhaps the clearest way is to modify
the test (as that avoids code duplication).

Also add a basic test for that, if permissions are preserved, the
rest should also be preserved correctly.

Fixes the first part of #8402.
2025-07-30 17:37:51 +08:00
Nicolas Boichat
2d63020cd9 du: Add support for reading time-style from environment
Similar as what ls does, but du has an extra compatibility layer
described in the GNU manual (and that upstream dev helped me
understand: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79113 ).
2025-07-30 17:27:22 +08:00
Nicolas Boichat
1272bfc222 du: Add support for +FORMAT time-style
Also add to error text, which... GNU coreutils doesn't do for
some reason.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
fc08fa1d62 ls: Print dates in the future as "old" ones
ls has different time format for recent (< 6 months) and older files.
Files in the future (even by just a second), are considered old,
which makes sense as we probably want the date to be printed in
that case.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
4901f370cb ls: Add support for newline separated format for recent/older
Documented in GNU manual.

Also improve test_ls to test for both recent and older files.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
e5f2f79ea1 ls: Allow reading time-style from TIME_STYLE environment variable
According to GNU manual.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
a1519e1b74 ls: Add support for --time-style=posix-*
From GNU manual, if LC_TIME=POSIX, then the "locale" timestamp is
used. Else, `posix-` is stripped and the format is parsed as usual.

Also, just move the whole text to the locale file, instead
of trying to generate it manually.
2025-07-30 17:27:20 +08:00
Daniel Hofstetter
790852ff9a
Merge pull request #8403 from sylvestre/ls-others
ls: improve the test when running selinux
2025-07-29 12:51:54 +02:00
Julian Andres Klode
190ddd105c install: Fix --no-target-directory with existing file
install should silently override existing target files, but it
inadvertently checked whether the target exists rather than
for the target being a directory, hence the overwrite failed,
saying it cannot overwrite the directory with non-directory.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/2118785
2025-07-29 12:24:31 +02:00
Jonas Jelten
79bbf52a21
Merge pull request #8343 from TheJJ/fix-mknod-mode
mknod: set cli specified file mode even when it's 0o666
2025-07-29 11:53:21 +02:00
Sylvestre Ledru
7e320a75d9 ls: improve the test when running selinux 2025-07-28 21:17:09 +02:00
Sylvestre Ledru
582c619b7e date: update deprecated TZ
See:
https://data.iana.org/time-zones/tzdb/backward
2025-07-28 21:13:54 +02:00
Nicolas Boichat
b8d81adcff du/test_du: Fix ctime fallback on Windows, and test 2025-07-27 12:57:28 +08:00
Nicolas Boichat
96438f2086 test_du: Fix --time=ctime test
It turns out `du` used to test for the wrong thing, `ctime` is
the change timestamp, not creation time.

We have to rely on a regex again, as the change timestamp is the
current time.
2025-07-27 10:57:07 +08: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
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
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
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
Sylvestre Ledru
c5268a897e basename: handle a corner case with /. - Closes #8373 2025-07-23 13:53:34 +02:00
Daniel Hofstetter
8218f80bb0
Merge pull request #8367 from drinkcat/mkdir-osstr
Some checks are pending
CICD / Build (push) Blocked by required conditions
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 / 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/toml (push) Waiting to run
Code Quality / Style/Python (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 / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
Fix mkdir with non-unicode parameters
2025-07-22 17:15:19 +02:00
karanabe
08fea2415f
od: add fH and fB format specifiers 2025-07-22 19:38:21 +09:00
Nicolas Boichat
64fb7a7462 test_mkdir: Add a test for non-Unicode directory name
Similar to the first part of GNU test df/problematic-chars.
2025-07-22 17:25:59 +08:00
Nicolas Boichat
7e6e9c291e uutests: Change dir_exists to take a templated AsRef<Path>
Similar to what file_exists does, allows us to pass an OsStr to the
function.

Also change symlink_exists, for consistency.
2025-07-22 17:25:59 +08:00
Julian Andres Klode
abb5300068 install, mkdir: Handle dir/./ like dir/.
The dir/. special case was handled correctly, but dir/./ was not,
breaking gcc builds, which run:

../../../../src/libstdc++-v3/../install-sh -c -d debug/./

Bug-Ubuntu: https://bugs.launchpad.net/bugs/2117466
2025-07-22 09:44:15 +02:00
Yonatan Linik
fe4e8e234c od: Fixes float formatting in scientific notation
GNU's od adds a "+" after the "e".

Fixes [#8346](https://github.com/uutils/coreutils/issues/8346)
2025-07-18 22:40:18 +03:00
yuankunzhang
a8fe603284 stty: support sane settings 2025-07-16 22:33:33 +08:00