]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
tar: Warn when multiple --option values are specified (#2073)
authorMark Johnston <markjdb@gmail.com>
Sat, 23 Mar 2024 00:33:05 +0000 (19:33 -0500)
committerGitHub <noreply@github.com>
Sat, 23 Mar 2024 00:33:05 +0000 (17:33 -0700)
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

index 6411519855698d4f6632ebedf006a1e83367a9cc..b070e0faeb66fef20e8c91566d6a830548a5a8c6 100644 (file)
@@ -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 */