179 Commits
Author SHA1 Message Date
Sylvestre Ledru 0f4bc97ce0 prepare version 0.2.1 v0.2.1 2026-08-05 23:09:22 +02:00
Sylvestre Ledru 96a709fce3 prepare version 0.2.1 2026-08-05 22:59:23 +02:00
Sylvestre Ledru a8c520af8d Merge pull request #205 from sylvestre/foo
cargo: rename package to uu_shadow. shadow-rs is already used
2026-08-05 22:57:44 +02:00
Sylvestre Ledru 2f14db1bdd Merge pull request #206 from uutils/fix/cargo-publish-shadow-core-version
fix: add version to shadow-core workspace dependencies for cargo publish
2026-08-05 22:57:33 +02:00
Sylvestre Ledru a3b9e1fc63 fix: add version to shadow-core workspace dependencies for cargo publish
Without a version field, `cargo publish` fails for all crates that
depend on shadow-core:

  all dependencies must have a version requirement specified when publishing.
  dependency `shadow-core` does not specify a version

Add version = "0.2.0" to all three shadow-core dependency declarations
in Cargo.toml (workspace.dependencies, [dependencies], and dev-dependencies)
to allow `cargo publish` to work correctly.
2026-08-05 20:18:34 +02:00
Sylvestre Ledru cb8ce5ebd2 cargo: rename package to uu_shadow. shadow-rs is already used
https://crates.io/crates/uu_grep is a precedent
2026-08-02 21:31:25 +02:00
Sylvestre Ledru 7ed1cdf3e8 Merge pull request #171 from uutils/feat/159-os-sourced-error-messages
tools: source the "Permission denied" message from the OS (#159)
2026-08-02 19:30:29 +02:00
renovate[bot] 615c6895ef chore(deps): update rust crate clap to v4.6.5 2026-08-01 07:07:14 +02:00
renovate[bot] 641f4772a2 chore(deps): update rust crate landlock to v0.4.7 2026-07-28 08:02:03 +02:00
renovate[bot] 14fecfc98e chore(deps): update rust crate clap_complete to v4.6.8 2026-07-28 07:59:10 +02:00
Pierre Warnier 750c9bc0d5 deps: update clap to 4.6.4 (with syn 3.0.3) (#201)
Renovate's single-package update (#198) could not land this: clap_derive
4.6.4 requires syn >=3.0.2 while the lockfile pinned syn 3.0.0 (via
thiserror-impl), so the conservative 'cargo update -p clap --precise'
had no solvable resolution. Update both together (clap 4.6.3 -> 4.6.4,
syn 3.0.0 -> 3.0.3). cargo deny check passes with the syn skip added in
#194.
2026-07-27 13:58:06 +02:00
Daniel Hofstetter a31ffacc2f Bump thiserror & adapt deny.toml (#194)
* Bump thiserror from 2.0.18 to 2.0.19

* deny.toml: add syn to skip list

* deny.toml: remove windows-sys from skip list
2026-07-27 13:39:58 +02:00
renovate[bot] 6da85b4e5c chore(deps): update rust crate landlock to v0.4.6 2026-07-26 10:29:11 +02:00
renovate[bot] d0491c7778 chore(deps): update rust crate libc to v0.2.189 2026-07-22 08:01:16 +02:00
renovate[bot] d973f25555 chore(deps): update rust crate libc to v0.2.188 2026-07-21 15:54:06 +02:00
renovate[bot] 0d4666c7d5 chore(deps): update rust crate clap to v4.6.3 2026-07-21 08:11:48 +02:00
renovate[bot] 3b71b4afe2 chore(deps): update rust crate libc to v0.2.187 2026-07-21 08:04:02 +02:00
renovate[bot] 34a0ff7f3f chore(deps): update rust crate clap to v4.6.2 2026-07-16 08:12:05 +02:00
renovate[bot] d3bf29af78 chore(deps): update debian docker tag to trixie-20260713 2026-07-14 08:05:20 +02:00
Pierre Warnier 417fb64186 shadow-core: drop the single-use strerror wrapper
Per review on #171, inline the one caller: permission_denied() now calls
uucore::error::strip_errno directly. Also disambiguate the module doc now
that the local strerror fn is gone (it refers to libc's strerror).
2026-07-07 15:11:04 +02:00
Pierre Warnier 399a2ce258 shadow-core: use uucore::error::strip_errno instead of hand-rolling
Replace the local " (os error N)" suffix stripping with uucore's existing
strip_errno helper, per review on #171. Adds uucore (already in the
dependency tree via the tool crates) to shadow-core.
2026-07-07 15:11:04 +02:00
Pierre Warnier 7b08047f40 shadow-core: strip Rust's "(os error N)" suffix from strerror
io::Error::from_raw_os_error(e).to_string() renders as
"Permission denied (os error 13)" — Rust appends its own suffix to the
libc text. Strip it so the message is the bare OS string (matching
GNU/coreutils output), and add a regression test that the suffix is
absent. Addresses review feedback on #171.
2026-07-07 15:11:04 +02:00
Pierre Warnier e54f668655 shadow-core, tools: source the EACCES message from the OS (#159)
The manual root-privilege guards across the account tools printed a
hardcoded "Permission denied." string. Route that text through libc's
strerror instead (via std::io::Error::from_raw_os_error), so the wording
comes from the host OS and is translated by glibc on localized systems —
the same way GNU coreutils renders system errors (e.g. cat: Is a
directory). This also keeps the string out of our source tree, shrinking
the residual clean-room surface that motivated #159.

Add shadow_core::os_error with strerror(errno) and permission_denied(),
and convert the 13 caller_is_root() guards in chage, chpasswd, groupadd,
groupdel, groupmod, passwd, useradd, userdel, usermod to use it.

Scope: this covers the errno-mappable class only. True I/O errors already
render the OS strerror via ShadowError::Io/IoPath. Domain errors (e.g.
"group already exists") have no OS equivalent and stay in-tree. The
gettext-catalog idea was evaluated and declined in #159 (the English
msgid must remain in source as the lookup key, so it does not remove the
exposure).

Note: output changes from "Permission denied." to the OS text
"Permission denied" (no trailing period; translated off-English). No
tests asserted the old literal.
2026-07-07 15:11:04 +02:00
Pierre Warnier acdcca5984 shadow-core, tools: de-duplicate the clap-error boilerplate (#181) (#190)
Every tool's uumain carried the same 10-line clap-error match plus a
per-enum AlreadyPrinted(i32) sentinel variant with identical Display and
code() arms. Hoist all of it into shadow-core:

- shadow_core::cli::AlreadyPrinted(i32): shared UError whose Display is
  empty (the message was already printed), carrying only the exit code.
- shadow_core::cli::parse_args(cmd, args, code): parses argv, prints the
  clap error, returns Ok(None) for --help/--version, and maps real parse
  failures through the tool's code function.

Each of the 12 tools now opens with a single let-else line; the
AlreadyPrinted variant and its Display/code() arms are deleted from all
12 error enums, and non-clap uses of the sentinel switch to the shared
type. grpck/pwck (which use plain '?') are unchanged.

Behavior is preserved and verified: --help/--version exit 0 with
identical output; bad flags exit 1 (chfn/chpasswd/chsh/newgrp),
2 (chage/group*/user*), and passwd keeps its kind-dependent 2/6 mapping.
useradd's clap-error match had two arms both returning 2; it collapses
to the constant.

userdel's remaining variants all share the Cant prefix, tripping
clippy::enum_variant_names; allowed with a comment since the names
mirror userdel(8)'s documented exit-code names.

Closes #181.
2026-07-07 15:09:51 +02:00
Pierre Warnier a6dccad7e1 deps: bump uucore from 0.8 to 0.9 (#179) (#189)
Zero API drift: the surface we use (show_error!/show_warning!,
uucore::error, #[uucore::main], uucore::bin!, util_name) is unchanged
between 0.8 and 0.9. uucore 0.9's MSRV is 1.88, below our 1.94 gate.

Renovate's bump PR (#166) was closed during dependency-update cleanup,
which makes Renovate ignore the 0.9 line permanently — hence the manual
bump.

Closes #179.
2026-07-07 14:53:05 +02:00