From 3155cd510ff0fba9c0de05204276cac08dab6268 Mon Sep 17 00:00:00 2001 From: Andreas Hartmann Date: Wed, 23 Jun 2021 16:11:46 +0200 Subject: [PATCH] install: Fix argument parsing for '--backup' The '--backup' option would previously accept arguments separated from the option either by a space or an equals sign. The GNU implementation strictly requires an "equals" for argument separation. As the argument to '--backup' is optional, the equals sign mustn't be ommited as otherwise there is no way to tell a file argument apart from an argument that's meant for the '--backup' option. This ensures that if '--backup' is present it either has no further associated arguments (i.e. fallback to the default), or the arguments are separated by an equals sign. --- src/uu/install/src/install.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index 3992ac25e..44c1ca980 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -106,6 +106,9 @@ pub fn uumain(args: impl uucore::Args) -> i32 { Arg::with_name(OPT_BACKUP) .long(OPT_BACKUP) .help("(unimplemented) make a backup of each existing destination file") + .takes_value(true) + .require_equals(true) + .min_values(0) .value_name("CONTROL") ) .arg(