110 Commits
Author SHA1 Message Date
mmc 12fec6b796 rename: drop a test the unix failure test already covers
The ungated test ran the same argv as
unix::test_every_failing_operand_is_reported_once_and_in_order and
asserted a subset of what it does. It was kept for the Windows leg, but
the one thing it added there, that an operand after a failure is still
renamed, is already pinned on every platform by the tally table: its
`s9 s1` row can only exit 2 if the rename after the failure happened.
2026-10-05 22:23:23 +02:00
mmc d9b0157a37 rename: drop the POSIXLY_CORRECT argv rewrite
No other utility in the tree adjusts argv before clap parses it, and
keeping rename on clap's behavior like the rest is worth more than
matching getopt in this one corner.

Without POSIXLY_CORRECT the rewrite handed argv back untouched, so only
runs with the variable set change. There, an argument after the first
operand that begins with `-` is now read as an option, as it already is
without the variable, where C util-linux reads it as a filename or as
the replacement. `--` still ends the options in both.
2026-10-05 22:23:23 +02:00
mmc 409cf147f2 rename: add integration tests
Sixty-four tests: the exit-status tally, the three substitution modes,
the path-scope rule, both overwrite guards, symlink mode, byte-oriented
names, and the test_invalid_arg smoke test every other util carries.

They defend the decisions a refactor would plausibly undo rather than
restating what clap already guarantees. The two overwrite predicates and
their opposite treatment of a dangling destination, the short circuit
that runs before any syscall, and the order of stripping against the
existence check each have a test whose only job is to fail if someone
tidies them away.

Diagnostics are asserted only as far as we write them. The errno text
after our half belongs to libc, so the suite does not pin strerror
strings on platforms it cannot run.

The substitution engine keeps its unit tests beside it in subst.rs.
`cargo test` from the workspace root does not run them, because the root
package is the only default member; `cargo test -p uu_rename` does.
2026-10-05 22:23:23 +02:00
Sichen d5845d687d setpgid: accept a command and arguments that are not valid UTF-8
Read the command and its arguments as OsString so they reach execvp()
unchanged, as they do with util-linux setpgid.
2026-10-05 22:21:38 +02:00
mmcandmmc 51d527f974 chcpu: report each error only once (#617)
* chcpu: report each error only once

Every failure was printed twice: `CpuList::run` reported it itself with a raw
`eprintln!`, then also returned it, so `uucore` printed it again with the
`chcpu: ` prefix. The unprefixed copy came first, which is the one users saw.

Reporting each per-CPU failure with `uucore::show!` keeps the diagnostic for
every element of a CPU list, gives all of them the program-name prefix that
was previously only on the duplicate, and sets the exit code rather than
returning an error - the pattern uucore documents for non-fatal errors when
applying an operation to many items. Exit codes are untouched: 1 when nothing
succeeded, 64 for partial success.

Adds the first tests for this utility, covering the error paths. They need no
privileges and change no CPU state: an absent CPU index is rejected before
anything is written, and enabling an already-enabled CPU only prints.

* chcpu: cover argument parsing in tests

These reach only clap, never sysfs, so they also guard the option surface on
the platforms where the utility itself is unimplemented.

---------

Co-authored-by: mmc <codeberg.wilder850@simplelogin.com>
2026-08-13 08:57:42 +02:00
Malhar Vora f96693e3fd Add --task argument with tests (#609)
Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>
2026-08-13 08:57:03 +02:00
Malhar Vora 4bd24d4a72 Add --type option (#607)
Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>
2026-07-22 19:30:13 +02:00
Malhar Vora 9cedc7ce91 Implement --persistent for lsns (#585)
* Add persistent flag

Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>

* Some refactoring

Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>

* Add a test

Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>

---------

Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>
2026-07-20 13:41:33 +02:00
Malhar Vora 6fd1e08033 Implement --noheadings for lsns (#569) 2026-07-01 19:08:06 +02:00
Malhar Vora 34e2b369b3 Implement basic lsns utility (#554)
---------

Signed-off-by: Malhar Vora <mlvora.2010@gmail.com>
2026-06-09 09:39:55 +02:00
Sylvestre Ledru c2e9b33d9c Merge pull request #529 from jmr/test-tempdir
tests: lsmem: Use tempfile::TempDir for test sysroot
2026-05-13 15:58:38 +02:00
Daniel Hofstetter c719fc590c tests.rs: adapt to change in ctor 2026-05-07 10:56:27 +02:00
Jesse Rosenstock 317e38f6d2 tests: lsmem: Use tempfile::TempDir for test sysroot
Refactor `TestSysMemory` in `test_lsmem.rs` to use the `tempfile` crate
for managing the temporary sysroot directory.
2026-04-19 10:17:36 +02:00
Daniel Hofstetter 5dabe2d37c clippy: fix warnings from useless_vec lint 2025-10-31 09:20:43 +01:00
Tuomas Tynkkynen 5283e85556 hexdump: Add tool
This supports the same functionality as util-linux hexdump except for
--format and --color options. Output should be bit-exact, except as
added bonus this supports the `-s` option on pipes and other non-seekable
files.
2025-10-21 18:17:21 +03:00
Tuomas Tynkkynen f9340c3bdc cal: Add tool
This supports most of the important flags and gives bit-exact output
except for spacing in the header line.
2025-09-25 00:03:45 +03:00
Tuomas Tynkkynen 38bdf37fcd setpgid: Add tool 2025-09-20 20:03:51 +03:00
Daniel Hofstetter b3d4549108 tests: remove unused imports 2025-09-17 09:09:44 +02:00
Tuomas Tynkkynen fd69cc2230 nologin: Add tool 2025-09-14 18:58:46 +03:00
Daniel Hofstetter 3f22a93244 uuidgen: adapt tests to uutests 2025-08-08 10:53:37 +02:00
Sylvestre Ledru fa608413b2 Move to use uutests 2025-08-08 10:53:37 +02:00
Sebastian Bentmar Holgersson b5d6d188bf feat(last): add --since and --until (#342)
* feat(last): add --since and --until

* clean up clap slightly

* fix clippy

* test(last): add tests for --since and --until

* refactor(last): resolve review comments

* test(last): set cfg for since and until to unix

* remove unnecessary comment

* move parse_time_value below uumain

* minor cleanup

* fix ci issues
2025-08-01 16:12:39 +02:00
Daniel Hofstetter 12b1e3d6e9 clippy: fix warnings from uninlined_format_args 2025-06-27 11:51:13 +02:00
Lionel Mendes 55c8ee013b last: fix some hostnames are not shown properly with --hostname option issue 212 (#246)
* last: fix not all hostnames are shown in the last column with --hostlast option

* last: fix not all hostnames are shown in the last column with --hostlast option

* Added test case related to the hostlast option in last command.

* Change binary input fixture name for last command and Fix format source code.

* feat: add macOS platform & update tests for compatibility

* fix: correct formatting in platform and test files for macOS compatibility

* fix: format

* fix: correct variable name and improve test output handling
2025-05-08 17:32:25 +02:00
Reagan Bohan 1dcb5524e2 Implement uuidgen
Implement uuidgen as a wrapper over the `uuid` crate.
2025-05-02 11:53:04 +00:00