Merge pull request #8492 from Anonymous-AAA/fix-chown-reference-file
Some checks are pending
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Style/cargo-deny (push) Waiting to run
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run

chown: fix --reference file syntax
This commit is contained in:
Alen Antony 2025-09-02 16:00:12 +05:30 committed by GitHub
parent 21de2c8bc0
commit 2c9a27c2de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View file

@ -131,8 +131,7 @@ pub fn uu_app() -> Command {
.long(options::REFERENCE)
.help(translate!("chown-help-reference"))
.value_name("RFILE")
.value_hint(clap::ValueHint::FilePath)
.num_args(1..),
.value_hint(clap::ValueHint::FilePath),
)
.arg(
Arg::new(options::verbosity::SILENT)

View file

@ -6,9 +6,9 @@
#[cfg(any(target_os = "linux", target_os = "android"))]
use uucore::process::geteuid;
use uutests::new_ucmd;
use uutests::util::{CmdResult, TestScenario, is_ci, run_ucmd_as_root};
use uutests::util_name;
use uutests::{at_and_ucmd, new_ucmd};
// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'.
// If we are running inside the CI and "needle" is in "stderr" skipping this test is
// considered okay. If we are not inside the CI this calls assert!(result.success).
@ -844,3 +844,17 @@ fn test_chown_no_change_to_user_group() {
));
}
}
#[test]
fn test_chown_reference_file() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("a");
at.touch("b");
ucmd.arg("--verbose")
.arg("--reference")
.arg("a")
.arg("b")
.succeeds()
.stderr_contains("ownership of 'b' retained as")
.no_stdout();
}