Commit graph

16028 commits

Author SHA1 Message Date
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
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
Sylvestre Ledru
c5268a897e basename: handle a corner case with /. - Closes #8373 2025-07-23 13:53:34 +02:00
Daniel Hofstetter
b6a219ab52
Merge pull request #8372 from drinkcat/basename-simplify
basename: Simply logic, do not trim path separators `/`
2025-07-23 11:09:43 +02:00
Nicolas Boichat
44d9ccacea basename: Simply logic, do not trim path separators /
Looks like this is not needed, and Pathbuf already behaves as
expected.
2025-07-23 14:52:03 +08: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
Daniel Hofstetter
8f1f99a1c3 od: rename flo16/flo32/flo64 to f16/f32/f64 2025-07-22 14:58:16 +02:00
Daniel Hofstetter
8e83822991
Merge pull request #8365 from yuankunzhang/env-exec
Some checks failed
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
CheckScripts / ShellScript/Check (push) Has been cancelled
CheckScripts / ShellScript/Format (push) Has been cancelled
env: use execvp instead of Command::status on Unix systems
2025-07-22 14:41:58 +02:00
yuankunzhang
cab307a40e env: use execvp instead of Command::status on Unix systems 2025-07-22 19:52:57 +08:00
Dorian Péron
86e9b86951
Merge pull request #8354 from karanabe/main
od: Add support for -tfH and -tfB
2025-07-22 13:06:03 +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
Nicolas Boichat
7a9b88011c mkdir: strip_minus_from_mode: Use uucore functions
Let's not reinvent stuff.
2025-07-22 17:25:59 +08:00
Nicolas Boichat
98f3aacb16 mkdir: Collect OsString, instead of String.
collect_lossy incorrectly converts invalid UTF-8 strings, let's
keep the OsString everywhere.

This also means we need to modify strip_minus_from_mode to make
it work with OsString.
2025-07-22 17:25:59 +08:00
Nicolas Boichat
f6f9ca7449 uucore: Move strip_minus_from_mode to mkdir
It's only used there anyway.
2025-07-22 17:25:59 +08:00
Daniel Hofstetter
544a313fcb
Merge pull request #8353 from drinkcat/gnu-fix-sigpipe-test
util/build-gnu.sh: Bypass timeout/yes SIGPIPE handling bug
2025-07-22 10:57:58 +02:00
Daniel Hofstetter
18e67e0d05
Merge pull request #8364 from julian-klode/setup-localization-symlinks
Setup localization for utility symlinks
2025-07-22 10:41:13 +02:00
Daniel Hofstetter
ab65ebd8d6
Merge pull request #8366 from julian-klode/trailing-dot-and-slash
install, mkdir: Handle dir/./ like dir/.
2025-07-22 10:30:45 +02: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
Daniel Hofstetter
a1a2734527
Merge pull request #8359 from willshuttleworth/stty-refactor
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/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
stty: refactor arg processing loop
2025-07-21 14:32:17 +02:00
Will Shuttleworth
f836889ff2 stty: refactor arg processing loop 2025-07-21 07:43:08 -04:00
Julian Andres Klode
1a53232e71 Setup localization for utility symlinks
If we are invoked via utility symlinks such as "ln", we need to
setup localization before calling the utility's main function.

Fixes: #8332
2025-07-21 12:50:53 +02:00
Daniel Hofstetter
1a8f99f7eb
Merge pull request #8352 from yonatan-linik/fix-od-positive-exp-fmt
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
od: Fixes float formatting in scientific notation
2025-07-21 11:00:57 +02:00
Daniel Hofstetter
73af9584e7
Merge pull request #8360 from Ecordonnier/eco/fix-out-of-tree-build
remove PROJECT_NAME_FOR_VERSION_STRING
2025-07-21 10:19:54 +02:00
Daniel Hofstetter
27ca4ed8d6
Merge pull request #8358 from uutils/renovate/rand-0.x-lockfile
fix(deps): update rust crate rand to v0.9.2
2025-07-21 07:13:34 +02:00
Etienne Cordonnier
c6119934d8 remove PROJECT_NAME_FOR_VERSION_STRING
This fixes out-of-tree builds which are using --manifest-path and ignoring .cargo/config.toml because of https://github.com/rust-lang/cargo/issues/2930 :

```
git clone https://github.com/uutils/coreutils.git
mkdir test && cd test
cargo build --manifest-path=../coreutils/Cargo.toml
```

This also fixes installation of coreutils from crates.io, which also ignores .cargo/config.toml:
```
cargo install coreutils --locked
```

Using `option_env` is not possible because `concat!` needs a string literal.
I don't see a need to change the project name using an environment variable, so let's keep things simple and simply remove it to fix this bug.

Fixes https://github.com/uutils/coreutils/issues/7992

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-07-20 23:10:52 +02:00
renovate[bot]
6f900dd849
fix(deps): update rust crate rand to v0.9.2 2025-07-20 18:36:01 +00:00
Nicolas Boichat
fac6c2951d util/build-gnu.sh: Bypass timeout/yes SIGPIPE handling bug
See #7252, both `timeout` and `yes` reset the SIGPIPE handler
(actually, the Rust core does that), leading to trap_sigpipe_or_skip_
test:
```
(trap '' PIPE && timeout 10 yes |:) 2>&1 | grep 'Broken pipe'
```
to fail, causing 4 tests to be skipped.

I believe the intent here is to check if the OS supports SIGPIPE,
so it probably makes sense to use System's timeout/yes here, and
run the tests anyway (which, happen to pass).
2025-07-19 15:08:59 +08: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
Dorian Péron
4bbbb972ad
Merge pull request #8349 from cakebaker/i10n_fix_newline_in_ftl_files
Some checks failed
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
GnuTests / Run GNU tests (push) Has been cancelled
Android / Test 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 / Style/toml (push) Has been cancelled
Code Quality / Style/Python (push) Has been cancelled
Code Quality / Pre-commit hooks (push) Has been cancelled
FreeBSD / Style and Lint (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
l10n: replace `\n` with a new line in ftl files
2025-07-18 12:54:00 +02:00
Daniel Hofstetter
8a8e03eb77 l10n: replace \n with a new line in ftl files 2025-07-18 10:48:01 +02:00
Sylvestre Ledru
004336d718
Merge pull request #8344 from cakebaker/od_fix_typo
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
od: fix typo in help
2025-07-17 22:09:26 +09:00
Daniel Hofstetter
4e281313ad od: fix typo in help 2025-07-17 14:41:06 +02:00
Dorian Péron
a72a1c74d3
Merge pull request #8203 from gabelluardo/add-clippy-rules
Enable some pedantic rules
2025-07-17 13:07:21 +02:00