Dorian Péron
1bb7930a08
Merge pull request #8329 from drinkcat/printf-7209-update
...
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
printf: accept non-UTF-8 input in FORMAT and ARGUMENT arguments
2025-07-16 00:28:44 +02:00
Nicolas Boichat
ccad817415
uucore: format: Use .into_owned() for from_utf8_lossy()
...
Suggested by Gemini and I think that's not a bad idea.
2025-07-16 00:28:34 +02:00
Nicolas Boichat
668cefb2e4
uucore: format: Separate function to parse numbers starting with a quote
...
After this, we can use a common extract_value function.
2025-07-16 00:28:34 +02:00
Nicolas Boichat
9ddb8092e7
uucore: num_parser: Copy PartialMatch String in ExtendedParserError
...
In one case, we'll need an actual owned String in PartialMatch,
so it's easier to just use that. Removes a bunch of lifetime things
in the code too.
2025-07-16 00:28:34 +02:00
Nicolas Boichat
5b6a617024
uucore: format: Have get_num return T directly (not result)
...
And fix all the callers, e.g. all the next_ functions.
2025-07-16 00:28:34 +02:00
Nicolas Boichat
51453f833e
uucore: num_parser: Add note about where literals are parsed
2025-07-16 00:28:34 +02:00
Justin Tracey
d9be3315c1
printf: remove passing tests from why-error.md
2025-07-16 00:28:34 +02:00
Andrew Liebenow
961a27acff
printf: accept non-UTF-8 input in FORMAT and ARGUMENT arguments
...
Other implementations of `printf` permit arbitrary data to be passed
to `printf`. The only restriction is that a null byte terminates
FORMAT and ARGUMENT argument strings (since they are C strings).
The current implementation only accepts FORMAT and ARGUMENT
arguments that are valid UTF-8 (this is being enforced by clap).
This commit removes the UTF-8 validation by switching to OsStr
and OsString.
This allows users to use `printf` to transmit or reformat null-safe
but not UTF-8-safe data, such as text encoded in an 8-bit text
encoding. See the `non_utf_8_input` test for an example (ISO-8859-1
text).
[drinkcat: also squashed in this commit to ease rebase]
Author: Justin Tracey <jdt.dev@unsuspicious.click>
uucore, printf: improve non-UTF-8 format arguments
This fixes handling of format arguments, in part by eliminating duplicate
implementations. Utilities with format arguments other than printf will no
longer accept things like "'a" as numbers, etc.
Co-authored-by: Justin Tracey <jdt.dev@unsuspicious.click>
2025-07-16 00:28:34 +02:00
Dorian Péron
50704da6e8
Merge pull request #8336 from tgrez/main
...
cat: handle broken pipe gracefully
2025-07-15 20:56:46 +02:00
Dorian Péron
4d08b9d554
Merge pull request #8341 from cakebaker/echo_output_version
...
echo: show version when `--version` is the only argument
2025-07-15 19:37:48 +02:00
Tomasz Guz
11d6fe0f6f
tail: fix race condition in broken pipe handling test
2025-07-14 18:25:15 +02:00
Tomasz Guz
6a6ee59c63
cat: fix race condition in broken pipe handling test
2025-07-14 18:25:15 +02:00
Tomasz Guz
4406b403b2
cat: handle broken pipe gracefully
2025-07-14 18:25:15 +02:00
Daniel Hofstetter
0c669c83db
Merge pull request #8338 from sylvestre/du-inode
...
GnuTests / Run GNU tests (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
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 (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 / 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
du: create the string into the main thread to avoid some translations issue
2025-07-14 13:42:54 +02:00
Daniel Hofstetter
0ce0ea04f6
echo: rename test function
2025-07-14 12:41:12 +02:00
Daniel Hofstetter
9c08dd9851
echo: show version when using --version
2025-07-14 12:31:32 +02:00
Sylvestre Ledru
4439f7e03d
du: create the string into the main thread to avoid some translations issue
...
should fix tests/du/inodes.sh
2025-07-14 19:23:04 +09:00
Daniel Hofstetter
afbe90feaf
Merge pull request #8310 from RGBCube/echo-help
...
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/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
echo: print help if not posixly correct and only argument is --help
2025-07-14 10:34:30 +02:00
Daniel Hofstetter
dddcf2a998
Merge pull request #8339 from uutils/renovate/crc32fast-1.x-lockfile
...
chore(deps): update rust crate crc32fast to v1.5.0
2025-07-14 07:52:27 +02:00
renovate[bot]
b580d62611
chore(deps): update rust crate crc32fast to v1.5.0
2025-07-13 16:52:08 +00:00
Daniel Hofstetter
06f987a00f
Merge pull request #8337 from uutils/renovate/memmap2-0.x-lockfile
...
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/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
chore(deps): update rust crate memmap2 to v0.9.7
2025-07-13 12:49:07 +02:00
renovate[bot]
2217d83025
chore(deps): update rust crate memmap2 to v0.9.7
2025-07-13 09:52:36 +00:00
RGBCube
3ea679a29e
echo: print help if not posixly corrent and only argument is --help
2025-07-12 01:37:07 +03:00
Daniel Hofstetter
2ba3a33b73
Merge pull request #8331 from julian-klode/fix-8330
...
GnuTests / Run GNU tests (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
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
cp: Fix --no-dereference --parents with symlink source
2025-07-11 10:25:04 +02:00
Julian Andres Klode
b585e98dac
cp: Fix --no-dereference --parents with symlink source
...
If the source is a symbolic link pointing at a directory,
--parents was ignored, as we entered the "copy as directory"
code path.
Fixes : #8330
2025-07-11 08:09:10 +02:00
Sylvestre Ledru
dd1b315529
Merge pull request #8328 from nyurik/expl_impl_clone_on_copy
...
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
chore: fix expl_impl_clone_on_copy lint
2025-07-11 12:25:25 +09:00
Yuri Astrakhan
c7b981f260
chore: fix expl_impl_clone_on_copy lint
...
auto-derived clone generates identical assembly: https://rust.godbolt.org/z/GvenxKcKo
2025-07-10 17:46:01 -04:00
Daniel Hofstetter
685969e275
Merge pull request #8327 from tgrez/main
...
CICD / Build (push) Blocked by required conditions
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 / 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/Python (push) Waiting to run
Code Quality / Style/toml (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
tail: handle broken pipe gracefully
2025-07-10 16:17:37 +02:00
Daniel Hofstetter
244027894b
Merge pull request #8256 from willshuttleworth/stty-combo-settings
...
stty: add combination settings
2025-07-10 15:27:05 +02:00
Tomasz Guz
f04ed45a0f
tail: handle broken pipe gracefully
2025-07-10 14:54:02 +02:00
Tomasz Guz
a060344c6b
uutests: improve error message for non-empty stderr
2025-07-10 14:54:02 +02:00
Will Shuttleworth
a2711f06ad
stty: add min and time settings into combination
2025-07-10 08:19:27 -04:00
Will Shuttleworth
93fc669258
stty: add combination settings
2025-07-10 08:19:27 -04:00
Daniel Hofstetter
f180be4265
Merge pull request #8326 from uutils/renovate/clap_mangen-0.x-lockfile
...
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 / 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/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
chore(deps): update rust crate clap_mangen to v0.2.28
2025-07-10 08:44:47 +02:00
Daniel Hofstetter
e8d9ccc9e5
Merge pull request #8323 from uutils/renovate/zip-4.x-lockfile
...
chore(deps): update rust crate zip to v4.3.0
2025-07-10 08:29:16 +02:00
renovate[bot]
f7d8fd4a73
chore(deps): update rust crate clap_mangen to v0.2.28
2025-07-10 05:59:44 +00:00
Daniel Hofstetter
c1b137bb09
Merge pull request #8325 from uutils/renovate/clap_complete-4.x-lockfile
...
chore(deps): update rust crate clap_complete to v4.5.55
2025-07-10 07:59:04 +02:00
Daniel Hofstetter
45435eb462
Merge pull request #8324 from uutils/renovate/clap-4.x-lockfile
...
chore(deps): update rust crate clap to v4.5.41
2025-07-10 07:57:44 +02:00
renovate[bot]
be71a45618
chore(deps): update rust crate clap_complete to v4.5.55
2025-07-10 02:59:31 +00:00
renovate[bot]
7d743bcb0f
chore(deps): update rust crate clap to v4.5.41
2025-07-10 02:59:23 +00:00
renovate[bot]
85c6a24efe
chore(deps): update rust crate zip to v4.3.0
2025-07-09 20:37:03 +00:00
Daniel Hofstetter
745ae4b10f
Merge pull request #8292 from RenjiSann/collating
...
CICD / Style/cargo-deny (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
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 / 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
i18n: further work, expr support
2025-07-09 16:24:13 +02:00
Johnothan King
6d30b9110a
tr: Fix regression causing read error with sockets ( #8083 )
...
* tr: Fix regression causing read error with sockets
The test used for determining if a file descriptor
tested with fstat points to a directory is traditionally
done by using the S_IFMT mask[^1][^2], e.g.:
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
In Rust, this translates to 'm & libc::S_IFMT == libc::S_IFDIR'.
is_stdin_directory() uses 'has!(mode, S_IFDIR)', which is
**not** equivalent and causes non-directory sockets to be
incorrectly recognized as directories. This causes uu-tr
to break when used with all sockets created with socketpair,
including ksh93 pipes[^3]. Below is an example Rust program
demonstrating why the current check is bogus:
fn main() {
use nix::sys::socket::{socketpair, SockFlag, AddressFamily, SockType};
use nix::sys::stat::fstat;
use libc::{S_IFDIR, S_IFMT, mode_t};
let (_fd1, fd2) = socketpair(AddressFamily::Unix, SockType::Stream, None, SockFlag::empty()).unwrap();
let mode = fstat(&fd2).unwrap().st_mode as mode_t;
if mode & S_IFMT == S_IFDIR { // Equivalent to S_ISDIR()
println!("Not reached"); // Not a dir, so unreachable
}
if mode & S_IFDIR == S_IFDIR { // Bogus check for S_IFDIR
println!("BAD");
}
}
- is_stdin_directory(): Fix the regression introduced in 3e4221a4
by replacing the bogus check with one equivalent to S_ISDIR().
- test_tr.rs: Add a regression test for this bug.
[^1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=io/sys/stat.h;h=4bea9e9a#l123
[^2]: https://git.musl-libc.org/cgit/musl/tree/include/sys/stat.h?id=047a1639#n51
[^3]: cc5e0692/src/cmd/ksh93/sh/io.c (L98-L102)
Fixes https://github.com/uutils/coreutils/issues/7658
* Add comment explaining rationale
Also fix cargo clippy lint.
(In case it isn't obvious, I'm fairly new to Rust)
* Fix more lint
2025-07-09 15:47:16 +02:00
Dorian Peron
4ab3431d08
test(expr): add locale-related tests, remove deprecated tests
...
- Add locale comparison test (issue #5378 )
- Implement GNU expr-multibyte test
2025-07-09 15:34:07 +02:00
Dorian Peron
82a06e757b
expr: add locale-aware substr
2025-07-09 15:34:07 +02:00
Dorian Peron
8c565ece3e
expr: add locale-aware length
2025-07-09 15:34:07 +02:00
Dorian Peron
7bed9b5a3b
expr: add locale-aware comparison
2025-07-09 15:34:07 +02:00
Dorian Peron
5ec652b59a
expr: add locale-aware index
2025-07-09 15:34:07 +02:00
Dorian Peron
a669a84801
expr: Handle non UTF8 inputs
2025-07-09 15:34:07 +02:00
Daniel Hofstetter
1d85566779
Merge pull request #8320 from nyurik/uninlined-fmt-args
...
chore: fix uninlined_format_args lint
2025-07-09 11:39:28 +02:00