19448 Commits

Author SHA1 Message Date
oech3
55549fa87e wc: remove a nest by loop{} 2026-05-28 14:25:34 +02:00
joknarf
b22013ab79 ls: ls -lF symlink target indicators (#11554)
---------

Co-authored-by: Guillem L. Jara <4lon3ly0@tutanota.com>
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-05-28 13:08:08 +02:00
Anthony
179b977b93 ln: add WASI support via symlink_path (#11713) 2026-05-28 12:53:59 +02:00
Sylvestre Ledru
5e65ceb4a7 docs: add fuzz pointer, AI policy, playground link, and Ubuntu note 2026-05-28 10:55:14 +02:00
Dima Gerasimov
be8018656e sort: fix incorrect sort ordering with long line inputs
The issue is that in `chunks.rs`, `sep_iter` is relative to `search_start`.
But the returned value needs to be absolute position relative to the `buffer`.
2026-05-28 10:38:12 +02:00
Dima Gerasimov
565f118f8c sort: add a test reproducing failure during sort --merge
sort -m takes: 3 lines, 96003 bytes

and emits: 4 lines, 96004 bytes

The output line lengths before the fix are:

```
a x 32000
b x 23809
b x 8191
c x 32000
```

So it splits one of the lines into two (23809 + 8191 = 32000).

In addition, the output becomes unsorted because the shorter 'b' fragment sorts before the longer 'b' fragment.

The issue is that in `chunks.rs`, `sep_iter` is relatve to `search_start`. But the returned value needs to be absolute position relative to the `buffer`.

We end up with these particular numbers because
- in merge.rs, initial chunk is created as `RecycledChunk::new(8 * 1024)` (8192 bytes)
- `search_start = 8192`; newline is at absolute buffer index `32000`
- `memchr_iter` returns `32000 - 8192 = 23808`, and newline adds + 1 byte
2026-05-28 10:38:12 +02:00
Sylvestre Ledru
77bb522c0c prepare release 0.9.0 2026-05-28 10:31:37 +02:00
oech3
c7cf6fd825 make.yml: try to fix Cygwin CI 2026-05-28 07:55:03 +02:00
oech3
aaf4a353c3 tee: simplify code 2026-05-27 22:27:23 +02:00
Daniel Hofstetter
2c37153c7e mktemp: ensure that "-q XX" shows error msg 2026-05-27 20:39:52 +02:00
oech3
e451ddf733 simplify uucore::pipes::send_n_bytes 2026-05-27 18:09:03 +02:00
oech3
a17c0be2ce pipes.rs: alias std::io::Result<Result<(), ()>> 2026-05-27 15:37:30 +02:00
oech3
8de3238dca buf_copy: remove thin wrapper & useless conversion 2026-05-27 10:07:44 +02:00
hlsxx
fa6d68d6c2 refactor(sync): remove unnecessary files move 2026-05-27 09:31:28 +02:00
renovate[bot]
712a31f434 chore(deps): update rust crate memchr to v2.8.1 2026-05-27 09:04:22 +02:00
oech3
af0c5857d4 wc: reduce lines of code 2026-05-26 19:00:53 +02:00
renovate[bot]
65103b2b71 chore(deps): update rust crate jiff to v0.2.27 2026-05-26 17:56:58 +02:00
oech3
5dd9f377db pipes.rs: replace bool by Result<(),()> 2026-05-26 17:17:27 +02:00
yor1xd
9d3bafc23e mktemp: fix hidden file creation with dot prefix 2026-05-26 15:52:32 +02:00
dragutreis
83a5cd9522 tail: avoid unnecessary pipe2 syscall when stdout is already a pipe
Use splice_unbounded_auto instead of splice_unbounded_broker to avoid
creating a broker pipe when stdout is already a pipe (e.g., when piping
to another command with |).
2026-05-26 14:00:10 +02:00
oech3
259813f9e9 Improve documents for splice modules 2026-05-26 13:56:36 +02:00
oech3
7d29aeab05 pipes.rs: dedup code by including fallback to splice_exact 2026-05-26 13:31:47 +02:00
oech3
c1a3f6f3a3 nproc: Reject quota with some schedulers 2026-05-26 13:23:31 +02:00
Etienne Cordonnier
76c63ee6fd install: update comments and tests
Fix doc comments in safe_traversal that still described the old behavior
of replacing symlinks with real directories. Rename and deduplicate tests
that were originally written as race-condition regression tests but now
just verify symlink-following behavior.

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
2026-05-26 10:14:21 +02:00
Matt Van Horn
f13b92e699 chore: remove duplicate words in six comments
All comment / doc-comment changes.

- src/uucore/src/lib/features/checksum/validate.rs L471: "must set it the the detected" -> "must set it to the detected" (also adds the missing "to")
- src/uucore/src/lib/features/uptime.rs L416: "logged in in a human-readable format" -> "logged in, in a human-readable format"
- src/uu/od/src/output_info.rs L115: "the width is width of the the type" -> "the width is the width of the type"
- src/uu/split/src/filenames.rs L113: "Determine if the the output file names" -> "Determine if the output file names"
- src/uu/tail/src/paths.rs L228: "if `path` is is a file type" -> "if `path` is a file type"
- src/uu/chcon/src/chcon.rs L527: "then is is assumed to be valid" -> "then it is assumed to be valid"
2026-05-26 10:04:19 +02:00
renovate[bot]
4254d7afd2 chore(deps): update rust crate jiff to v0.2.26 2026-05-26 08:18:04 +02:00
Jake Abendroth
21fda8cd9f fix(install): follow symlink components in destination path with -D
## Summary

Fixes #11469

`install -D` was replacing pre-existing symlinks in the destination path with real directories instead of following them. This broke any workflow where part of the install prefix is a symlink; including BOSH deployments, Homebrew, Nix, stow, and any `make install` targeting a symlinked prefix.

**Reproduction (from the issue):**
```sh
mkdir -p /tmp/target
ln -s /tmp/target /tmp/link
echo hello > /tmp/file.txt
install -D -m 644 /tmp/file.txt /tmp/link/subdir/file.txt
# GNU coreutils 8.32: /tmp/link stays a symlink, file lands in /tmp/target/subdir/file.txt
# uutils 0.7.0:       /tmp/link is replaced with a real directory — wrong
```

## Root cause

PR #10140 introduced `create_dir_all_safe()` in `safe_traversal.rs` to prevent TOCTOU symlink race conditions. The fix was correct in intent but too aggressive: `open_or_create_subdir()` unconditionally unlinked and recreated any symlink it encountered, including pre-existing legitimate ones.

## Changes

**`src/uucore/src/lib/features/safe_traversal.rs`**
- `open_or_create_subdir`: when `stat_at` returns `S_IFLNK`, call `open_subdir(Follow)` instead of `unlink_at + mkdir_at`. The `O_DIRECTORY` flag already in `open_subdir` means dangling or non-directory symlinks still return an error cleanly.
- `find_existing_ancestor`: switch from `fs::symlink_metadata` to `fs::metadata` so that a symlink-to-directory is recognised as an existing ancestor rather than a component to recreate (this was already the stated intent in the function's doc comment).

**`src/uu/install/src/install.rs`**
- Align the `dir_exists` check and the `DirFd::open` call to also follow symlinks, consistent with the above.

**`tests/by-util/test_install.rs`**
- Update the two tests added by #10140 — they were asserting the buggy behavior (symlink replaced). Flip the assertions to document the correct GNU behavior.
- Add `test_install_d_follows_symlink_prefix` as a direct regression test for the issue's reproduction case.

## TOCTOU / security note

The true TOCTOU race (a symlink *injected during the operation* into a not-yet-existing path component) is still blocked: `mkdirat` fails with `EEXIST` if an attacker creates a symlink between `stat_at` returning `ENOENT` and our `mkdir_at`. Newly-created directories are still opened with `O_NOFOLLOW`.

What changes is that *pre-existing* symlinks are now followed — which is exactly what GNU coreutils 8.32 does. The previous behavior was stricter than GNU in this regard.
2026-05-25 22:11:50 +02:00
oech3
29fdaa6a37 pipes.rs: deduplicate many cfg's 2026-05-25 16:07:33 +02:00
oech3
bdd71ece56 pipes.rs: add missing count on fallback 2026-05-25 16:02:04 +02:00
oech3
db7b8a6e58 stdbuf: build on Windows (depending on cygwin dll) 2026-05-25 12:23:51 +02:00
Sylvestre Ledru
a8d51a2cfd mkdir: simplify umask shaping and add regression tests 2026-05-25 11:11:48 +02:00
renovate[bot]
f8bad1fde5 chore(deps): update rust crate jiff to v0.2.25 2026-05-25 09:11:31 +02:00
John Chittum
19c7f646d9 mkdir: cast mode bits to rustix::fs::RawMode
rustix::fs::Mode::from_bits_truncated accepts u32 on Linux and u16 on
MacOS. Casting to rustix::fs::RawMode makes the value compatible on
either platform.
2026-05-24 18:36:28 +02:00
John Chittum
8296884cf5 mkdir: acl and permission inheritance with -p
Workflow for permission setting and ACLs failed in several scenarios,
most notable when passing -p. Parent directories in the mkdir call would
not appropriately set ACLs and could end up with more open permissions.
Generally, there was a misunderstanding that GNU coreutils was setting
umask (0) and that was the default -- the real flow was using a shaped
umask that takes current umask and ensures that the user has the ability
to execute mkdir commands through the tree. The umask (0) call was part
of a read setup for the equivalent of our UmaskGuard. New workflow
focuses on safe defaults, shaped umask, and allowing the Kernel to do
to apply ACLs. Adds a test specifically to guard against regression,
ensuring a more restrictive ACL is respected with mkdir -p
2026-05-24 18:36:28 +02:00
gabrielhnf
563fe4df74 timeout: replace nix with rustix 2026-05-24 18:12:54 +02:00
oech3
913c6c2eac tee: don't print EINTR 2026-05-24 16:30:07 +02:00
Sylvestre Ledru
c8af53a77f ls: track permissions column width independently
Replace the `has_alt_access` boolean (which widened the link-count column
to reserve space for the ACL/context indicator) with a `permissions`
field on `PaddingCollection`, so each column owns its own width.

Also make ACL detection in the padding-calculation pass use `item.path()`
to match the render path (previously used `item.display_name()`).

Refs #11790
2026-05-24 16:21:20 +02:00
oech3
223fcaef79 yes: dedup tee() 2026-05-24 13:38:07 +02:00
renovate[bot]
2ce00f93bb chore(deps): update rust crate similar to v3.1.1 2026-05-24 13:03:28 +02:00
xtqqczze
d41c56bd6b docs: update tools in DEVELOPMENT.md
- remove note about pre-commit hook being broken on macOS
- update clippy command to include `--workspace`, matching `pre-commit`
- remove outdated paragraph about `msrv` in `clippy.toml`
2026-05-23 16:47:57 +02:00
xtqqczze
b0bb693fc2 docs: update clippy section in DEVELOPMENT.md
- update command to include `--workspace`, matching `pre-commit`
- remove outdated paragraph about `msrv`
2026-05-23 16:47:57 +02:00
oech3
3af25aecf4 yes: fix confusing 1.. and comment 2026-05-23 16:37:17 +02:00
oech3
dddf0a349e pipes.rs: avoid usage of bool 2026-05-23 15:31:24 +02:00
oech3
4f9a39b355 pipes.rs: remove fcntl overhead from splice_unbounded (#12422) 2026-05-23 10:13:43 +02:00
renovate[bot]
8e4c21be01 chore(deps): update rust crate divan to v4.7.0 2026-05-23 07:08:37 +02:00
oech3
02768bceb5 pipes.rs: simplify by io::copy & doc the case it cannot be used 2026-05-22 19:07:51 +02:00
oech3
58dae46ab8 uucore::pipes::splice_exact: improve document 2026-05-22 19:07:28 +02:00
Daniel Hofstetter
bd908f012e deny.toml: remove two crates from skip list
cpufeatures and block-buffer

Co-authored-by: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
2026-05-21 10:06:57 +02:00
oech3
3a4c2f692d cat: remove splice.rs 2026-05-21 09:46:54 +02:00
xtqqczze
24e3d0d39e fix(selinux): add missing os checks 2026-05-21 09:13:41 +02:00