1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-03 06:27:45 +00:00
Commit graph

15884 commits

Author SHA1 Message Date
renovate[bot]
491e5c53ae
chore(deps): update rust crate clap to v4.5.36 2025-04-11 23:26:06 +00:00
Yuri Astrakhan
3b2d3716df chore: fix clippy::unnested_or_patterns
Used this command:

```shell
cargo clippy --fix --workspace --all-targets -- -A clippy::all -W clippy::unnested_or_patterns
cargo fmt --all
```
2025-04-11 18:00:07 -04:00
Daniel Hofstetter
b10aa47e38
Merge pull request #7727 from uutils/renovate/self_cell-1.x-lockfile
chore(deps): update rust crate self_cell to v1.2.0
2025-04-11 19:26:44 +02:00
Yuri Astrakhan
ac5a913996 chore: fix ref_option lint
Resolve [ref_option](https://rust-lang.github.io/rust-clippy/master/index.html#ref_option) lint.  Also, I optimized `is_first_filename_timestamp` a bit to make it faster and more streamlined.

p.s. disclaimer: I'm the author of that lint
2025-04-11 12:12:54 -04:00
renovate[bot]
22c00b9241
chore(deps): update rust crate self_cell to v1.2.0 2025-04-11 16:10:51 +00:00
Daniel Hofstetter
da61ebf1f6
Merge pull request #7722 from nyurik/fmt-fix
chore: minor fmt match cleanup
2025-04-11 10:20:30 +02:00
Sylvestre Ledru
7e3b8f14d2
Merge pull request #7723 from cakebaker/cargo_toml_use_authors_workspace
Cargo.toml: use `authors.workspace = true`
2025-04-11 03:55:52 -04:00
Sylvestre Ledru
b13ce98484
Merge pull request #7699 from nyurik/returns
chore: simplify `return` in multi-branch
2025-04-11 03:53:10 -04:00
Daniel Hofstetter
4bc518519f
Merge pull request #7725 from nyurik/code-opt
chore: clean up a few code paths
2025-04-11 09:47:19 +02:00
Yuri Astrakhan
b09cd32534 chore: clean up a few code paths
* `cp`: in `copy_dir.rs`, remove duplicate copy_file() calls and streamline error handling
* `install`: simplify `preserve_timestamp`
* `tee` - simplify error handling
2025-04-11 02:02:32 -04:00
Daniel Hofstetter
b366b68505 libstdbuf/Cargo.toml: move package entries 2025-04-11 07:15:55 +02:00
Daniel Hofstetter
83221201cc Cargo.toml: use "authors.workspace = true" 2025-04-11 06:59:11 +02:00
Yuri Astrakhan
74d79589f4 chore: minor fmt match cleanup
Fix an overly complex case when w is 0. Note that this might have been an error - I kept the logic, but the initial implementation might have been incorrect.
2025-04-11 00:44:51 -04:00
Yuri Astrakhan
b5ed4a4acf chore: simplify return in multi-branch
It is usually easier to reason about the code if the return is used in one place rather than in every branch of the match or if statements.
2025-04-11 00:24:45 -04:00
Sylvestre Ledru
81c02b7408 mkdir: add support of -Z
Should fix: gnu/tests/mkdir/selinux.sh
tests/mkdir/restorecon.sh
2025-04-10 18:26:41 -04:00
Sylvestre Ledru
5bfbc30fba
Merge pull request #7715 from nyurik/unused_qualifications
Enable and fix `unused_qualifications` lint
2025-04-10 18:11:08 -04:00
Sylvestre Ledru
1bfe6563cd
Merge pull request #7710 from nyurik/workspaces
Consolidate crate config in workspace
2025-04-10 18:10:36 -04:00
Yuri Astrakhan
76b1b6835c rm ptr::NonNull 2025-04-10 17:13:18 -04:00
Yuri Astrakhan
9f56bf5f07 Enable and fix unused_qualifications lint
Improve code readability
2025-04-10 16:54:18 -04:00
Yuri Astrakhan
895b208391 Consolidate crate config in workspace
Make all common data like version, edition, license, ... be managed in one central workspace. This makes management much simpler
2025-04-10 16:52:01 -04:00
Daniel Hofstetter
4559e974ff
Merge pull request #7720 from uutils/renovate/uutils_term_grid-0.x
chore(deps): update rust crate uutils_term_grid to 0.7
2025-04-10 19:20:46 +02:00
hz2
cd2b56ea9c
cp: fix update prompting (#7668)
* added logic to check if we are updating the file and the destination is newer, to skip copying

* corrected logic to handle cp update

* - added test case that mocks the issue described in #7660
- adjusted conditions to satisfy clippy

* typo

* Update src/uu/cp/src/cp.rs

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

* Update tests/by-util/test_cp.rs

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

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-04-10 19:00:39 +02:00
renovate[bot]
9e98b79930
chore(deps): update rust crate uutils_term_grid to 0.7 2025-04-10 16:38:54 +00:00
Sylvestre Ledru
45c978fae6
Merge pull request #7686 from dan-hipschman/numfmt/add-zero-terminated-option
numfmt: add --zero-terminated option
2025-04-10 07:14:35 -04:00
Sylvestre Ledru
a89fc48388
Merge pull request #7656 from eduardorittner/main
printf: make negative values wrap around with unsigned/hex format
2025-04-10 06:48:50 -04:00
Sylvestre Ledru
eca400fcf3
Merge pull request #7689 from nyurik/inline2
chore: manual inline formatting
2025-04-10 06:42:01 -04:00
Sylvestre Ledru
593b141476
Merge pull request #7719 from cakebaker/uucore_fix_unresolved_import
uucore: add `chrono` to `uptime` feature
2025-04-10 06:07:02 -04:00
Daniel Hofstetter
b5df331170 uucore: add chrono to uptime feature 2025-04-10 10:59:27 +02:00
Sylvestre Ledru
64cf3f5dae
Merge pull request #7712 from drinkcat/parse_number_large_hex-fix
uucore: num_parser: Limit precision when computing 2**exp
2025-04-10 04:29:12 -04:00
Daniel Hofstetter
49e28e4d60
Merge pull request #7714 from uutils/renovate/linux-raw-sys-0.x-lockfile
chore(deps): update rust crate linux-raw-sys to v0.9.4
2025-04-10 07:17:26 +02:00
Sylvestre Ledru
efac771c83
Merge pull request #7713 from cakebaker/bump_hostname
Bump `hostname` & remove `windows-core` from skip list
2025-04-09 21:39:27 -04:00
Sylvestre Ledru
2103911d1a
Merge pull request #7717 from drinkcat/fuzz-minor-fixes
Fuzzing: minor fixes
2025-04-09 21:13:35 -04:00
Sylvestre Ledru
bf9a8b83f8
Merge pull request #7673 from lewisboon/df-thiserror
df: migrate OptionsError to thiserror
2025-04-09 21:11:49 -04:00
Lewis Boon
59d0e50397 df: migrate OptionsError to thiserror
Closes #7536
2025-04-09 22:32:45 +01:00
Yuri Astrakhan
2d95850700 chore: manual inline formatting
Minor manual cleanup - inlined many format args.  This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs.  Note that `&foo` in a `format!` parameter results in a 6% extra performance cost, and does not get inlined by the compiler (yet).
2025-04-09 15:33:46 -04:00
Nicolas Boichat
8f9bdf36fd workflows/fuzzing.yml: Add timeout equal to total run time
Just in case some of the values cause an infinite loop (or at
least take a _very_ long time, see #7708), timeout, with the same
duration as the maximum total fuzzing time.

That'll allow us to _see_ what input causes the infinite loop.
2025-04-09 21:04:43 +02:00
Nicolas Boichat
2caeaf511e fuzz: Run cargo clippy
Unfortunately, cargo clippy fails when testing fuzz_seq_parse_number:

```
error[E0603]: module `number` is private
  --> fuzz_targets/fuzz_seq_parse_number.rs:9:13
   |
9  | use uu_seq::number::PreciseNumber;
   |             ^^^^^^ private module
   |
note: the module `number` is defined here
  --> /home/drinkcat/dev/coreutils/coreutils/src/uu/seq/src/seq.rs:24:1
   |
24 | mod number;
   | ^^^^^^^^^^
```

But we can still fix the rest...
2025-04-09 20:58:30 +02:00
renovate[bot]
923d5aaa26
chore(deps): update rust crate linux-raw-sys to v0.9.4 2025-04-09 16:24:56 +00:00
Daniel Hofstetter
c8fc02a05d deny.toml: remove windows-core from skip list 2025-04-09 16:04:08 +02:00
Daniel Hofstetter
02ea63d2af Bump hostname from 0.4.0 to 0.4.1 2025-04-09 15:59:35 +02:00
Nicolas Boichat
4a13f4d14b uucore: num_parser: Limit precision when computing 2**exp
The number of digits would grow exponentially when large exponents
are passed, leading to conversion of numbers like 0x2p1000000 taking
forever to compute.

We use exponentiation by squaring to keep the precision within
reasonable bounds.

Fixes #7708.
2025-04-09 15:29:57 +02:00
Sylvestre Ledru
9cb4348a55
Merge pull request #7617 from MidnightRocket/mktemp/prevent-race-condition-tempdir-permissions
mktemp: Prevent race condition when setting permissions for tempdir
2025-04-09 07:04:33 -04:00
MidnightRocket
32fed17969
mktemp: Prevent race condition when setting permissions for tempdir
This prevents a race conditions vulnerability in the tempdir implementation, where an attacker
potentially could modify the created temporary directory, before the restrictive permissions are
set.

The race conditions occurs in the moment between the temporary directory is created, and the proper
permissions are set.

 # The fix

This patch changes the `make_temp_dir` to create the temporary directory with the proper
permissions creation time. Rather than first create, then set permissions.
This is done by giving the permissions to the builder.
See [tempfile doc](95540ed3fc/src/lib.rs (L449-L450)).

 # Severity Low

The attack is only possible if the umask is configured to allow writes by group or other for created
file/directories.

 # Related Resources

See: https://cwe.mitre.org/data/definitions/377.html
2025-04-09 11:18:09 +02:00
Daniel Hofstetter
ed8689eaa3
Merge pull request #7700 from nyurik/parens
chore: remove unneeded parens
2025-04-09 11:03:10 +02:00
Daniel Hofstetter
75a04c9cc0
Merge pull request #7709 from nyurik/workspace-clippy
Consolidate lint management with workspaces
2025-04-09 10:50:11 +02:00
Yuri Astrakhan
2413dc9168 Consolidate lint management with workspaces
At the moment, most crates rely on build scripts and other methods to keep lint-consistency. As of recent, Rust can use workspaces to globally set all the lint configurations.

This PR only adds lint configuration to each crate, but it does not introduce any changes to the code or lint configuration. In the subsequent PRs, I plan to gradually move lints from `uucore` to workspace, making all code consistent.

Note that `seq` relies on a custom lint config - which means its configuration may need to be managed by hand until Cargo introduces per-crate overrides.
2025-04-09 03:58:46 -04:00
Daniel Hofstetter
bb3b418052
Merge pull request #7707 from nyurik/clippy
Address new clippy lints
2025-04-09 09:40:52 +02:00
Nicolas Boichat
75072b5a98 fuzz: Run cargo fmt 2025-04-09 08:55:32 +02:00
Yuri Astrakhan
8b35439574 Address new clippy lints
Ran `cargo clippy --all-targets --workspace` and fixed a few minor issues
2025-04-09 01:10:01 -04:00
Daniel Hofstetter
04fe62bdd9
Merge pull request #7701 from uutils/renovate/bstr-1.x-lockfile
chore(deps): update rust crate bstr to v1.12.0
2025-04-09 07:07:32 +02:00