1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-15 01:31:08 +00:00
Commit graph

7518 commits

Author SHA1 Message Date
Pearl
edf8be5e08
uucore/buf_copy: Improve the uucore integration (#6983)
---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-12-28 15:30:10 +01:00
Sylvestre Ledru
067b2964c6
Merge pull request #6993 from jtracey/wc-fixes
wc: fix escaping
2024-12-28 12:52:12 +01:00
Justin Tracey
ff8a31e835
wc: fix escaping
GNU wc only escapes file names with newlines in them.
2024-12-27 11:37:16 -05:00
Daniel Hofstetter
f62b8d7975 csplit: allow offset without sign in pattern 2024-12-27 16:08:48 +01:00
Daniel Hofstetter
20dfb27057 cut: fix handling of newline as delimiter 2024-12-27 09:12:47 +01:00
Daniel Hofstetter
6478f68c5a
Merge pull request #7003 from sylvestre/use-func
cp: use the function from uucore
2024-12-27 08:34:30 +01:00
Solomon
98c9be5ec4
mv: improve move-to-self error handling (#6995)
- improve move-to-self detection, so this errors without data loss:

```diff
 mkdir mydir
 mv mydir mydir/subdir
-mv: No such file or directory (os error 2)
+mv: cannot move 'mydir' to a subdirectory of itself, 'mydir/subdir'
```

- align "cannot move source to a subdirectory of itself" and "same file"
  errors more closely with coreutils:

```diff
 mkdir mydir
 mv mydir/ mydir/..
-mv: cannot move 'mydir/' to a subdirectory of itself, 'mydir/../mydir/'
+mv: 'mydir/' and 'mydir/../mydir' are the same file
```

Causing: https://github.com/nushell/nushell/issues/13082
2024-12-26 20:48:29 +01:00
Sylvestre Ledru
2deeb7882c xattr feature: enable it on mac too 2024-12-26 17:25:12 +01:00
Sylvestre Ledru
1180905b5e cp: use the function from uucore 2024-12-26 17:08:16 +01:00
Sylvestre Ledru
b4cdc36573
Merge pull request #6997 from cakebaker/echo_handle_double_hyphen
echo: handle double hyphens
2024-12-26 12:19:07 +01:00
Daniel Hofstetter
db37c316af csplit: add support for -q 2024-12-26 09:40:55 +01:00
Daniel Hofstetter
90465357e2 echo: handle double hyphens 2024-12-24 17:01:45 +01:00
Daniel Hofstetter
d3db8dc29f
Merge pull request #6987 from sylvestre/setcap
ls: when a file has capabilities (setcap), change the color
2024-12-22 17:12:35 +01:00
Sylvestre Ledru
e736c2ae36
Merge pull request #6990 from cakebaker/cut_ob_abut
cut: don't merge adjacent ranges
2024-12-22 16:19:07 +01:00
Sylvestre Ledru
ffc6eb094a ls: Don't call the capabilites features of the system when passed an empty ca=
in LS_COLORS

In parallel, in the GNU test, adjust the GNU tests as we don't use libcap
but xattr instead.
2024-12-22 16:17:05 +01:00
Sylvestre Ledru
9a97c18877 ls: when a file has capabilities (setcap), change the color
Should fix tests/ls/capability.sh
2024-12-22 16:17:05 +01:00
Daniel Hofstetter
392c48002c cut: don't merge adjacent ranges 2024-12-22 15:07:04 +01:00
Daniel Hofstetter
efe3cda6ff echo: remove code made obsolete by MSRV 1.79 2024-12-22 14:26:35 +01:00
Sylvestre Ledru
913d5d413b
Merge pull request #6957 from karlmcdowall/sort_merge_chunking_rework
sort: Rework merge batching logic
2024-12-21 23:19:44 +01:00
Sylvestre Ledru
bb2fb66073
Merge pull request #6882 from jtracey/quoting_style_bytes
quoting_style: Add support for non-UTF-8 bytes
2024-12-21 23:17:43 +01:00
Daniel Hofstetter
a152687d48
Merge pull request #6971 from sylvestre/mkfifo
mkfifo: better handle the mode + umask
2024-12-21 15:31:15 +01:00
Sylvestre Ledru
31ffc3a0eb mkfifo: better handle the mode + umask
Should make tests/misc/mknod.sh pass
2024-12-20 18:17:52 +01:00
Daniel Hofstetter
cf8a81c6c2 cut: fix overriding of -d= 2024-12-20 10:02:36 +01:00
Justin Tracey
db1ed4c094
core: improve OsStr(ing) helpers
This adds the `os_str_as_bytes_lossy` function, for when we want infallible
conversion across platforms, and improves the doc comments of similar functions
to be more accurate and better formatted.
2024-12-19 17:10:16 -05:00
Santeri Paavolainen
2ae914b268
uucore: correctly truncate response if getgroups shrinks (#6978)
The code above this line handles the case if `res` is
larger than `ngroups`, but `res < ngroups` is also a possibility,
which this line attempts to address but actually does not.

The original code resizes to `ngroups` which is a no-op (given
that `groups` is already `ngroups` size). The correct target for
re-sizing the `groups` is the result from the last `getgroups`,
i.e., `res`.
2024-12-19 13:54:24 +01:00
Daringcuteseal
625c49d0fe
uucore: add common splice-write functionality
Splice is a Linux-specific syscall that allows direct data copying from
    one file descriptor to another without user-space buffer. As of now, this
    is used by `cp`, `cat`, and `install` when compiled for Linux and Android.
2024-12-19 18:32:11 +07:00
Justin Tracey
43229ae104
quoting_style: use and return OsStrings
This exposes the non-UTF-8 functionality to callers. Support in `argument`,
`spec`, and `wc` are implemented, as their usage is simple. A wrapper only
returning valid unicode is used in `ls`, since proper handling of OsStrings
there is more involved (outputs that escape non-unicode work now though).
2024-12-18 15:28:39 -05:00
Justin Tracey
2331600f4c
quoting_style: fix multi-byte control characters 2024-12-18 15:28:28 -05:00
Justin Tracey
355103134b
quoting_style: add support for non-unicode bytes
This new functionality is implemented, but not yet exposed here.
2024-12-18 15:28:18 -05:00
Sylvestre Ledru
7708f6e39a clippy: replace .as_bytes().len() => .len() 2024-12-17 22:47:45 +01:00
Sylvestre Ledru
beb56b10ab clippy: fix clippy warnings
See:
https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
2024-12-17 22:46:21 +01:00
Daniel Hofstetter
d414dbc83b basenc: ignore case with "--base16 --decode" 2024-12-17 10:52:25 +01:00
Sylvestre Ledru
6755956bc4
cut.pl: adjust to our messages as they are better (#6921)
* cut.pl: adjust to our messages as they are better

but we still have some differences on this test

* cut: add some missing line return when needed

* cut: add failing tests covered by cut.pl

* Remove dup test

* cut: add spell-checker:ignore line to test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-12-16 15:37:29 +01:00
Karl McDowall
6bdcad32da sort: Rework merge batching logic
Fix bug #6944
Rework the way batching is done with sort such that it doesn't open
more input files than necessary. Previously, the code would always
open one extra input file which causes problems in ulimit scenarios.
Add additional test case.
2024-12-15 12:40:15 -07:00
Daniel Hofstetter
ee0426e3f3 seq: use allow_hyphen_values instead of
allow_negative_numbers because clap removed support for "exotic" negative
numbers like -.1
2024-12-15 16:14:01 +01:00
Daniel Hofstetter
209ec0b817
Merge pull request #6929 from RenjiSann/cksum-fixes
cksum: even more fixes
2024-12-12 10:16:48 +01:00
Dorian Péron
958222a07c test(cksum): un-ignore tests that are now implemented 2024-12-12 09:49:53 +01:00
Dorian Péron
567bbc5f3c checksum: remove ALGO_BASED_REGEX (non base64) as its not useful anymore and introduce LineFormat struct 2024-12-12 09:49:53 +01:00
Dorian Péron
f4e5dc2e0f checksum: use the blake2b length as an hint to check the correctness of the expected digest 2024-12-12 09:49:53 +01:00
Alexander Shirokov
3900fa91ba
seq:reduce memory allocation during prefix search
This improvement eliminates extra memory allocations during the search
for 0x/0X prefixes in number strings.
2024-12-11 14:28:46 +01:00
Dorian Péron
10a9b0bfbf checksum: split treatment of algo-based and non-algo based into separate functions 2024-12-10 13:09:04 +01:00
Dorian Péron
65ddccbeb6 checksum: avoid to recompute Regexps 2024-12-10 13:09:04 +01:00
Dorian Péron
ed15ca1d26 checksum: keep a cache of the first used regex for non-algo-based regexes 2024-12-10 13:09:04 +01:00
Sylvestre Ledru
c60203ddd3
stat: improve GNU compatibility (#6933)
* stat: fix the quotes when dealing with %N

and other formats
should fix
tests/stat/stat-fmt.sh

* stats: use an enum instead of a string

* stats: split the functions into smaller functions

* stat: handle byte as a format for better display

* stat: handle error better. should make tests/stat/stat-printf.pl pass

* stat: Some escape sequences are non-standard

* Fix tests

* Take comments into account
2024-12-10 08:48:52 +01:00
Christian Legnitto
2ca7c28cd9
Make Spec public 2024-12-09 22:01:36 -04:00
Daniel Hofstetter
2a9e7c937a
Merge pull request #6906 from sylvestre/base-wrap
base32/base64: handle two corner cases
2024-12-09 13:55:15 +01:00
Sylvestre Ledru
bc1bbf3e50
Merge pull request #6936 from alexs-sh/fix-mv-issue-6727
fix(mv): don't panic if apply_xattrs fails
2024-12-09 09:41:24 +01:00
Daniel Hofstetter
ec67d22123 more: adapt test to change in unicode-width 2024-12-09 09:20:19 +01:00
aimerlief
367cc19d45
fix(seq): handle 0e... scientific notation without padding (#6934)
* fix(seq): handle 0e... scientific notation without padding

- Updated the parse_exponent_no_decimal function to treat 0e... as zero.
- Added test cases to verify correct behavior for 0e15 and -w 0e15.

Fix: #6926

* fix(seq): improved parse for accurate BigDecimal handling

* apply missing cargo fmt formatting adjustments
2024-12-07 16:42:34 +01:00
Alexander Shirokov
4e79a01513
fix(mv): don't panic if apply_xattrs fails
This commit fixes issue #6727 by returning the error status instead of
causing a panic. It aligns with the original GNU mv more closely.
2024-12-07 15:25:45 +01:00