Etienne Cordonnier
f084b7f168
make cargo fmt happy
2025-03-16 00:21:45 +01:00
Etienne Cordonnier
591bef3759
utmpx.rs: use correct constant names for musl libc
...
Unfortunately, the name of those constants are not standardized:
glibc uses __UT_HOSTSIZE, __UT_LINESIZE, __UT_NAMESIZE
musl uses UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE
See:
1. https://git.musl-libc.org/cgit/musl/tree/include/utmpx.h
2. https://github.com/bminor/glibc/blob/master/sysdeps/gnu/bits/utmpx.h#L35
This is a partial fix for https://github.com/uutils/coreutils/issues/1361
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-03-15 22:39:35 +01:00
Daniel Hofstetter
d34eb25251
all: use crate_version! from uucore
2025-03-15 16:03:17 +01:00
Daniel Hofstetter
12ab9c2c21
uucore: add crate_version macro
2025-03-15 16:03:16 +01:00
Nicolas Boichat
b7dcaa34da
uucore: format: print absolute value of float, then add sign
...
Simplifies the code, but also fixes printing of negative and positive `NaN`:
`cargo run printf "%f %f\n" nan -nan`
Fixes part 2 of #7412 .
2025-03-14 12:42:00 +01:00
Nicolas Boichat
e3872e8e8f
uucore: format: force NaN back to lowercase
...
Fixes formatting of `NaN` to `nan`.
Fixes part 1 of #7412 .
2025-03-14 12:42:00 +01:00
Nicolas Boichat
bfa8bf72c7
uucore: format: Fix default Float precision in try_from_spec
...
The default precision is 6, no matter the format. This applies
to all float formats, not just "%g" (aka FloatVariant::Shortest).
Fixes #7361 .
2025-03-14 12:05:16 +01:00
Nicolas Boichat
0a8155b5c2
uucore: format: Fix capitalization of 0 in scientific formating
...
0.0E+00 was not capitalized properly when using `%E` format.
Fixes #7382 .
Test: cargo test --package uucore --all-features float
Test: cargo run printf "%E\n" 0 => 0.000000E+00
2025-03-14 12:05:16 +01:00
M Bussonnier
7632acfc90
Fix touch -t with 2 digit years when YY > 68
...
When using `touch -t` with a 2 digit year, the year is interpreted as
a relative year to 2000.
When the year is 68 or less, it should be interpreted as 20xx.
When the year is 69 or more, it should be interpreted as 19xx.
This is the behavior of GNU `touch`.
fixes gh-7280
Arguably 2 digits years should be deprecated as we
are already closer to 2069, than 1969.
2025-03-14 11:00:08 +01:00
Sylvestre Ledru
d570512bdc
Merge pull request #7439 from dezgeg/ficlone
...
cp: Use FICLONE ioctl constant from linux-raw-sys
2025-03-14 09:59:36 +01:00
Daniel Hofstetter
10fc96a78b
true,false: remove newline from version string
2025-03-14 09:21:37 +01:00
Tuomas Tynkkynen
cacb1a4fcb
cp: Use FICLONE ioctl constant from linux-raw-sys
...
The current ioctl operation code for FICLONE is fully open-coded instead
of using the ioctl macros, which makes it non-portable to other
architectures including mips, arm & powerpc. Get the constant from the
linux-raw-sys crate instead, which is already a transitive dependency.
2025-03-13 18:23:48 +02:00
Louis DISPA
56c3553f2c
expr: Refactor evaluation to be interative instead of recursive
...
Fix a stack overflow happening on long inputs
2025-03-13 17:05:51 +01:00
Daniel Hofstetter
33a34e4e54
ls,wc: remove unnecessary unsafe blocks
2025-03-11 17:17:15 +01:00
Dorian Peron
bbca2ffdbf
printf: fix escape octal parsing
...
Co-authored-by: aryal <141743392+aryalaadi@users.noreply.github.com>
2025-03-11 12:46:59 +01:00
Bluemangoo
150960ac5c
uucore&uptime: fix docs and warnings
2025-03-10 21:29:08 +08:00
Bluemangoo
b1fc601cf8
uucore: fix uptime on Windows
2025-03-10 21:29:08 +08:00
Sylvestre Ledru
105a90c9df
prepare version 0.0.30
2025-03-08 11:04:08 +01:00
Sylvestre Ledru
2ae14a393a
Merge pull request #7408 from sylvestre/head-error
...
head: improve error mgmt.
2025-03-07 14:02:07 +01:00
Sylvestre Ledru
02da79bfaf
head: remove debug info
2025-03-07 11:24:56 +01:00
Sylvestre Ledru
dedd644016
head: improve error mgmt.
...
And provide more details than GNU
Should fix tests/head/head-write-error
2025-03-07 11:24:54 +01:00
Sylvestre Ledru
0e7a26178f
Merge pull request #7213 from cakebaker/kill_add_tests
...
kill: test "-l <number>" & adapt error messages
2025-03-07 08:53:35 +01:00
Zachary Goff-Hodges
1f2bd34ef0
stdbuf: updated 'build.rs' fixed issue #6981
2025-03-05 12:02:11 +01:00
Sylvestre Ledru
d31a19f2c4
Merge pull request #7356 from RenjiSann/expr-fixes
...
expr: Add tests
2025-03-05 11:35:09 +01:00
Sylvestre Ledru
15864bcac1
Merge pull request #7405 from cakebaker/remove_once_cell
...
Remove `once_cell` dependency and use `LazyLock`
2025-03-05 11:34:40 +01:00
Daniel Hofstetter
e177f7a6b0
Remove once_cell dependency & use LazyLock
2025-03-05 11:02:56 +01:00
Daniel Hofstetter
3b9b8c51cf
uucore: remove lazy_static & use LazyLock instead
2025-03-05 10:13:30 +01:00
Daniel Hofstetter
1a316e80c0
cksum: replace is_some_and with is_none_or
...
for better readability
2025-03-05 08:52:08 +01:00
Sylvestre Ledru
cda24c678a
Merge pull request #7400 from cakebaker/mktemp_tr_use_repeat_n
...
mktemp,tr: replace `repeat().take()` with `repeat_n()`
2025-03-04 16:06:09 +01:00
Daniel Hofstetter
da6d00b876
mktemp,tr: replace repeat().take() with repeat_n()
2025-03-04 15:26:38 +01:00
Daniel Hofstetter
aa6c03885a
clippy: fix warnings from unnecessary_map_or lint
2025-03-04 14:53:32 +01:00
Daniel Hofstetter
ac30e4cf92
uucore: replace PanicInfo with PanicHookInfo
2025-03-04 11:03:18 +01:00
Dorian Peron
a9d8eed217
expr: Remove useless arg in enum variant
2025-03-04 10:27:55 +01:00
Tuomas Tynkkynen
8f119fba5e
uucore: Fix proc_info compilation
...
Fixes #7383
2025-03-03 16:51:35 +02:00
Dorian Péron
76ad6042b5
Merge pull request #7253 from karlmcdowall/head_stdio_file
...
Head: ensure stdin input stream is correct on exit
2025-02-28 17:05:06 +01:00
Dorian Péron
5c29054a40
Merge pull request #7365 from drinkcat/printf-float-hex-exponent
...
printf: (partially) fix hex format: exponent is decimal, correctly print negative numbers
2025-02-28 15:53:39 +01:00
Daniel Hofstetter
854000e394
Merge pull request #7351 from dezgeg/process-sync
...
uucore: Sync proc_info methods from procps
2025-02-28 09:33:09 +01:00
Nicolas Boichat
f23e6f1cab
uucore: format: Fix printing of negative floating hex
...
Negative numbers were not printed correctly with `%a`:
- A leading `-` is expected.
- The exponent mask was too wide (15 bits instead of 11)
2025-02-26 21:42:21 +01:00
Nicolas Boichat
576655b926
uucore: format: Fix printing of floating hex exponents
...
Floating hex format is supposed to be `[-]0xh.hhhp±d`. Note that
the exponent is a decimal value, not an hex number: fix that.
Also, add basic tests for this format, while we're at it.
Test: `cargo test --package uucore --all-features float`
Fixes #7362 .
2025-02-26 21:42:13 +01:00
Karl McDowall
ad20cb35a0
Head: ensure stdin input stream is correct on exit
...
Fix issue #7028
Head tool now ensures that stdin is set to the last character
that was output by the tool. This ensures that if any subsequent
tools are run from the same input stream they will start at the
correct point in the stream.
2025-02-26 11:41:29 -07:00
Daniel Hofstetter
15eaeaec14
Merge pull request #7347 from BigPapa314/cp--fix-don't-show-msg-with-cp--i--v---update=older-a-b-if-a-is-older-than-b
...
cp: disabled verbose output if file has been skipped
2025-02-26 08:48:35 +01:00
Tuomas Tynkkynen
88b93a6865
uucore: Extend proc_info spell checker list
2025-02-25 19:29:45 +02:00
Tuomas Tynkkynen
339a6d4c46
uucore: Sync uid/gid methods from procps
2025-02-25 11:51:20 +02:00
Tuomas Tynkkynen
16c174d826
uucore: Sync thread_ids() method from procps
2025-02-25 11:51:20 +02:00
Dorian Peron
44077e37a8
expr: Do not parse arguments using clap
2025-02-25 01:49:40 +01:00
Thomas Kilian
63fe4fb327
cp: disabled verbose output if file has been skipped
2025-02-24 22:24:27 +01:00
Sylvestre Ledru
81048228cf
Merge pull request #7322 from alexsnaps/issue-7221
...
numfmt: fix Unit::SI uses lowercase `k` suffix for kilos
2025-02-24 19:28:00 +01:00
Dorian Peron
2fc762b9d2
expr: Evaluate parenthesis content before checking for closing parenthesis
2025-02-23 16:22:06 +01:00
Dorian Peron
2670885b4f
expr: Use thiserror to be consistent with error definition in other uutils
2025-02-23 16:22:06 +01:00
Jeffrey Finkelstein
faf3412019
Style fixes from cargo +nightly clippy
2025-02-22 10:11:01 -05:00