Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/uu/chown/src/chown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 15 additions & 1 deletion tests/by-util/test_chown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also verify the actual permissions on the file (to make sure it worked properly)
thanks

}
Loading