1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00
Commit graph

15910 commits

Author SHA1 Message Date
Daniel Hofstetter
67400abd70
Merge pull request #7818 from sylvestre/selinux-mknod
mknod: implement selinux support
2025-04-23 09:38:09 +02:00
Sylvestre Ledru
c9babe4e6f mknod: pass a string instead of matches 2025-04-23 08:37:42 +02:00
Sylvestre Ledru
aebada4cd4 mknod: implement selinux support
+ improve the option management a bit
2025-04-23 08:37:42 +02:00
Teemu Pätsi
6ac444a9c6
id: Handle NULL pointer gracefully within cstr2cow macro (#7810)
* id: Handle NULL pointer gracefully within `cstr2cow` macro

> getlogin() returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a NULL pointer if this information cannot be determined.

Ref: https://linux.die.net/man/3/getlogin

* id: Remove redundant std::ffi:: prefix from CStr

* id: Add comment for the null check

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

* id: Remove skip for test that should not segfault anymore

Segfault fixed by 292fb9242342d47412a789f4d0002b811568bd41

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-04-23 08:26:00 +02:00
Sylvestre Ledru
a4230410c8
Merge pull request #7821 from cakebaker/mknod_remove_windows_code_flags
mknod: remove windows-related code & flags
2025-04-22 17:32:10 +02:00
Daniel Hofstetter
9e7f3acbc7 mknod: remove windows-related code & flags 2025-04-22 16:57:26 +02:00
Sylvestre Ledru
1986c965cc
Merge pull request #7782 from drinkcat/seq-perf-more-use-cat
Move seq's `fast_inc` to `uucore`, use it in `cat`
2025-04-22 15:54:00 +02:00
Sylvestre Ledru
96b714781a
Merge pull request #7813 from drinkcat/ls-opt-2
ls: More performance optimizations
2025-04-22 15:53:36 +02:00
Daniel Hofstetter
0bb8a0a562
Merge pull request #7820 from uutils/sylvestre-patch-5
add tests/misc/tee.sh to the list of intermittent issues
2025-04-22 11:42:57 +02:00
Sylvestre Ledru
7cdbc3c1e4
add tests/misc/tee.sh to the list of intermittent issues 2025-04-22 10:11:34 +02:00
Sylvestre Ledru
77c4ba5bea
Merge pull request #7241 from jfinkels/mv-copy-across-filesystems
mv: fix moving FIFO to a different filesystem
2025-04-21 23:03:26 +02:00
Sylvestre Ledru
83679a3956
Merge pull request #7790 from drinkcat/num_parser_simplify
uucore: num_parser: Operate on slices, instead of iterator
2025-04-21 22:50:05 +02:00
Sylvestre Ledru
aacd6d4779
Merge pull request #7816 from drinkcat/test_ls_more_acl
test_ls: Improve acl test
2025-04-21 22:45:44 +02:00
Sylvestre Ledru
c40856fa86
Merge pull request #7817 from uutils/renovate/ctor-0.x-lockfile
chore(deps): update rust crate ctor to v0.4.2
2025-04-21 22:45:05 +02:00
renovate[bot]
25b6543459
chore(deps): update rust crate ctor to v0.4.2 2025-04-21 19:42:25 +00:00
Nicolas Boichat
adb23b154f test_ls: Improve acl test
Create a file with some ACL, and another without, and check that `+`
only appears on the file with ACL.
2025-04-21 17:19:06 +02:00
Daniel Hofstetter
9a04845c01
Merge pull request #7811 from drinkcat/test-ls-improve-perm-io-errors
test_ls: Improve test_ls_perm_io_errors
2025-04-21 14:09:47 +02:00
Nicolas Boichat
fc6b896c27 ls: Optimize time formatting
Instead of recreating the formatter over and over again, keep
it pre-parsed in a variable in TimeStyler class.

Also, avoid calling `now` over and over again, that's also slow.

Improves performance by about 6%.
2025-04-21 12:19:14 +02:00
Nicolas Boichat
b833deb8d1 ls: display_uname/group: Return a reference
Cache even numerical strings (numeric_uid_gid) in the HashMap,
this makes very little difference performance wise.

However, this allows us to return a reference to a String instead
of making a clone.

Saves about 2-3% on `ls -lR /var/lib .git` (and `ls -lRn`).

Also, add a note that HashMap might not be the most optimal choice.
2025-04-21 12:19:14 +02:00
Nicolas Boichat
1890467bd7 ls: ListState: Add uid/gid cache to the structure
Easier to reason about than the LazyLock/Mutex encapsulated
static variables.

Performance difference is not measurable, but this drops uneeded
Mutex lock/unlock that were seen in samply output.
2025-04-21 12:19:14 +02:00
Nicolas Boichat
615e684c5d ls: Create a ListState struct to maintain state
We put the out writer and style manager in there, for now.

Reduces the number of parameters to pass around, and we'll add
more useful things in there.

Little to no performance difference.
2025-04-21 12:19:14 +02:00
Nicolas Boichat
e84de9b97f uucore: fast_inc: Add a debug_assert for developer convenience
Suggested by our AI overlords.
2025-04-21 11:31:08 +02:00
Nicolas Boichat
4fe0da46ba cat: add LineNumber.to_str to clean up tests, limit to 32 digits 2025-04-21 11:25:54 +02:00
Nicolas Boichat
520459bb91 uucore: fast_inc: Change start to a &mut
Instead of having the caller repeatedly reassign start, it's easier
to just pass it as a mutable reference.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
f9aaddfd3d cat: Switch to uucore's fast_inc_one
Instead of reimplementing a string increment function, use the
one in uucore. Also, performance is around 5% better.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
764514bf22 uucore: Move fast_inc functions from seq
A new fast-inc feature, to be used by seq and cat.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
54b2c12844 seq: fast_inc: split carry operation to a separate function
This has no impact on performance, and will be useful for the
`cat` usecase when we move this to uucore.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
03b2cab650 seq: Update doc for fast_inc 2025-04-21 11:25:54 +02:00
Nicolas Boichat
c311e208ae seq: Add constant width support in fast path
It is actually quite easy to implement, we just start with
a padded number and increment as usual.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
560d1eb1b7 seq: Add a print_seq fast path function for integer and positive increments
A lot of custom logic, we basically do arithmetic on character
arrays, but this comes at with huge performance gains.

Unlike coreutils `seq`, we do this for all positive increments
(because why not), and we do not fall back to slow path if
the last parameter is in scientific notation.

Also, add some tests for empty separator, as that may catch
some corner cases.
2025-04-21 11:25:54 +02:00
Nicolas Boichat
a3e837ea99 test_ls: Improve test_ls_perm_io_errors
Do more extensive test of the output to check long output for
metadata failure, without relying on GnuTests
2025-04-21 11:12:26 +02:00
Ben Wiederhake
d7d0f9da7a
shred: correctly print zero-byte pass in verbose mode (#7800)
Fixes #7798.

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-04-21 11:06:06 +02:00
Sylvestre Ledru
b5e0e2342b
Merge pull request #7801 from drinkcat/ls-opt-1
ls: Print optimizations
2025-04-21 10:17:55 +02:00
Terts Diepraam
993644c74b
Merge pull request #7803 from jplatte/chroot
Fix chroot trying to change into non-existent directory
2025-04-21 09:39:57 +02:00
Daniel Hofstetter
06bae0d797
Merge pull request #7799 from BenWiederhake/dev-shred-verbose-no-padding
shred: remove unwanted padding in verbose messages
2025-04-21 09:33:44 +02:00
Daniel Hofstetter
36a6fe75fa
Merge pull request #7807 from uutils/renovate/blake3-1.x-lockfile
chore(deps): update rust crate blake3 to v1.8.2
2025-04-21 07:10:13 +02:00
renovate[bot]
0eab1c2391
chore(deps): update rust crate blake3 to v1.8.2 2025-04-21 02:13:39 +00:00
Jonas Platte
25ce0badf1
Fix chroot trying to change into non-existent directory 2025-04-20 22:12:21 +02:00
Nicolas Boichat
3de90b93ec ls/BENCHMARKING.md: Add some tricks 2025-04-20 22:07:21 +02:00
Nicolas Boichat
cd4cb43538 ls: display_item_name: Make current_column a closure
In many cases, current_column value is not actually needed, but
computing its value is quite expensive (`ansi_width` isn't very
fast).

Move the computation to a LazyCell, so that we only execute it
when required.

Saves 5% on a basic `ls -lR .git`.
2025-04-20 22:07:21 +02:00
Nicolas Boichat
4212385f76 ls: Add extend_pad_left/right functions that operate on Vec<u8>
Saves another ~7% performance.
2025-04-20 22:07:20 +02:00
Nicolas Boichat
8b9960f093 ls: Optimize display_item_long
Preallocate output_display to a larger size, and use `extend`
instead of format.

Saves about ~5% performance vs baseline implementation.
2025-04-20 22:06:58 +02:00
Zhang Wen
b009cae5a8
install: improve error message (#7794)
* friendly message install file to directory containing directory with same name

* install: test install file to directory containing directory with same name
2025-04-20 18:45:15 +02:00
Ben Wiederhake
af7a939b62 shred: remove unwanted padding in verbose messages
This is tested for in the GNU shred-passes test, so we don't have a
choice if we want to stay compatible.
2025-04-20 18:28:23 +02:00
Daniel Hofstetter
f92ee6a519
Merge pull request #7792 from karlmcdowall/tail_fix_v_option
tail: fix issue with -v flag and stdin
2025-04-20 17:00:37 +02:00
Karl McDowall
e35ef16030 tail: fix issue with -v flag and stdin
Fixes issue #7613
Tail now correctly handles the -v flag when only 1 input file is given.
2025-04-19 09:49:06 -06:00
Jeffrey Finkelstein
2717f9c8b5 mv: fix moving FIFO to a different filesystem
Fix a bug in `mv` where it would hang indefinitely while trying to copy
a FIFO across filesystems. The solution is to remove the old FIFO and
create a new one on the new filesystem.

Fixes #7076
2025-04-19 11:12:53 -04:00
Nicolas Boichat
ddbd995886 uucore: num_parser: Operate on slices, instead of iterator
Especially after splitting the `parse` function in multiple
chunks, this makes the code a bit easier to read, despite the fact
that `parse` is still inherently a complex function.
2025-04-19 17:09:13 +02:00
Daniel Hofstetter
1d89ea5b6d
Merge pull request #7781 from dan-hipschman/env-ignore-flags-after-command
env: ignore flags after the command or -- argument
2025-04-19 14:50:21 +02:00
Daniel Hofstetter
ed3dad81f7
Merge pull request #7786 from siddharthteli12/main
whoami: remove unused libc dependency
2025-04-19 13:29:14 +02:00