[Pkg-gnupg-commit] [gnupg2] 07/20: import upstream improvements to gpgcompose

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jul 26 20:20:46 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 1271234785b30628719bc5c0ddfbacf7138660ec
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Sun Jun 11 23:55:30 2017 +0200

    import upstream improvements to gpgcompose
---
 debian/patches/0037-gpg-Remove-dead-code.patch     | 39 ++++++++++++++
 ...gpg-Support-gpgcompose-encrypted-pop-help.patch | 57 ++++++++++++++++++++
 ...039-gpg-Improve-some-output-of-gpgcompose.patch | 34 ++++++++++++
 ...gcompose-help-output-to-stdout-not-stderr.patch | 62 ++++++++++++++++++++++
 debian/patches/series                              |  4 ++
 5 files changed, 196 insertions(+)

diff --git a/debian/patches/0037-gpg-Remove-dead-code.patch b/debian/patches/0037-gpg-Remove-dead-code.patch
new file mode 100644
index 0000000..5faa6e1
--- /dev/null
+++ b/debian/patches/0037-gpg-Remove-dead-code.patch
@@ -0,0 +1,39 @@
+From: "Neal H. Walfield" <neal at g10code.com>
+Date: Sun, 11 Jun 2017 13:58:44 +0200
+Subject: gpg: Remove dead code.
+
+* g10/gpgcompose.c (filter_pop): F->PKTTYPE will never be
+PKT_ENCRYPTED_MDC.
+(encrypted_pop): Likewise and there is no option --encrypted-mdc-pop.
+
+(cherry picked from commit 8a9066865688cf17594b2bdde4b260b0ef36d68e)
+---
+ g10/gpgcompose.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
+index e541cfe..a8da54c 100644
+--- a/g10/gpgcompose.c
++++ b/g10/gpgcompose.c
+@@ -81,7 +81,7 @@ filter_pop (iobuf_t out, int expected_type)
+                "but current container is a %s container.\n",
+                pkttype_str (f->pkttype), pkttype_str (expected_type));
+ 
+-  if (f->pkttype == PKT_ENCRYPTED || f->pkttype == PKT_ENCRYPTED_MDC)
++  if (f->pkttype == PKT_ENCRYPTED)
+     {
+       err = iobuf_pop_filter (out, f->func, f->context);
+       if (err)
+@@ -2588,12 +2588,6 @@ encrypted_pop (const char *option, int argc, char *argv[], void *cookie)
+   (void) argc;
+   (void) argv;
+ 
+-  if (strcmp (option, "--encrypted-pop") == 0)
+-    filter_pop (out, PKT_ENCRYPTED);
+-  else if (strcmp (option, "--encrypted-mdc-pop") == 0)
+-    filter_pop (out, PKT_ENCRYPTED_MDC);
+-  else
+-    log_fatal ("%s: option not handled by this function!\n", option);
+ 
+   debug ("Popped encryption container.\n");
+ 
diff --git a/debian/patches/0038-gpg-Support-gpgcompose-encrypted-pop-help.patch b/debian/patches/0038-gpg-Support-gpgcompose-encrypted-pop-help.patch
new file mode 100644
index 0000000..3331541
--- /dev/null
+++ b/debian/patches/0038-gpg-Support-gpgcompose-encrypted-pop-help.patch
@@ -0,0 +1,57 @@
+From: "Neal H. Walfield" <neal at g10code.com>
+Date: Sun, 11 Jun 2017 14:00:22 +0200
+Subject: gpg: Support 'gpgcompose --encrypted-pop --help'
+
+* g10/gpgcompose.c (encrypted_pop_options): New variable.
+(encrypted_pop): Support the --help option.
+
+Reported-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+(cherry picked from commit 4ddf4e114c8df06d89144e857b7601de0b7e5a7c)
+---
+ g10/gpgcompose.c | 24 +++++++++++++++++++++---
+ 1 file changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
+index a8da54c..49bb8af 100644
+--- a/g10/gpgcompose.c
++++ b/g10/gpgcompose.c
+@@ -2580,18 +2580,36 @@ encrypted (const char *option, int argc, char *argv[], void *cookie)
+   return processed;
+ }
+ 

++static struct option encrypted_pop_options[] = {
++  { NULL, NULL,
++    "Example:\n\n"
++    "  $ gpgcompose --sk-esk PASSWORD \\\n"
++    "    --encrypted-mdc \\\n"
++    "      --literal --value foo \\\n"
++    "    --encrypted-pop | " GPG_NAME " --list-packets" }
++};
++
+ static int
+ encrypted_pop (const char *option, int argc, char *argv[], void *cookie)
+ {
+   iobuf_t out = cookie;
++  int processed;
+ 
+-  (void) argc;
+-  (void) argv;
++  processed = process_options (option,
++                               major_options,
++                               encrypted_pop_options,
++                               NULL,
++                               global_options, NULL,
++                               argc, argv);
++  /* We only support a single option, --help, which causes the program
++   * to exit.  */
++  log_assert (processed == 0);
+ 
++  filter_pop (out, PKT_ENCRYPTED);
+ 
+   debug ("Popped encryption container.\n");
+ 
+-  return 0;
++  return processed;
+ }
+ 

