Commit Graph
11559 Commits
Author SHA1 Message Date
hlsxx 2092e814db expr(fix): capacity overflow 2026-09-19 00:13:15 +02:00
Sylvestre Ledru 563e5c3d3f cp: clear setuid/setgid on directories created by cp -r 2026-09-19 00:08:54 +02:00
nagendramohan 5e9ccecf7e cp: apply the umask to directories created by cp -r
Without a preserve flag, cp -r gave every directory it created the
source's mode unmasked, so a 777 source directory became 777 regardless
of the umask, while regular files in the same copy were masked correctly.

The final permission pass defaulted a freshly-created directory to
preserving the source mode. Apply the umask in that defaulted case, as
GNU does, while a real preserve (-p/-a) and --no-preserve=mode are
unchanged.

Fixes #14549

Signed-off-by: nagendramohan <nagendramohan1990@gmail.com>
2026-09-19 00:08:54 +02:00
Sylvestre Ledru 58490b33e6 od: add benchmarks
Cover the default octal output, single byte hex output and the named
character output, which escapes control characters.
2026-09-18 22:14:35 +02:00
Piotr Kubaj 087286ecd1 stty: print the speed on big-endian PowerPC BSDs
The baud rate is printed by one of three cfg-gated branches. The first
one is for "BSDs and Linux (not ppc/big-endian ppc64)", but its PowerPC
exclusion was a second #[cfg] stacked on top of
any(target_os = "linux", bsd), so it applied to the BSDs as well. The
second branch is Linux-only and the third covers everything that is
neither Linux nor a BSD. On FreeBSD/powerpc64 (big-endian) and
FreeBSD/powerpc none of the three was compiled in, and stty silently
left "speed N baud;" out of its output.

The PowerPC special case is only needed on Linux, where those targets
get a BaudRate enum instead of a number. On the BSDs the baud rate is a
plain u32 on every architecture, which string_to_baud() already relies
on with a bare #[cfg(bsd)]. Restrict the architecture exclusion to
Linux so that the BSDs always take the u32 path.

Fixes test_stty::test_basic and test_stty::test_stty_uses_stdin on
FreeBSD/powerpc64.
2026-09-18 21:07:18 +02:00
Haydon Ryanandanastygnome 661d8dbe73 uucore: use sort_unstable_by_key in Range::merge
Co-authored-by: anastygnome <15268361+anastygnome@users.noreply.github.com>
2026-09-18 20:38:02 +02:00
Haydon Ryan 2a60e3068f uucore: make Range::merge linear instead of quadratic 2026-09-18 20:38:02 +02:00
Darshil Patel 58bc4faac9 date: echo invalid input verbatim instead of as a Fluent number
translate! hands Fluent a number whenever the argument parses as one,
so the error for -d 1e9 showed '1000000000', -d -0 showed '0', and
-d 9. showed '9'. Use translate_text! for the invalid-date and
missing-plus messages, which echo what the user typed.

Fixes #14669. Fixes #14670.
2026-09-18 19:53:49 +02:00
Daniel Hofstetter 39c5c96f29 date: remove "set_to" property from Settings 2026-09-18 19:52:18 +02:00
xtqqczze 06eb914d66 chore: move spell-checker header 2026-09-18 17:07:39 +02:00
xtqqczze 81a5ea6b63 chore: add missing newlines around spell-checker header 2026-09-18 17:07:39 +02:00
Daniel Hofstetter c7d7c0bde9 chore: remove empty comment lines from header 2026-09-18 10:32:33 +02:00
Daniel Hofstetter ddb03ce968 chore: add missing newlines to source header 2026-09-18 10:32:33 +02:00
wtcpython 4cba2db76f dd: replace gcd dependency with num-integer 2026-09-18 10:29:08 +02:00
weili 851b88530e tail: normalise a zero count in the obsolete operand parser
`from_obsolete_args` built `Signum::Positive(args.num)` unconditionally, while
`parse_num` — behind `-n +N` / `-c +N` — maps zero to `PlusZero`. So `+0`,
`+00`, `+0c` and `+0l` produced `Positive(0)`, which misses `unbounded_tail`'s
`PlusZero | Positive(1)` arms and underflows at `*count - 1`. Release wrapped
to `u64::MAX` and printed nothing, exiting 0 where GNU prints the whole input;
overflow-checks aborted. `bounded_tail` guards with `count > &1`, so only stdin
or a file at or below the block size is affected.

