mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
install: don't error when multiple arguments of the same type are given, instead override with last one (#8033) (#8053)
This commit is contained in:
parent
46cfeadf7c
commit
3214c4d604
2 changed files with 75 additions and 0 deletions
|
@ -187,6 +187,7 @@ pub fn uu_app() -> Command {
|
||||||
.about(get_message("install-about"))
|
.about(get_message("install-about"))
|
||||||
.override_usage(format_usage(&get_message("install-usage")))
|
.override_usage(format_usage(&get_message("install-usage")))
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
|
.args_override_self(true)
|
||||||
.arg(backup_control::arguments::backup())
|
.arg(backup_control::arguments::backup())
|
||||||
.arg(backup_control::arguments::backup_no_args())
|
.arg(backup_control::arguments::backup_no_args())
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -447,6 +447,80 @@ fn test_install_nested_paths_copy_file() {
|
||||||
assert!(at.file_exists(format!("{dir2}/{file1}")));
|
assert!(at.file_exists(format!("{dir2}/{file1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_multiple_mode_arguments_override_not_error() {
|
||||||
|
let scene = TestScenario::new(util_name!());
|
||||||
|
let at = &scene.fixtures;
|
||||||
|
let dir = "source_dir";
|
||||||
|
|
||||||
|
let file = "source_file";
|
||||||
|
let gid = getegid();
|
||||||
|
let uid = geteuid();
|
||||||
|
|
||||||
|
at.touch(file);
|
||||||
|
at.mkdir(dir);
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[
|
||||||
|
file,
|
||||||
|
&format!("{dir}/{file}"),
|
||||||
|
"--owner=invalid_owner",
|
||||||
|
"--owner",
|
||||||
|
&uid.to_string(),
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[
|
||||||
|
file,
|
||||||
|
&format!("{dir}/{file}"),
|
||||||
|
"-o invalid_owner",
|
||||||
|
"-o",
|
||||||
|
&uid.to_string(),
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[file, &format!("{dir}/{file}"), "--mode=999", "--mode=200"])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[file, &format!("{dir}/{file}"), "-m 999", "-m 200"])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[
|
||||||
|
file,
|
||||||
|
&format!("{dir}/{file}"),
|
||||||
|
"--group=invalid_group",
|
||||||
|
"--group",
|
||||||
|
&gid.to_string(),
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.args(&[
|
||||||
|
file,
|
||||||
|
&format!("{dir}/{file}"),
|
||||||
|
"-g invalid_group",
|
||||||
|
"-g",
|
||||||
|
&gid.to_string(),
|
||||||
|
])
|
||||||
|
.succeeds()
|
||||||
|
.no_stderr();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_install_failing_omitting_directory() {
|
fn test_install_failing_omitting_directory() {
|
||||||
let scene = TestScenario::new(util_name!());
|
let scene = TestScenario::new(util_name!());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue