From d33b939d51b04b14fa69e8710a728b94732dfefe Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 22 Mar 2024 19:33:05 -0500 Subject: [PATCH] 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. --- tar/bsdtar.c | 5 +++++ 1 file changed, 5 insertions(+) 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 */ -- 2.47.2