Merge pull request #8492 from Anonymous-AAA/fix-chown-reference-file

chown: fix --reference file syntax
This commit is contained in:
Alen Antony
2025-09-02 12:30:12 +02:00
committed by GitHub
parent 21de2c8bc0
commit 2c9a27c2de
2 changed files with 16 additions and 3 deletions
+1 -2
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)
+15 -1
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();
}