[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-58-gde01c51

by Werner Koch cvs at cvs.gnupg.org
Tue Mar 27 13:49:41 CEST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  de01c51ecb3918f427aa76281351749c8ad07ed6 (commit)
      from  26ec6c79020c8b3dfd6f517c292bb973209b0d31 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit de01c51ecb3918f427aa76281351749c8ad07ed6
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Mar 27 12:35:13 2012 +0200

    Print warning for arguments not considered an option.
    
    GnuPG requires that options are given before other arguments.  This
    can sometimes be confusing.  We now print a warning if we found an
    argument looking alike a long option without being preceded by the
    stop option.  This is bug#1343.
    
    * common/argparse.h (ARGPARSE_FLAG_STOP_SEEN): New.
    * common/argparse.c (arg_parse): Set new flag.
    * g10/gpg.c (main): Print the warning.
    * agent/gpg-agent.c (main): Ditto.
    * dirmngr/dirmngr.c (main): Ditto.
    * g13/g13.c (main): Ditto.
    * scd/scdaemon.c (main): Ditto.
    * sm/gpgsm.c (main): Ditto.
    * tools/gpg-connect-agent.c (main): Ditto.
    * tools/gpgconf.c (main): Ditto.

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 3a86867..b6bf71e 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -851,6 +851,16 @@ main (int argc, char **argv )
   /*log_info ("NOTE: this is a development version!\n");*/
 #endif
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
 #ifdef ENABLE_NLS
   /* gpg-agent usually does not output any messages because it runs in
      the background.  For log files it is acceptable to have messages
diff --git a/common/argparse.c b/common/argparse.c
index f55456d..ce9caff 100644
--- a/common/argparse.c
+++ b/common/argparse.c
@@ -229,7 +229,7 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
       arg->err = 0;
       arg->flags |= 1<<15; /* Mark as initialized.  */
       if ( *arg->argc < 0 )
-        jnlib_log_bug ("invalid argument for arg_parsee\n");
+        jnlib_log_bug ("invalid argument for arg_parse\n");
     }
 
 
@@ -671,6 +671,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
         {
           /* Stop option processing.  */
           arg->internal.stopped = 1;
+          arg->flags |= ARGPARSE_FLAG_STOP_SEEN;
           argc--; argv++; idx++;
           goto next_one;
 	}
diff --git a/common/argparse.h b/common/argparse.h
index dc9b07b..c8f4c60 100644
--- a/common/argparse.h
+++ b/common/argparse.h
@@ -82,6 +82,8 @@ typedef struct
 #define ARGPARSE_FLAG_ONEDASH   32   /* Allow long options with one dash.    */
 #define ARGPARSE_FLAG_NOVERSION 64   /* No output for "--version".           */
 
+#define ARGPARSE_FLAG_STOP_SEEN 256  /* Set to true if a "--" has been seen. */
+
 /* Flags for each option (ARGPARSE_OPTS).  The type code may be
    ORed with the OPT flags.  */
 #define ARGPARSE_TYPE_NONE        0  /* Does not take an argument.        */
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index ee85718..9425cd1 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -847,6 +847,16 @@ main (int argc, char **argv)
   log_info ("NOTE: this is a development version!\n");
 #endif
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
   if (!access ("/etc/dirmngr", F_OK) && !strncmp (opt.homedir, "/etc/", 5))
     log_info
       ("NOTE: DirMngr is now a proper part of GnuPG.  The configuration and"
diff --git a/g10/gpg.c b/g10/gpg.c
index 07d5172..00ee941 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2018,7 +2018,7 @@ main (int argc, char **argv)
     orig_argv = argv;
     pargs.argc = &argc;
     pargs.argv = &argv;
-    pargs.flags= 1|(1<<6);  /* do not remove the args, ignore version */
+    pargs.flags= (ARGPARSE_FLAG_KEEP | ARGPARSE_FLAG_NOVERSION);
     while( arg_parse( &pargs, opts) ) {
 	if( pargs.r_opt == oDebug || pargs.r_opt == oDebugAll )
 	    parse_debug++;
@@ -2094,7 +2094,7 @@ main (int argc, char **argv)
     argv = orig_argv;
     pargs.argc = &argc;
     pargs.argv = &argv;
-    pargs.flags=  1;  /* do not remove the args */
+    pargs.flags= ARGPARSE_FLAG_KEEP;
 
     /* By this point we have a homedir, and cannot change it. */
     check_permissions(opt.homedir,0);
@@ -3093,6 +3093,16 @@ main (int argc, char **argv)
         log_printf ("\n");
       }
 
+    /* Print a warning if an argument looks like an option.  */
+    if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+      {
+        int i;
+
+        for (i=0; i < argc; i++)
+          if (argv[i][0] == '-' && argv[i][1] == '-')
+            log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+      }
+
 
     gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
 
diff --git a/g13/g13.c b/g13/g13.c
index 6fc83b5..ee72f33 100644
--- a/g13/g13.c
+++ b/g13/g13.c
@@ -599,6 +599,17 @@ main ( int argc, char **argv)
   if (may_coredump && !opt.quiet)
     log_info (_("WARNING: program may create a core file!\n"));
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
+
   if (logfile)
     {
       log_set_file (logfile);
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 7e7850d..86d092b 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -618,6 +618,15 @@ main (int argc, char **argv )
   log_info ("NOTE: this is a development version!\n");
 #endif
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
 
   if (atexit (cleanup))
     {
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index b2d1d2f..d8ddbee 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -1473,6 +1473,16 @@ main ( int argc, char **argv)
       log_printf ("\n");
     }
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
 /*FIXME    if (opt.batch) */
 /*      tty_batchmode (1); */
 
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index d340c7f..0ef52fc 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -1226,6 +1226,18 @@ main (int argc, char **argv)
   if (log_get_errorcount (0))
     exit (2);
 
+
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
+
   use_tty = (gnupg_isatty (fileno (stdin)) && gnupg_isatty (fileno (stdout)));
 
   if (opt.exec)
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index cff6e4b..a2bba18 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -195,6 +195,16 @@ main (int argc, char **argv)
   if (log_get_errorcount (0))
     exit (2);
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
   fname = argc ? *argv : NULL;
 
   switch (cmd)
diff --git a/tools/gpgtar.c b/tools/gpgtar.c
index b6dd5e1..d71fe03 100644
--- a/tools/gpgtar.c
+++ b/tools/gpgtar.c
@@ -227,6 +227,16 @@ main (int argc, char **argv)
   if (log_get_errorcount (0))
     exit (2);
 
+  /* Print a warning if an argument looks like an option.  */
+  if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
+    {
+      int i;
+
+      for (i=0; i < argc; i++)
+        if (argv[i][0] == '-' && argv[i][1] == '-')
+          log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
+    }
+
   switch (cmd)
     {
     case aList:

-----------------------------------------------------------------------

Summary of changes:
 agent/gpg-agent.c         |   10 ++++++++++
 common/argparse.c         |    3 ++-
 common/argparse.h         |    2 ++
 dirmngr/dirmngr.c         |   10 ++++++++++
 g10/gpg.c                 |   14 ++++++++++++--
 g13/g13.c                 |   11 +++++++++++
 scd/scdaemon.c            |    9 +++++++++
 sm/gpgsm.c                |   10 ++++++++++
 tools/gpg-connect-agent.c |   12 ++++++++++++
 tools/gpgconf.c           |   10 ++++++++++
 tools/gpgtar.c            |   10 ++++++++++
 11 files changed, 98 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list