]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Cwrapper should not eat -- arguments
authorCharles Wilson <libtool@cwilson.fastmail.fm>
Sun, 25 May 2008 04:13:04 +0000 (00:13 -0400)
committerCharles Wilson <libtool@cwilson.fastmail.fm>
Sun, 25 May 2008 21:35:13 +0000 (17:35 -0400)
* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
[file scope]: Defined all option strings in terms of macro
LTWRAPPER_OPTION_PREFIX. Similarly defined all option string
lengths in terms of macro LTWRAPPER_OPTION_PREFIX_LENGTH.
[main]: Modified option parsing algorithm to pass -- on to
target, and to not stop processing arguments when -- is seen.
Added check for unrecognized options in reserved namespace
defined by LTWRAPPER_OPTION_PREFIX.

ChangeLog
libltdl/config/ltmain.m4sh

index 6538f6296a558fd9f71638fd720e34521854024b..7e00eb96c5ca884cfc36cb1206fc67a5ccf0b08d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-05-25  Charles Wilson  <libtool@cwilson.fastmail.fm>
+
+       Cwrapper should not eat -- arguments
+       * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src)
+       [file scope]: Defined all option strings in terms of macro
+       LTWRAPPER_OPTION_PREFIX. Similarly defined all option string
+       lengths in terms of macro LTWRAPPER_OPTION_PREFIX_LENGTH.
+       [main]: Modified option parsing algorithm to pass -- on to
+       target, and to not stop processing arguments when -- is seen.
+       Added check for unrecognized options in reserved namespace
+       defined by LTWRAPPER_OPTION_PREFIX.
+
 2008-05-25  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Fix ifort settings again.
index 0bfae76be6b88918a230514c16c6ec16890203a5..888b74be620ad03670c349af9258d1d326c51384 100644 (file)
@@ -2841,18 +2841,24 @@ EOF
 
            cat <<"EOF"
 
-static const char *dumpscript_opt  = "--lt-dump-script";
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
-static const size_t env_set_opt_len = 12;
-static const char *env_set_opt     = "--lt-env-set";
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
   /* argument is putenv-style "foo=bar", value of foo is set to bar */
 
-static const size_t env_prepend_opt_len = 16;
-static const char *env_prepend_opt = "--lt-env-prepend";
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
   /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
 
-static const size_t env_append_opt_len = 15;
-static const char *env_append_opt  = "--lt-env-append";
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
   /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
 
 int
@@ -2989,8 +2995,7 @@ EOF
               lt_opt_process_env_set (p);
             }
           else if ((arglen == env_set_opt_len) &&
-                   (i + 1 < argc) &&
-                   (strcmp (argv[i + 1], "--") != 0))
+                   (i + 1 < argc))
             {
               lt_opt_process_env_set (argv[i + 1]);
               i++; /* don't copy */
@@ -3008,8 +3013,7 @@ EOF
               lt_opt_process_env_prepend (p);
             }
           else if ((arglen == env_prepend_opt_len) &&
-                   (i + 1 < argc) &&
-                   (strcmp (argv[i + 1], "--") != 0))
+                   (i + 1 < argc))
             {
               lt_opt_process_env_prepend (argv[i + 1]);
               i++; /* don't copy */
@@ -3027,8 +3031,7 @@ EOF
               lt_opt_process_env_append (p);
             }
           else if ((arglen == env_append_opt_len) &&
-                   (i + 1 < argc) &&
-                   (strcmp (argv[i + 1], "--") != 0))
+                   (i + 1 < argc))
             {
               lt_opt_process_env_append (argv[i + 1]);
               i++; /* don't copy */
@@ -3037,15 +3040,19 @@ EOF
             lt_fatal ("%s missing required argument", env_append_opt);
           continue;
         }
-      if (strcmp (argv[i], "--") == 0)
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
         {
-          /* immediately copy all the rest of the arguments */
-          ++i;
-          for (; i < argc; i++)
-            newargz[++newargc] = xstrdup (argv[i]);
-
-          /* same as break, because i = argc */
-          continue;
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
         }
       /* otherwise ... */
       newargz[++newargc] = xstrdup (argv[i]);