1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-17 10:41:03 +00:00
Commit graph

7749 commits

Author SHA1 Message Date
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
jfinkels
4acc59d075
test: add < and > operators for string comparison (#7315)
* test: add < and > operators for string comparison

Fixes #7254.

* Add more tests for string inequality

* Use match in place of if/elseif block

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Change test name to specify lt/gt operator

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-02-21 14:41:15 +01:00
Daniel Hofstetter
9074f3fe8f clippy: disable warnings from unnecessary_map_or
because fix requires an MSRV of 1.82
2025-02-21 07:54:57 +01:00
Daniel Hofstetter
6c47989186 clippy: fix warning from precedence lint 2025-02-21 07:37:48 +01:00
Sylvestre Ledru
12bb82fac0
Merge pull request #7294 from karlmcdowall/head_read_but_last_n_bug
head: Fix bug printing large non-seekable files
2025-02-20 12:09:57 +01:00
Bluemangoo
047ec995f2
uptime: refactor, move some codes to uucore (#7289) 2025-02-20 12:09:06 +01:00
Dorian Peron
989b6ba2a0 tr: raise an error when there are two chars or more in an equivalence class 2025-02-19 16:15:40 +01:00
Daniel Hofstetter
99d4fbdd85
Merge pull request #7325 from jfinkels/rm-prompt-message-inaccessible
rm: correct prompt for removing inaccessible dir
2025-02-19 10:36:30 +01:00
Jeffrey Finkelstein
2b531b78ef rm: correct prompt for removing inaccessible dir
Change the prompt when attempting to remove an inaccessible
directory. Before this commit, the prompt was

    rm: remove write-protected directory 'dir'?

After this commit, the prompt is

    rm: attempt removal of inaccessible directory 'dir'?

This required slightly adjusting the logic for which prompt messages to
display under which circumstances.

Fixes #7309.
2025-02-18 18:39:45 -05:00
Alex Snaps
17a409532f
Fix #7219: from iec-i without suffix are bytes
Signed-off-by: Alex Snaps <alex@wcgw.dev>
2025-02-18 17:17:29 -05:00
Alex Snaps
1250195bce
Fix #7221: Unit::SI uses lowercase k for kilos
Other units remain untouched and use uppercase `K`, as well as all other suffixes

Signed-off-by: Alex Snaps <alex@wcgw.dev>
2025-02-18 15:32:47 -05:00
Sylvestre Ledru
bc995283c4
Merge pull request #7304 from jfinkels/rm-recursive
rm: use recursive directory traversal with --recursive
2025-02-18 08:23:05 +01:00
Jeffrey Finkelstein
f979f97214 echo: use uucore::format::parse_escape_only()
Remove some duplicate code in favor of just calling
`uucore::format::parse_escape_only()`.

Fixes #7258.
2025-02-17 17:24:18 -05:00
Jeffrey Finkelstein
1606968bf2 rm: recursive implementation of -r option
Change the implementation of `rm -r` so that it is explicitly recursive
so that (1) there is one code path regardless of whether `--verbose` is
given and (2) it is easier to be compatible with GNU `rm`.

This change eliminates a dependency on the `walkdir` crate.

Fixes #7033, fixes #7305, fixes #7307.
2025-02-17 11:18:24 -05:00
Jeffrey Finkelstein
efbc78b8ae rm: add is_dir_empty() helper function 2025-02-17 11:16:55 -05:00
Jeffrey Finkelstein
78b51cb939 rm: check write permissions instead of readonly()
Check the user write permission directly from the mode instead of using
the `Permissions::readonly()` method. This seems to more closely match
the behavior of GNU `rm`.
2025-02-17 11:16:55 -05:00
hamflx
b96f825503 mv: Make mv command fallback to copy only if the src and dst are on different device 2025-02-17 00:22:28 +01:00
Sylvestre Ledru
511590ad44
Merge pull request #7303 from rwdj/fix-5692-usage-strings
Fix usage strings for #5692
2025-02-17 00:14:17 +01:00
Jeffrey Finkelstein
464181bb56 rm: simplify remove_dir() helper function 2025-02-16 12:18:37 -05:00
RWDJ
55502cb44f
test: fix usage string
`[` alone is not a valid test command.
`test` alone is a valid test command.
`]` alone is not a valid test command.

Update usage string to match GNU behavior.
2025-02-15 19:27:01 -06:00
RWDJ
9f93bb1932
hashsum: fix usage string
hashsum requires a --<digest> and may accept multiple options.
2025-02-15 18:53:05 -06:00
RWDJ
460dc52e68
unlink: fix usage string
unlink must either take an option or a file. Update usage string to
match GNU behavior.
2025-02-15 18:51:59 -06:00
RWDJ
4649c717b6
runcon: fix usage string
runcon requires a context command. Update usage string to match GNU
behavior.
2025-02-15 18:51:44 -06:00
Karl McDowall
84b42a8ce4 head: Fix bug printing large non-seekable files
Fixes issue #7288.
Rewrite logic for print-all-but-last-n-bytes in non-seekable
files.
2025-02-12 10:16:44 +01:00
aimerlief
dd7b45465c
cp: print verbose msg after prompt (#7287)
* cp: fix verbose output order after prompt

Fixes: #7285

* cp: add test for verbose message order

* cp: fix test for interactive prompt ordering

* cp: update test for verbose output order

* cp: fix test cases to use update option
2025-02-11 09:19:08 +01:00
Jeffrey Finkelstein
18f9ca9da4 csplit: don't panic on missing suppressed file
Avoid a panic that would occur when attempting to remove a file that
didn't exist. This would happen when scanning for a regular expression
match, advancing by a positive offset, and suppressing empty files. For
example, before this commit,

    echo a | csplit -z - %a%1

would cause a panic. After this commit, the process terminates as
expected: without error, without output, and without any files written.

Fixes #7251.
2025-02-09 22:04:47 -05:00
Daniel Hofstetter
d86a7fb593
Merge pull request #7274 from jfinkels/touch-obsolete-posix-args
touch: support obsolete POSIX timestamp argument
2025-02-08 15:24:23 +01:00
Jeffrey Finkelstein
864215653e Collapse multiple if statements with && 2025-02-08 08:49:08 -05:00
Daniel Hofstetter
03b6371422
Merge pull request #7273 from RenjiSann/tee-fix-p-broken-stdout
tee: fix -p behavior upon broken pipe stdout
2025-02-07 16:19:18 +01:00
Jeffrey Finkelstein
c9312eba9a cat: error when output is input and appending
Change `cat` so that it terminates with an error message when the input
file is the same as the output file and the output file is being
appended to. For example,

    cat <f >>f
    cat: -: input file is output file

Fixes #7165
2025-02-07 07:45:21 -05:00
Jeffrey Finkelstein
c23e1db9c5 Use the last, not first, two digits as the year 2025-02-06 22:02:47 -05:00
Dorian Peron
67aa0b25ab tee: fix -p behavior upon broken pipe stdout 2025-02-06 11:29:29 +01:00
Jeffrey Finkelstein
6dfa1f8276 touch: support obsolete POSIX timestamp argument
Support obsolete form of timestamp argument for old POSIX versions. In
summary, when older versions of POSIX are used and the first positional
argument looks like a date and time, then treat it as a timestamp
instead of as a filename. For example, before this commit

    _POSIX2_VERSION=199209
    POSIXLY_CORRECT=1
    touch 01010000 11111111

would create two files, `01010000` and `11111111`. After this commit,
the first argument is interpreted as a date and time (in this case,
midnight on January 1 of the current year) and that date and time are
set on the file named `11111111`.

Fixes #7180.
2025-02-05 22:04:47 -05:00
karlmcdowall
f94ff78ea4
head: fix bug reading back through files (#7248)
* head: fix bug reading back through files

Fix issue #7247.
Rework logic for reading/seeking backwards through files.
Bug was seen when reading back through large files.
Added test case to validate fix.
2025-02-03 20:13:46 +01:00