From: Mark Johnston Date: Sat, 23 Mar 2024 00:33:05 +0000 (-0500) Subject: tar: Warn when multiple --option values are specified (#2073) X-Git-Tag: v3.7.3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d33b939d51b04b14fa69e8710a728b94732dfefe;p=thirdparty%2Flibarchive.git tar: Warn when multiple --option values are specified (#2073) The accepted way to specify multiple options is to list them all as one comma-separated parameter. bsdtar would silently ignore all but the last value, which can be very confusing. Print a warning in this scenario. --- diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 641151985..b070e0fae 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -654,6 +654,11 @@ main(int argc, char **argv) ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS; break; case OPTION_OPTIONS: + if (bsdtar->option_options != NULL) { + lafe_warnc(0, + "Ignoring previous option '%s', separate multiple options with commas", + bsdtar->option_options); + } bsdtar->option_options = bsdtar->argument; break; case OPTION_OWNER: /* GNU tar */