Obsolete `-0`/`-0c` now give `MinusZero` like `-n 0`, taking the existing
`-[nc]0` early exit: `tail -0 <missing>` exits 0 silently instead of 1,
matching GNU.

Fixes #14660
2026-09-18 10:16:21 +02:00
Sylvestre Ledru 6c5d0eaeb5 prepare 0.13.0 2026-09-18 09:57:10 +02:00
xtqqczze e25efcb0a2 uucore: disable fsxattr on unsupported platforms
The `xattr` crate enables a default feature for unsupported Unix platforms. That is, it builds on all Unix platforms but always fails at runtime on unsupported Unix platforms.

Disable the default features so `xattr` does not build on unsupported platforms.
2026-09-18 07:57:43 +02:00
xtqqczze 371e08c07e mv: avoid fsxattr for unsupported platforms 2026-09-18 07:57:43 +02:00
xtqqczze 37da56835d cp: avoid fsxattr for unsupported platforms 2026-09-18 07:57:43 +02:00
xtqqczze f22219b548 ls: avoid fsxattr for unsupported platforms 2026-09-18 07:57:43 +02:00
Alessio Attilio b2480b2f0a env: remove the --file extension 2026-09-17 14:58:27 +02:00
pepsi zandChad Brewbaker 22d61c385e sort: write empty file when input is empty (#11958)
* adds implementations for this behavior in both threaded and wasi

* adds test for this behavior

Co-authored-by: Chad Brewbaker <crb002@gmail.com>
2026-09-17 08:58:53 +02:00
Sylvestre Ledru dc1efd8994 install: create the fd-based destination exclusively and at 0600 (#14625)
install -D copies through DirFd::open_file_at(), which passed
O_CREAT|O_WRONLY|O_TRUNC with mode 0o666, while the path-based
copy_file() it is documented to mirror uses create_new(true).mode(0o600).
2026-09-17 00:12:14 +02:00
Sylvestre Ledru f27705c513 sort: keep the output-file copy private too (#14624)
#10647 made sort's spill directory 0700 and its chunks 0600, but
replace_output_file_in_input_files() still used fs::copy() for the case
where the output file is also one of the inputs. fs::copy() applies the
source's permission bits to the destination, so that copy -- a full
copy of the output -- was put back to the source's mode (0644 in the
common case) right after next_file() had created it 0600.

Write through the descriptor next_file() already returned instead. That
also drops the pointless second open of a file we just created.

Also fix uucore's safe-copy feature, which did not enable rustix/fs and
so failed to build when selected on its own.

Taken from #14536.
2026-09-17 00:11:55 +02:00
Sylvestre Ledru 4bf2727b49 generalize some mv code for ln, cp (#14623)
* generalize the mv code for ln, cp
replace links atomically instead of unlinking first

Forced replacement was unlink(dst) then create. The gap lets another user
claim dst in a directory they can write to -- including a name the sticky
bit forbids them to remove -- so a privileged ln hands them a trusted name.

* ln: don't leave the temp behind when the rename is a no-op

Renaming the temp onto a destination that is already a link to the same
inode does nothing and returns success, so the temp name survived:
`ln -f a b` with b already hard-linked to a left a stray Cu* file.

Unlink the temp after the rename either way; on the normal path it is
already gone.
2026-09-17 00:11:18 +02:00