Fix ar so that it can correctly detect non-dash prefixed options that appear after...
authorNick Clifton <nickc@redhat.com>
Wed, 24 Jul 2019 11:17:37 +0000 (12:17 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 24 Jul 2019 11:17:37 +0000 (12:17 +0100)
PR 13256
* ar.c (decode_options): Restart option scanning if no operation
is detected and argument remain to be scanned.

binutils/ChangeLog
binutils/ar.c

index cc8bb80d24f3b48e3aa2d0ea72d8b60b017a81fb..4d6d6e27fc77a0a5784b87a9042ed33797f57235 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-24  Nick Clifton  <nickc@redhat.com>
+
+       PR 13256
+       * ar.c (decode_options): Restart option scanning if no operation
+       is detected and argument remain to be scanned.
+
 2019-07-23  Nick Clifton  <nickc@redhat.com>
 
        PR 24818
index a65dd62fdf22453ff0a0120b5b41380fdcdcc55b..4e953c054dedbdd6489919b337fb3e5f1919a4a0 100644 (file)
@@ -432,9 +432,10 @@ decode_options (int argc, char **argv)
 {
   int c;
 
-  /* Convert old-style tar call by exploding option element and rearranging
+  /* Convert old-style ar call by exploding option element and rearranging
      options accordingly.  */
 
+ restart:
   if (argc > 1 && argv[1][0] != '-')
     {
       int new_argc;            /* argc value for rearranged arguments */
@@ -598,6 +599,17 @@ decode_options (int argc, char **argv)
         }
     }
 
+  /* PR 13256: Allow for the possibility that the first command line option
+     started with a dash (eg --plugin) but then the following option(s) are
+     old style, non-dash-prefixed versions.  */
+  if (operation == none && optind > 0 && optind < argc)
+    {
+      argv += (optind - 1);
+      argc -= (optind - 1);
+      optind = 0;
+      goto restart;
+    }
+
   return &argv[optind];
 }
 
This page took 0.026035 seconds and 4 git commands to generate.