mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #8492 from Anonymous-AAA/fix-chown-reference-file
chown: fix --reference file syntax
This commit is contained in:
@@ -131,8 +131,7 @@ pub fn uu_app() -> Command {
|
|||||||
.long(options::REFERENCE)
|
.long(options::REFERENCE)
|
||||||
.help(translate!("chown-help-reference"))
|
.help(translate!("chown-help-reference"))
|
||||||
.value_name("RFILE")
|
.value_name("RFILE")
|
||||||
.value_hint(clap::ValueHint::FilePath)
|
.value_hint(clap::ValueHint::FilePath),
|
||||||
.num_args(1..),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::verbosity::SILENT)
|
Arg::new(options::verbosity::SILENT)
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
use uucore::process::geteuid;
|
use uucore::process::geteuid;
|
||||||
use uutests::new_ucmd;
|
|
||||||
use uutests::util::{CmdResult, TestScenario, is_ci, run_ucmd_as_root};
|
use uutests::util::{CmdResult, TestScenario, is_ci, run_ucmd_as_root};
|
||||||
use uutests::util_name;
|
use uutests::util_name;
|
||||||
|
use uutests::{at_and_ucmd, new_ucmd};
|
||||||
// Apparently some CI environments have configuration issues, e.g. with 'whoami' and 'id'.
|
// 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
|
// 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).
|
// 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();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user