1106 Commits
Author SHA1 Message Date
renovate[bot] 09959d4305 chore(deps): update rust crate zip to v9.0.3 2026-10-14 07:15:52 +02:00
renovate[bot] 51b7876a28 chore(deps): update rust crate serde_json to v1.0.154 2026-10-12 07:13:53 +02:00
renovate[bot] e94716216a chore(deps): update rust crate zip to v9.0.2 2026-10-12 07:09:34 +02:00
renovate[bot] dfe010e453 chore(deps): update rust crate serde_json to v1.0.152 2026-10-11 10:38:53 +02:00
renovate[bot] eca36b061c chore(deps): update rust crate zip to v9.0.1 2026-10-10 12:56:26 +02:00
renovate[bot] 6c4d76d6ef chore(deps): update rust crate uuid to v1.28.0 2026-10-10 07:05:58 +02:00
renovate[bot] c41e7e5730 chore(deps): update rust crate zip to v9 2026-10-09 08:53:24 +02:00
mmc 5fe0580eb5 rename: always buffer stdout, flush per operand on a terminal
The report stream was a boxed writer so that it could be a BufWriter
off a terminal and the bare, line buffered stdout on one. A single
BufWriter does for both once the loop flushes it after each operand on
a terminal, which needs no trait object.

The flush is what keeps a terminal reading the way C util-linux's line
buffered stdout does, each -v line in order with the diagnostics around
it. Without it every diagnostic would print ahead of the lines that came
before it, and the report would only appear at exit.

Nothing in the test suite drives a terminal, so that order is not
pinned by a test. I compared it by hand under script(1) against
util-linux 2.42.2: a run mixing renames with failures, the -i prompt,
the -n -o skip report and -i at end of input are all identical.
Off a terminal nothing changes.
2026-10-05 22:23:23 +02:00
mmc 8991a4fa76 rename: trim the unit tests to what the integration tests cannot reach
Two remain, for inputs the integration suite cannot supply portably: an
empty name, which only a link with an empty target provides and only
macOS lets exist, and a name made only of separators, which means
pointing rename at `/`. The comment on the first said the CLI could not
reach it at all; it says when it can.
2026-10-05 22:23:23 +02:00
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
mmc 4bdbc1deec rename: implement the rename utility
rename replaces a substring in filenames. The option surface follows
rename(1): -v, -s, -n, -a, -l, -o and -i, with all three operands
required. Behavior throughout is what util-linux 2.42.2 and 2.40.4 were
both observed doing.

The parts a reader should not have to reverse engineer:

- The exit status is two counters rather than bit flags. 0 means
  something was renamed, 1 that everything failed, 2 a mix, and 4 that
  nothing matched. An operand that matched nothing, that -o skipped, or
  that was declined at an -i prompt counts as neither, so it can neither
  degrade a success nor promote a failure.
- Only the final path component is rewritten, unless either operand
  holds a separator, which widens the scope to the whole path. Trailing
  separators are stripped from the operand, but the existence check
  still sees the operand exactly as it was typed.
- An empty substring inserts at every code-unit boundary rather than
  matching nowhere, and a substring equal to its replacement exits 4
  before any syscall runs.
- The two overwrite guards ask different questions deliberately. The
  default path uses a check that follows symlinks, so a dangling
  destination is clobbered; -s lstats the new target name, so a dangling
  entry blocks it.
- Filenames are carried as OsStr and the substitution engine is generic
  over the code unit: bytes on unix, UTF-16 units on Windows. A name
  that is not valid Unicode survives the report and the diagnostics
  without being replaced.

Known divergences, each structural to clap and Rust rather than a defect
in the port: the --help and --version layout, ANSI escapes on a
terminal, the eager mutual-exclusion check, the rpmatch answer set, and
SIGPIPE, which Rust ignores and the reference dies of.
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
renovate[bot] f83ba8176b chore(deps): update rust crate libc to v0.2.190 2026-10-03 07:06:18 +02:00
renovate[bot] 9533b5561a chore(deps): update rust crate uuid to v1.27.0 2026-10-03 06:59:46 +02:00
renovate[bot] 812fefe166 chore(deps): update rust crate dns-lookup to v4.0.2 2026-10-02 07:21:55 +02:00
renovate[bot] b7772f0f60 chore(deps): update rust crate thiserror to v2.0.21 2026-09-24 07:08:20 +02:00
Daniel Hofstetter 62b69a6b1b Bump getrandom from 0.4.2 to 0.4.3 (#643) 2026-09-22 17:11:03 +02:00
Daniel Hofstetter ece8fc54cf Bump chacha20 from 0.10.0 to 0.10.2 (#642)
because version 0.10.0 got yanked
2026-09-22 17:10:56 +02:00
renovate[bot] 381dca3879 chore(deps): update rust crate rand to v0.10.3 2026-09-20 14:44:03 +02:00
renovate[bot] a9aae577cf chore(deps): update rust crate uutests to 0.12.0 2026-09-20 12:25:38 +02:00
renovate[bot] 44323e6d6a chore(deps): update rust crate clap_complete to v4.6.11 2026-09-20 10:31:00 +02:00
renovate[bot] 5cc5689e12 chore(deps): update rust crate clap to v4.6.7 2026-09-20 10:30:07 +02:00
renovate[bot] b364d8263e chore(deps): update rust crate uuid to v1.26.1 2026-09-13 09:43:17 +02:00