Page MenuHome GnuPG

853_0001-gpg-fix-redirection-of-stderr-of-gpgkeys-helpers-to-.patch
AbandonedPublic

Authored by skv on Jun 23 2016, 2:28 PM.

Details

Reviewers
None
Summary

From e1a0c76aab3c8cfc28d891ee729271e7cffac0b0 Mon Sep 17 00:00:00 2001
From: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Date: Mon, 23 May 2016 12:24:40 +0300
Subject: [PATCH] gpg: fix redirection of stderr of gpgkeys helpers to stdout

Without the patch stderr is associated with the parent's stdout
stream and therefore all error messages from called helper
(gpg_keys_{hkp, ldap, curl, ...}) go to gpg's stdout instead of
stderr like all other error messages do.

Even debug messages (if enabled) between stderr redirection and execlp
call go in this case to stdout.

For example,
$ gpg --recv-keys 1CC5206765C54F1C 2> /dev/null
gpg: DBG: execlp: /usr/local/libexec/gnupg/gpgkeys_hkp
gpgkeys: key 1CC5206765C54F1C not found on keyserver
$

The problem is that dup2(from[1],STDOUT_FILENO), that is called later,
closes STDOUT_FILENO file descriptor, but this does not affect
STDERR_FILENO that is still associated with parent's stdout stream.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>

If properly route stderr into pipe as it's done with stdout,
then all error messages will go into iobuf and will not appear
at all nether in stdout, nor in stderr. I'd prefer to see error
messages from helper in stderr.

g10/exec.c | 4 ----
1 file changed, 4 deletions(-)

2.8.1

Test Plan

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped