[git] GnuPG - branch, fix-T4017, created. gnupg-2.2.8-5-ge051c27

[email protected] (by Daniel Kahn Gillmor)
Newsgroups gmane.comp.encryption.gpg.cvs
Message-ID <[email protected]>
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, fix-T4017 has been created
        at  e051c279216ecd4ec9a48e13ccc695f5ab667b2a (commit)

- Log -----------------------------------------------------------------
commit e051c279216ecd4ec9a48e13ccc695f5ab667b2a
Author: Daniel Kahn Gillmor <[email protected]>
Date:   Mon Jun 11 18:33:26 2018 -0400

    gpg: set full --dry-run when used with --show-keys
    
    * g10/gpg.c (main): ensure that opt.dry_run matches
    opt.import_options[IMPORT_DRY_RUN].
    --
    
    It seems that the import_options IMPORT_DRY_RUN bit doesn't have the
    same power as the opt.dry_run bit itself.  When one is set or cleared
    by command-line options or other option parsing, we should ensure that
    the other is also set or cleared.
    
    It would probably be cleaner to have just a single bit, stored in a
    single place, but that kind of overhaul is beyond the scope of this
    bugfix.
    
    GnuPG-Bug-id: 4017
    Signed-off-by: Daniel Kahn Gillmor <[email protected]>

diff --git a/g10/gpg.c b/g10/gpg.c
index c117de3..4f4aae7 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2609,6 +2609,7 @@ main (int argc, char **argv)
             set_cmd (&cmd, pargs.r_opt);
             opt.import_options |= IMPORT_SHOW;
             opt.import_options |= IMPORT_DRY_RUN;
+            opt.dry_run = 1;
             opt.import_options &= ~IMPORT_REPAIR_KEYS;
             opt.list_options |= LIST_SHOW_UNUSABLE_UIDS;
             opt.list_options |= LIST_SHOW_UNUSABLE_SUBKEYS;
@@ -2647,7 +2648,10 @@ main (int argc, char **argv)
 
 	  case oQuiet: opt.quiet = 1; break;
 	  case oNoTTY: tty_no_terminal(1); break;
-	  case oDryRun: opt.dry_run = 1; break;
+	  case oDryRun:
+            opt.dry_run = 1;
+            opt.import_options |= IMPORT_DRY_RUN;
+            break;
 	  case oInteractive: opt.interactive = 1; break;
 	  case oVerbose:
 	    opt.verbose++;
@@ -3208,14 +3212,19 @@ main (int argc, char **argv)
 	      }
 	    break;
 	  case oImportOptions:
-	    if(!parse_import_options(pargs.r.ret_str,&opt.import_options,1))
-	      {
-		if(configname)
-		  log_error(_("%s:%d: invalid import options\n"),
-			    configname,configlineno);
-		else
-		  log_error(_("invalid import options\n"));
-	      }
+            {
+              unsigned int old_import_options = opt.import_options;
+              if(!parse_import_options(pargs.r.ret_str,&opt.import_options,1))
+                {
+                  if(configname)
+                    log_error(_("%s:%d: invalid import options\n"),
+                              configname,configlineno);
+                  else
+                    log_error(_("invalid import options\n"));
+                }
+              if ((old_import_options & IMPORT_DRY_RUN) != (opt.import_options & IMPORT_DRY_RUN))
+                opt.dry_run = !!(opt.import_options & IMPORT_DRY_RUN);
+            }
 	    break;
 	  case oImportFilter:
 	    rc = parse_and_set_import_filter (pargs.r.ret_str);

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


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.