[Pkg-gnupg-commit] [gnupg2] 137/166: gpgv: New options --log-file and --debug

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Mar 16 22:33:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 7af5d61c6e210210c777be9e6e87720dd4a055d9
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Feb 24 10:20:41 2017 +0100

    gpgv: New options --log-file and --debug
    
    * g10/gpgv.c (oLoggerFile, oDebug): New consts.
    (opts): Add options --log-file and --debug.
    (main): Implement options.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 doc/gpgv.texi |  5 +++++
 g10/gpgv.c    | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/doc/gpgv.texi b/doc/gpgv.texi
index 0608a3f..5336c98 100644
--- a/doc/gpgv.texi
+++ b/doc/gpgv.texi
@@ -111,6 +111,11 @@ file DETAILS in the documentation for a listing of them.
 @opindex logger-fd
 Write log output to file descriptor @code{n} and not to stderr.
 
+ at item --log-file @code{file}
+ at opindex log-file
+Same as @option{--logger-fd}, except the logger data is written to
+file @code{file}.  Use @file{socket://} to log to socket.
+
 @item --ignore-time-conflict
 @opindex ignore-time-conflict
 GnuPG normally checks that the timestamps associated with keys and
diff --git a/g10/gpgv.c b/g10/gpgv.c
index bd16b39..ab6f530 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -61,9 +61,11 @@ enum cmd_and_opt_values {
   oIgnoreTimeConflict,
   oStatusFD,
   oLoggerFD,
+  oLoggerFile,
   oHomedir,
   oWeakDigest,
   oEnableSpecialFilenames,
+  oDebug,
   aTest
 };
 
@@ -81,15 +83,37 @@ static ARGPARSE_OPTS opts[] = {
   ARGPARSE_s_i (oStatusFD, "status-fd",
                 N_("|FD|write status info to this FD")),
   ARGPARSE_s_i (oLoggerFD, "logger-fd", "@"),
+  ARGPARSE_s_s (oLoggerFile, "log-file", "@"),
   ARGPARSE_s_s (oHomedir, "homedir", "@"),
   ARGPARSE_s_s (oWeakDigest, "weak-digest",
                 N_("|ALGO|reject signatures made with ALGO")),
   ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"),
+  ARGPARSE_s_s (oDebug, "debug", "@"),
 
   ARGPARSE_end ()
 };
 
 
+/* The list of supported debug flags.  */
+static struct debug_flags_s debug_flags [] =
+  {
+    { DBG_PACKET_VALUE , "packet"  },
+    { DBG_MPI_VALUE    , "mpi"     },
+    { DBG_CRYPTO_VALUE , "crypto"  },
+    { DBG_FILTER_VALUE , "filter"  },
+    { DBG_IOBUF_VALUE  , "iobuf"   },
+    { DBG_MEMORY_VALUE , "memory"  },
+    { DBG_CACHE_VALUE  , "cache"   },
+    { DBG_MEMSTAT_VALUE, "memstat" },
+    { DBG_TRUST_VALUE  , "trust"   },
+    { DBG_HASHING_VALUE, "hashing" },
+    { DBG_IPC_VALUE    , "ipc"     },
+    { DBG_CLOCK_VALUE  , "clock"   },
+    { DBG_LOOKUP_VALUE , "lookup"  },
+    { DBG_EXTPROG_VALUE, "extprog" },
+    { 0, NULL }
+  };
+
 
 int g10_errors_seen = 0;
 
@@ -192,12 +216,25 @@ main( int argc, char **argv )
           opt.list_sigs=1;
           gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
           break;
+        case oDebug:
+          if (parse_debug_flag (pargs.r.ret_str, &opt.debug, debug_flags))
+            {
+              pargs.r_opt = ARGPARSE_INVALID_ARG;
+              pargs.err = ARGPARSE_PRINT_ERROR;
+            }
+          break;
         case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
         case oOutput: opt.outfile = pargs.r.ret_str; break;
         case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
         case oLoggerFD:
           log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
           break;
+        case oLoggerFile:
+          log_set_file (pargs.r.ret_str);
+          log_set_prefix (NULL, (GPGRT_LOG_WITH_PREFIX
+                                 | GPGRT_LOG_WITH_TIME
+                                 | GPGRT_LOG_WITH_PID) );
+          break;
         case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
         case oWeakDigest:
           additional_weak_digest(pargs.r.ret_str);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list