Commit Graph
11559 Commits
Author SHA1 Message Date
Sylvestre Ledru 8963ce996e pinky: cover the idle and real-name formatters with unit tests
Both are pure string functions now, but nothing exercised them below the
integration tests, which only drive the binary. real_name took a whole Passwd
to read two of its fields, and Passwd has no Default and platform-dependent
members, so hand it the login and the comment field instead; that also drops a
clone. The cases worth pinning are the boundaries: blanks under a minute,
hours past it, days past a day, the comma that ends the real name, and & in
the comment field standing in for the login.
2026-09-09 22:39:18 +02:00
Sylvestre Ledru 89928b6a07 pinky: name the column writes and drop the Capitalize trait
The row builders format into a String, which cannot fail, so every write ended
in a discarded Result. Put that behind a column! helper that says so once and
names what the line is doing. Capitalize was a public trait on str with a
single caller inside the crate; a plain function does the same in four lines.
Note while passing that -s is parsed only to be ignored.
2026-09-09 22:39:18 +02:00
Sylvestre Ledru 9146c81072 pinky: parse the time format once per run
format_timestamp read the locale out of the environment and parsed a format
description on every line it rendered, though neither can change while the
listing is being printed. Keep the chosen description in a thread local beside
NOW, which already caches the clock for the same reason.
2026-09-09 22:39:18 +02:00
Sylvestre Ledru 1dfabb64ec pinky: build each output line before writing it
The row and header printers walked the columns writing straight to stdout.
Have them return the finished line instead, so the listing does the writing
and the padding rules for a row live in one place. The long report gets the
same treatment: an early continue for an account with no password entry,
and the home directory read once. Rename the helpers that are left along
the way -- idle_string, time_string and gecos_to_fullname become
format_idle, format_timestamp and real_name -- and drop the stale
spell-checker list, whose words no longer appear.
2026-09-09 22:39:18 +02:00
Sylvestre Ledru 979c0046f2 pinky: fold the terminal stat into a single query
Whether a session's terminal takes messages and when it was last read from
both come out of one stat, so let a Terminal value carry the pair and keep
the "unknown" case in one place: an unreadable device and a zero atime are
the same thing to the caller, which is what Option says. This drops the
deferred-assignment dance in the row builder.
2026-09-09 22:39:18 +02:00
Sylvestre Ledru eda78e90a5 pinky: group the option flags into two structs
Sort the eight loose booleans by what they actually decide: Layout holds
the columns of the short listing, Details holds how much of an account the
long report spells out, and the host lookup stays on Pinky itself. The
three narrowing flags now read as one stacked expression instead of a
chain of assignments.
2026-09-09 22:39:18 +02:00
Leonard Hecker 41044743cd Use forward slashes for checksum path on Windows (#14469) 2026-09-09 22:37:02 +02:00
oech3 b0a6165294 nohup: simplify by .into() (#14476) 2026-09-09 22:36:18 +02:00
Leonard Hecker 855e80a58f uucore: Implement user locale detection for Windows (#14477)
* uucore: Implement user locale detection for Windows

* Address feedback
2026-09-09 22:35:50 +02:00
xtqqczze 33d5c9cf3e uucore: use libc implementations of major, minor, and makedev (#14471)
Use the implementations provided for Redox by `libc` 0.2.181.

The `fs` feature now builds successfully with Clippy:

```console
$ RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std -p uucore --features fs --all-targets --target x86_64-unknown-redox >/dev/null 2>&1; echo $?
0
```
2026-09-09 17:07:30 +02:00
Tom D. bebeb9b4dc tsort: handle invalid utf8 in input (#14464)
Use byte-based token parsing and interning so tsort accepts invalid UTF-8.
2026-09-09 11:56:47 +02:00
Leonard HeckerandAlvaro Figueroa e465da87fc uucore: Avoid panic on invalid input lines (#14470)
Co-authored-by: Alvaro Figueroa <alvaro.figueroa@microsoft.com>
2026-09-09 09:40:11 +02:00
Zhiwei Liang 7678ba3541 realpath: fix exit status in quiet mode
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
2026-09-08 15:18:51 +02:00
oech3 9cc5daeca9 hostid: build for Windows & remove unsafe (#14427) 2026-09-08 14:05:29 +02:00
wtc e7720e3310 mv: replace fs_extra with std directory sizing (#14432)
Only estimate directory size when the progress bar is enabled.
2026-09-08 14:04:11 +02:00
Tom D.andAuthor: xtqqczze 6e1bdf72aa tsort: fix output for write errors on output buffer flush and enhance error handling (#14384)
Co-authored-by: Author: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
2026-09-08 13:45:06 +02:00
Eduardo Rodrigues 1d08c590d0 fix(mktemp): add wasi platform support for temporary directory handling
- Add conditional compilation for WASI target to avoid panics from `std::env::temp_dir()`
- Implement fallback logic in `Options` to read TMPDIR environment variable directly on WASI
- Update `get_tmpdir_env_or_default()` with WASI-specific handling for temp directory resolution
- Add `#[cfg_attr]` annotations to skip host path-dependent tests on WASI sandbox environment
- Ignore 14 tests that require host filesystem access when running under wasi_runner
- Ignore directory permission test on WASI due to lack of `chmod` support and mode parameter limitations
2026-09-08 13:42:43 +02:00
oech3 7062414721 nice: prepare supporting Windows 2026-09-08 13:31:23 +02:00
Devel affd5a0fb2 date: exit with 1 for expected file, got directory 2026-09-08 10:41:44 +02:00
Zhiwei Liang 7243b7c23f ls: apply dir and vdir format defaults in Config::from
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
2026-09-08 10:36:12 +02:00
wtcpython fc16cdcbe9 mv, sync, hostname, touch, rm: use safe std APIs on Windows
Replace unsafe Win32 calls and raw bitmasks with safe Rust standard library
APIs across Windows implementations:
- mv: use OpenOptionsExt access_mode for delete check
- sync: use File::sync_all instead of FlushFileBuffers
- hostname: remove redundant manual Winsock initialization
- touch: use io::Error::last_os_error instead of GetLastError
- rm: use Metadata::permissions().readonly() and FileTypeExt::is_symlink_dir()
2026-09-08 10:11:29 +02:00
xtqqczze c29429c13b fix: unused_dependencies cargo lint 2026-09-08 07:52:35 +02:00
xtqqczze c86104d931 fix: needless_range_loop clippy lint
https://rust-lang.github.io/rust-clippy/main/index.html#needless_range_loop
2026-09-08 07:45:33 +02:00
xtqqczze ddbe393c31 uucore: fix a fsext test
Follow-up to https://github.com/uutils/coreutils/pull/14430.

Fix an unresolved import error.

```sh
cargo +nightly check -q -Zbuild-std -p uucore --all-targets --features fsext --target powerpc64-ibm-aix
```
2026-09-08 07:35:57 +02:00
xtqqczze 0b0e34e983 chmod: fix clippy lints 2026-09-08 07:35:05 +02:00