+ struct data
diff --git a/debian/patches/0039-gpg-Improve-some-output-of-gpgcompose.patch b/debian/patches/0039-gpg-Improve-some-output-of-gpgcompose.patch
new file mode 100644
index 0000000..82577ef
--- /dev/null
+++ b/debian/patches/0039-gpg-Improve-some-output-of-gpgcompose.patch
@@ -0,0 +1,34 @@
+From: "Neal H. Walfield" <neal at g10code.com>
+Date: Sun, 11 Jun 2017 14:07:02 +0200
+Subject: gpg: Improve some output of gpgcompose.
+
+(cherry picked from commit cb0484e0762a1ce05d00d949f4b70162e2f7b82c)
+---
+ g10/gpgcompose.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
+index 49bb8af..98c04f2 100644
+--- a/g10/gpgcompose.c
++++ b/g10/gpgcompose.c
+@@ -512,7 +512,8 @@ static struct option major_options[] = {
+   { "--encrypted-mdc", encrypted,
+     "Create a symmetrically encrypted and integrity protected data packet." },
+   { "--encrypted-pop", encrypted_pop,
+-    "Pop an encryption container." },
++    "Pop the most recent encryption container started by either"
++    " --encrypted or --encrypted-mdc." },
+   { "--compressed", NULL, "Create a compressed data packet." },
+   { "--literal", literal, "Create a literal (plaintext) data packet." },
+   { "--signature", signature, "Create a signature packet." },
+@@ -2534,7 +2535,9 @@ encrypted (const char *option, int argc, char *argv[], void *cookie)
+                                argc, argv);
+ 
+   if (! session_key.algo)
+-    log_fatal ("%s: no session key configured.\n", option);
++    log_fatal ("%s: no session key configured\n"
++               "  (use e.g. --sk-esk PASSWORD or --pk-esk KEYID).\n",
++               option);
+ 
+   memset (&e, 0, sizeof (e));
+   /* We only need to set E->LEN, E->EXTRALEN (if E->LEN is not
diff --git a/debian/patches/0040-gpg-Send-gpgcompose-help-output-to-stdout-not-stderr.patch b/debian/patches/0040-gpg-Send-gpgcompose-help-output-to-stdout-not-stderr.patch
new file mode 100644
index 0000000..aa71205
--- /dev/null
+++ b/debian/patches/0040-gpg-Send-gpgcompose-help-output-to-stdout-not-stderr.patch
@@ -0,0 +1,62 @@
+From: "Neal H. Walfield" <neal at g10code.com>
+Date: Sun, 11 Jun 2017 14:10:46 +0200
+Subject: gpg: Send gpgcompose --help output to stdout, not stderr.
+
+* g10/gpgcompose.c (show_help): Send gpgcompose --help output to
+stdout, not stderr.
+
+Reported-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+(cherry picked from commit 7aeac20f12ed257d3d159b304afeeac7f406c9d2)
+---
+ g10/gpgcompose.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c
+index 98c04f2..8e29c2f 100644
+--- a/g10/gpgcompose.c
++++ b/g10/gpgcompose.c
+@@ -281,18 +281,18 @@ show_help (struct option options[])
+         {
+           const char *o = option[0] ? option : "ARG";
+           l = strlen (o);
+-          fprintf (stderr, "%s", o);
++          fprintf (stdout, "%s", o);
+         }
+ 
+       if (! help)
+         {
+-          fputc ('\n', stderr);
++          fputc ('\n', stdout);
+           continue;
+         }
+ 
+       if (option)
+         for (j = l; j < max_length + 2; j ++)
+-          fputc (' ', stderr);
++          fputc (' ', stdout);
+ 
+ #define BOLD_START "\033[1m"
+ #define NORMAL_RESTORE "\033[0m"
+@@ -314,7 +314,7 @@ show_help (struct option options[])
+ 
+       if (! option)
+         {
+-          fprintf (stderr, "\n%s\n", formatted);
++          printf ("\n%s\n", formatted);
+           break;
+         }
+ 
+@@ -330,10 +330,10 @@ show_help (struct option options[])
+ 
+           if (p != formatted)
+             for (j = 0; j < max_length + 2; j ++)
+-              fputc (' ', stderr);
++              fputc (' ', stdout);
+ 
+-          fwrite (p, l, 1, stderr);
+-          fputc ('\n', stderr);
++          fwrite (p, l, 1, stdout);
++          fputc ('\n', stdout);
+         }
+ 
+       xfree (formatted);
diff --git a/debian/patches/series b/debian/patches/series
index c0e4c24..c223c32 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -34,3 +34,7 @@ skip-missing-signing-keys/0013-g10-Skip-signing-keys-where-no-secret-key-is-avai
 0034-sm-Fix-typo.patch
 0035-sm-Simplify-code.patch
 0036-gpg-Avoid-failure-exit-when-scdaemon-is-disabled-but.patch
+0037-gpg-Remove-dead-code.patch
+0038-gpg-Support-gpgcompose-encrypted-pop-help.patch
+0039-gpg-Improve-some-output-of-gpgcompose.patch
+0040-gpg-Send-gpgcompose-help-output-to-stdout-not-stderr.patch

-- 
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