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

15910 commits

Author SHA1 Message Date
Sylvestre Ledru
1a80fc59a3 l10n: init the locale engine for each program (next: put it behing a feature) 2025-06-04 19:24:03 +02:00
Sylvestre Ledru
94c1fad206 l10n: adjust the code to use the fluent files instead of the PROG.md docs 2025-06-04 19:23:57 +02:00
Sylvestre Ledru
28c16dd6d1 l10n: convert the PROG.md command to fluent 2025-06-04 19:19:02 +02:00
Sylvestre Ledru
d8bb7875cf l10n: adjust the code to use help_about & help_usage 2025-06-04 19:19:02 +02:00
Sylvestre Ledru
42cfb3d8be locale: show the error in case of issue 2025-06-04 19:18:59 +02:00
ALBIN BABU VARGHESE
a7a493a604
mv: moving dangling symlinks into directories (#8064)
* Fix linting and style issues

* Change condition to not fail for dangling symlinks

The function `move_files_into_dir` had a condition that failed when a
dangling symlink was moved into a folder, which resulted in a file
or directory doesn't exist error

* Added a test case
2025-06-04 17:25:53 +02:00
Nicolas Boichat
8c98f433bf test_sort: Add one more test checking arbitrary precision handling 2025-06-04 09:54:44 +02:00
Nicolas Boichat
ee1a6d2e66 test_sort: Add more sort use cases
test_g_float comes from GNU test, the other one is manually crafted.
2025-06-04 09:33:17 +02:00
Nicolas Boichat
a2f9543a14 docs/src/extensions: Sort uses arbitrary precision decimal numbers 2025-06-04 09:05:49 +02:00
Daniel Hofstetter
c332d96203
Merge pull request #8055 from sylvestre/gnu-release
GNU CI: also build selinux with --release-build
2025-06-04 07:22:39 +02:00
Daniel Hofstetter
1bcd1265fe
Merge pull request #8057 from uutils/sylvestre-patch-1
uucore_procs: use authors.workspace
2025-06-04 07:14:32 +02:00
Yuri Astrakhan
f46e096d35 Add common pre-commit hooks
Pre-commits are usually used to minimize busy work by the contributors, e.g., by fixing extra spacing, formatting, etc. This PR adds various basic text file checks to the repo. I also made yaml spacing a bit cleaner.

I was a bit surprised it is used for `cargo clippy` because you wouldn't want clippy's auto-fixes to be auto-applied by CI, so usually GitHub workflow simply checks runs it regularly. This is outside of the scope for this PR, but perhaps it should be removed here?
2025-06-03 18:59:36 -04:00
Sylvestre Ledru
4050f68e6e
uucore_procs: use authors.workspace 2025-06-03 22:26:58 +02:00
Sylvestre Ledru
e39037c699 GNU CI: also build selinux with --release-build 2025-06-03 21:41:01 +02:00
Nicolas Boichat
7457a76f40 uucore: num_parser: Optimize bigdecimal create when exponent is 0
Makes creating float number without an exponent part quite a bit
faster. Saves about 9% speed in sort -g.
2025-06-03 19:54:21 +02:00
Nicolas Boichat
3b18316337 uucore: num_parser: Optimize parse_digits_count
parse_digits_count is a significant hotspot in parsing code.
In particular, any add/mul operation on BigUint is fairly slow,
so it's better to accumulate digits in a u64, then add them
to the resulting BigUint.

Saves about 15-20% performance in `sort -g`.
2025-06-03 19:54:21 +02:00
Nicolas Boichat
edc1e5def6 uucore: num_parser: Improve scale conversion to i64
It turns out repeatedly calling i64::MAX.into() and i64::MIN.into()
is actually very expensive. Just do the conversion first, and if
it fails, we know why.

Sadly there is still a conversion happening under the hood in
`-exponent + scale`, but that'd need to be fixed in Bigint.

Improves sort -g performance by ~5%.
2025-06-03 19:54:21 +02:00
Nicolas Boichat
8426c1480c sort: Make use of ExtendedBigDecimal in -g sorting
This provides better precision than f64, which we need.

Fixed #8031.
2025-06-03 19:54:21 +02:00
Sylvestre Ledru
ef9cb277fc
Merge pull request #8052 from cakebaker/uptime_move_imports_into_test_function
uptime: move imports into test function
2025-06-03 17:26:27 +02:00
Daniel Hofstetter
3904d5b614 uptime: move imports into test function
to simplify the cfg handling
2025-06-03 16:12:52 +02:00
Daniel Hofstetter
040532a027
Merge pull request #8051 from uutils/renovate/bytecount-0.x-lockfile
chore(deps): update rust crate bytecount to v0.6.9
2025-06-03 10:49:41 +02:00
Vikram Kangotra
bfbdd5275d
cp: migrate from quick-error to thiserror (#7989)
* cp: migrate from quick-error to thiserror

fixes: #7916

* Remove quick-error

Now that we have migrated to thiserror, we can remove quick-error

* cp: fix test failures

* cp: fix fmt error
2025-06-03 10:12:36 +02:00
renovate[bot]
0c9f2f11f4
chore(deps): update rust crate bytecount to v0.6.9 2025-06-03 08:04:43 +00:00
Sylvestre Ledru
28612fe1f1
Merge pull request #8050 from drinkcat/local-lang-clippy
uucore: locale: Use if let instead of match
2025-06-03 10:02:31 +02:00
Nicolas Boichat
c939b6096b uucore: locale: Use if let instead of match
Recent cargo clippy prefers to use if let for single pattern.

For some reason it only triggers on one of the LANG restore case though,
but we can just fix them all.
2025-06-03 09:35:47 +02:00
Dylan Ullrich
862565cd1a
Merge pull request #8047 from eldyl/feat/add_wezterm_to_terms
Feat/add wezterm to terms
2025-06-03 07:54:05 +02:00
Sylvestre Ledru
be9af9c249
Merge pull request #8045 from cakebaker/rm_earlier_early_return
rm: do "early return" earlier in `uumain`
2025-06-02 17:42:44 +02:00
Daniel Hofstetter
3eede813db rm: remove some unnecessary type information 2025-06-02 16:22:40 +02:00
Daniel Hofstetter
25c7ed5b1e rm: set "after help" in uu_app instead of uumain 2025-06-02 16:19:33 +02:00
Daniel Hofstetter
dfc4e3efe5 rm: do "early return" earlier in uumain 2025-06-02 16:12:03 +02:00
Daniel Hofstetter
f002c4017f
Merge pull request #8042 from uutils/renovate/jiff-0.x-lockfile
chore(deps): update rust crate jiff to v0.2.14
2025-06-02 14:28:53 +02:00
Sylvestre Ledru
b5d4b0ee1d
Merge pull request #7972 from Ecordonnier/eco/stdbuf-regression-test
stdbuf: fix cross-compilation
2025-06-02 13:26:38 +02:00
Charlie-Zheng
b2893db5a4
sort: Implement the last changes to make sort-files0-from pass (#8011) 2025-06-02 11:14:49 +02:00
Etienne Cordonnier
35634b46a0 stdbuf: fix cross-compilation
Summary:

Partial fix for https://github.com/uutils/coreutils/issues/6591

The current code declare libstdbuf as a build-dependency of stdbuf as a
workaround to enforce that libstdbuf is compiled before stdbuf. This breaks
cross-compilation, because build-dependencies were compiled for the host
architecture, and not for the target architecture.

The reason this workaround is necessary is that bindeps is available only in nightly at the moment:
https://rust-lang.github.io/rfcs/3028-cargo-binary-dependencies.html

This commit replaces the "build-dependency" workaround with another workaround:
calling cargo manually to build libstdbuf in the build.rs of stdbuf, in order to ensure that libstdbuf is built before stdbuf.

Changes:

- Removed cpp/cpp_build dependencies:

The cpp, cpp_build, and related dependencies were removed because they made cross-compilation in a build.rs file very complex, since you need
to pass proper CXX env variables for cross-compilation, whereas cross-compiling rust code using cargo is quite simple.
Provided Rust implementations for getting stdin, stdout, and stderr pointers.
Switched from C++/cpp macro-based initialization to using the Rust ctor crate for library initialization.

- Remove "feat_require_crate_cpp" which is not needed any more, since stdbuf was the only utility using the cpp crate.

Tests:

This commit fixes e.g. this test:
cross test --target aarch64-unknown-linux-gnu --features stdbuf test_stdbuf::test_libstdbuf_preload -- --nocapture

- The "i686" build of stdbuf was also broken (stdbuf 32 bits, but libstdbuf 64 bits) and test_stdbuf::test_libstdbuf_preload of the i686 builds in github CI serves as regression
test for this issue, no need to add a cross-rs test for aarch64.
- The x86_64 musl build of stdbuf was also broken and was passing tests in CI only because it was compiled with the wrong libc (glibc instead of musl)

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-02 10:55:57 +02:00
Etienne Cordonnier
2e8b6fabcc stdbuf: add test_libstdbuf_preload
This test verifies that libstdbuf correctly gets preloaded, and that there are no architecture mismatch errors.
At the moment the test passes when compiled normally, but fails when compiled with cross-rs, due to https://github.com/uutils/coreutils/issues/6591

This passes:
```
cargo test --features stdbuf test_stdbuf::test_libstdbuf_preload -- --nocapture
```

This fails:
```
cross test --target aarch64-unknown-linux-gnu --features stdbuf test_stdbuf::test_libstdbuf_preload -- --nocapture
```

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2025-06-02 10:52:32 +02:00
Will Shuttleworth
dfc4072181
stty: fix output redirection (#8016)
* stty: fix output redirection

* Revert "stty: fix output redirection"

This reverts commit 604de7c4de6f51a6bcd495ccda11602c12804493.

* stty: fix output redirection by trying /dev/tty before stdout
2025-06-02 10:41:25 +02:00
renovate[bot]
80e6393777
chore(deps): update rust crate jiff to v0.2.14 2025-06-02 08:19:26 +00:00
Sylvestre Ledru
7b41a160b4
Merge pull request #8027 from cakebaker/cargo_toml_remove_procfs_dependency
Cargo.toml: remove `procfs` dependency & adapt `cp` test
2025-06-02 10:17:13 +02:00
Daniel Hofstetter
fd37324d72
Merge pull request #8028 from drinkcat/seq-latest-pow-with-context
uucore: num_parser: Update pow_with_context
2025-06-02 10:15:58 +02:00
Daniel Hofstetter
5bbcb4ee63 Cargo.toml: remove procfs dependency 2025-06-02 10:00:49 +02:00
Daniel Hofstetter
546e50846e cp: rewrite test to remove procfs dependency 2025-06-02 09:51:33 +02:00
Daniel Hofstetter
dfc2e249ef
Merge pull request #7894 from drinkcat/jiff-date-ls
date/ls: Switch from chrono to jiff
2025-06-02 09:36:27 +02:00
Sylvestre Ledru
f2579e52f2
Merge pull request #8035 from cakebaker/ln_rename_error_variant
ln: rename error variant
2025-06-01 21:08:20 +02:00
Nicolas Boichat
66d1e8a872 test_date: Expand on test_date_utc_time
Using the current time requires a bit of care, but it's nice
to have a test that doesn't use a fixed date as input.
2025-06-01 20:04:22 +02:00
Nicolas Boichat
5d75e28b87 ls: Simplify TimeStyle::format
Also, the comment does not fully apply anymore, so we can leave
it more open-ended to figure out how to support locale.
2025-06-01 19:36:58 +02:00
Nicolas Boichat
c5b445f6f2 uucore: num_parser: Clarify origin of pow_with_context
And why we use an older minimum Rust version in that piece of code.
2025-06-01 19:27:06 +02:00
Daniel Hofstetter
8a4d6dc0da
Merge pull request #8038 from uutils/renovate/clap_complete-4.x-lockfile
chore(deps): update rust crate clap_complete to v4.5.52
2025-06-01 09:48:38 +02:00
Daniel Hofstetter
121de8eee7
Merge pull request #8041 from uutils/renovate/dawidd6-action-download-artifact-10.x
chore(deps): update dawidd6/action-download-artifact action to v10
2025-06-01 09:48:03 +02:00
renovate[bot]
ee9e91a77c
chore(deps): update dawidd6/action-download-artifact action to v10 2025-05-31 18:30:55 +00:00
renovate[bot]
7f5d1fd5b6
chore(deps): update rust crate clap_complete to v4.5.52 2025-05-30 18:33:26 +00:00