Subject: bug#24553: 25.1; epa ignores epg-gpg-program in very confusing way

From: [email-masked]
Date: Tue, 27 Sep 2016 01:15:40 -0700

I need to edit some files that decrypt properly with gpg 1.4 but not gpg
2.1.  I have both installed on my system, with 1.4 as /usr/bin/gpg1 and
2.1 as /usr/bin/gpg2.  The bug is that emacs ignores the epg-gpg-program
variable *except* in error messages, which is very confusing.  To
reproduce this problem, do the following:

  * Run strace -o /tmp/log emacs -Q
  * Eval expression (setq epg-gpg-program "/usr/bin/gpg1")
  * Open a gpg-encrypted file

By examining /tmp/log, or running ps, you can see that emacs is
executing a command like the following:

        /usr/bin/gpg2 --no-tty --status-fd 1 --yes --enable-progress-filter --command-fd 0 --output /tmp/epg-output6602ygi --decrypt -- /tmp/x.gpg

However, when it fails to decrypt, it prints the message:  Error while
decrypting with "/usr/bin/gpg1."  This is obviously very frustrating
since gpg1 can in fact decrypt the file.  Ideally emacs should obey
epg-gpg-program, but if it doesn't, it should properly report what
failed.

In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)
 of 2016-09-18 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
 -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: C
  locale-coding-system: nil

Major mode: Lisp Interaction

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Loading /u/dm/.emacs.local...done
For information about GNU Emacs and the GNU system, type <f1> C-a.
Source file ‘/usr/share/emacs/site-lisp/notmuch-parser.el’ newer than byte-compiled file
Loading ~/.dot/elisp/my-notmuch (compiled; note, source file is newer)...
Loading /u/dm/.dot/elisp/notmuch-identities.el (source)...done
calling notmuch-address-message-insinuate is no longer needed
Loading ~/.dot/elisp/my-notmuch (compiled; note, source file is newer)...done

Load-path shadows:
/usr/share/emacs/site-lisp/haskell-mode/haskell-modules hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-modules
/usr/share/emacs/site-lisp/haskell-mode/haskell-utils hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-utils
/usr/share/emacs/site-lisp/haskell-mode/w3m-haddock hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/w3m-haddock
/usr/share/emacs/site-lisp/haskell-mode/haskell-presentation-mode hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-presentation-mode
/usr/share/emacs/site-lisp/haskell-mode/haskell-checkers hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-checkers
/usr/share/emacs/site-lisp/haskell-mode/inf-haskell hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/inf-haskell
/usr/share/emacs/site-lisp/haskell-mode/haskell-align-imports hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-align-imports
/usr/share/emacs/site-lisp/haskell-mode/haskell-customize hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-customize
/usr/share/emacs/site-lisp/haskell-mode/haskell-cabal hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-cabal
/usr/share/emacs/site-lisp/haskell-mode/haskell-collapse hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-collapse
/usr/share/emacs/site-lisp/haskell-mode/haskell-load hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-load
/usr/share/emacs/site-lisp/haskell-mode/haskell hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell
/usr/share/emacs/site-lisp/haskell-mode/haskell-commands hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-commands
/usr/share/emacs/site-lisp/haskell-mode/haskell-hoogle hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-hoogle
/usr/share/emacs/site-lisp/haskell-mode/haskell-decl-scan hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-decl-scan
/usr/share/emacs/site-lisp/haskell-mode/haskell-navigate-imports hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-navigate-imports
/usr/share/emacs/site-lisp/haskell-mode/haskell-sort-imports hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-sort-imports
/usr/share/emacs/site-lisp/haskell-mode/haskell-completions hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-completions
/usr/share/emacs/site-lisp/haskell-mode/haskell-unicode-input-method hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-unicode-input-method
/usr/share/emacs/site-lisp/haskell-mode/haskell-repl hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-repl
/usr/share/emacs/site-lisp/haskell-mode/haskell-process hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-process
/usr/share/emacs/site-lisp/haskell-mode/haskell-sandbox hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-sandbox
/usr/share/emacs/site-lisp/haskell-mode/highlight-uses-mode hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/highlight-uses-mode
/usr/share/emacs/site-lisp/haskell-mode/haskell-c2hs hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-c2hs
/usr/share/emacs/site-lisp/haskell-mode/haskell-compat hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-compat
/usr/share/emacs/site-lisp/haskell-mode/haskell-font-lock hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-font-lock
/usr/share/emacs/site-lisp/haskell-mode/haskell-compile hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-compile
/usr/share/emacs/site-lisp/haskell-mode/haskell-move-nested hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-move-nested
/usr/share/emacs/site-lisp/haskell-mode/haskell-indent hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-indent
/usr/share/emacs/site-lisp/haskell-mode/haskell-menu hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-menu
/usr/share/emacs/site-lisp/haskell-mode/haskell-session hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-session
/usr/share/emacs/site-lisp/haskell-mode/haskell-string hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-string
/usr/share/emacs/site-lisp/haskell-mode/haskell-doc hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-doc
/usr/share/emacs/site-lisp/haskell-mode/ghci-script-mode hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/ghci-script-mode
/usr/share/emacs/site-lisp/haskell-mode/haskell-lexeme hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-lexeme
/usr/share/emacs/site-lisp/haskell-mode/haskell-interactive-mode hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-interactive-mode
/usr/share/emacs/site-lisp/haskell-mode/ghc-core hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/ghc-core
/usr/share/emacs/site-lisp/haskell-mode/haskell-indentation hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-indentation
/usr/share/emacs/site-lisp/haskell-mode/haskell-complete-module hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-complete-module
/usr/share/emacs/site-lisp/haskell-mode/haskell-debug hides /usr/share/emacs/site-lisp/haskell-mode/build-24.5.1/haskell-debug
/usr/share/emacs/site-lisp/flim/hex-util hides /usr/share/emacs/25.1/lisp/hex-util
/usr/share/emacs/site-lisp/flim/md4 hides /usr/share/emacs/25.1/lisp/md4
/usr/share/emacs/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/25.1/lisp/net/sasl-ntlm
/usr/share/emacs/site-lisp/flim/hmac-md5 hides /usr/share/emacs/25.1/lisp/net/hmac-md5
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/25.1/lisp/net/sasl
/usr/share/emacs/site-lisp/flim/ntlm hides /usr/share/emacs/25.1/lisp/net/ntlm
/usr/share/emacs/site-lisp/flim/hmac-def hides /usr/share/emacs/25.1/lisp/net/hmac-def
/usr/share/emacs/site-lisp/flim/sasl-cram hides /usr/share/emacs/25.1/lisp/net/sasl-cram
/usr/share/emacs/site-lisp/flim/sasl-digest hides /usr/share/emacs/25.1/lisp/net/sasl-digest
/usr/share/emacs/site-lisp/semi/smime hides /usr/share/emacs/25.1/lisp/gnus/smime
/usr/share/emacs/site-lisp/semi/pgg-parse hides /usr/share/emacs/25.1/lisp/obsolete/pgg-parse
/usr/share/emacs/site-lisp/semi/pgg-def hides /usr/share/emacs/25.1/lisp/obsolete/pgg-def
/usr/share/emacs/site-lisp/semi/pgg-pgp5 hides /usr/share/emacs/25.1/lisp/obsolete/pgg-pgp5
/usr/share/emacs/site-lisp/semi/pgg-gpg hides /usr/share/emacs/25.1/lisp/obsolete/pgg-gpg
/usr/share/emacs/site-lisp/semi/pgg hides /usr/share/emacs/25.1/lisp/obsolete/pgg
/usr/share/emacs/site-lisp/semi/pgg-pgp hides /usr/share/emacs/25.1/lisp/obsolete/pgg-pgp

Features:
(shadow sort flyspell ispell mail-extr emacsbug sendmail notmuch hl-line
notmuch-message notmuch-maildir-fcc notmuch-hello edmacro kmacro
wid-edit notmuch-tree notmuch-show notmuch-print notmuch-crypto
notmuch-mua notmuch-address notmuch-company notmuch-parser notmuch-wash
diff-mode easy-mmode coolj notmuch-query goto-addr thingatpt icalendar
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs notmuch-tag crm
notmuch-lib notmuch-version cl message idna dired format-spec rfc822 mml
mailabbrev mail-utils gmm-utils mailheader mm-view mml-smime mml-sec
password-cache epg gnus-util smime mel mime-def alist mcharset mcs-20
mcs-e20 pces pces-e20 pces-20 broken pcustom path-util poe pym static
apel-ver product mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr warnings
server time-date finder-inf package epg-config seq byte-opt gv bytecomp
byte-compile cl-extra help-mode easymenu cconv viper viper-ex viper-macs
viper-mous viper-cmd viper-keym ring viper-util viper-init advice
proof-site proof-autoloads pg-vars haskell-mode-autoloads cc-styles
cc-align cc-engine cc-vars cc-defs cl-loaddefs pcase cl-lib mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 208677 7152)
 (symbols 48 31752 0)
 (miscs 40 214 946)
 (strings 32 52762 7347)
 (string-bytes 1 1545196)
 (vectors 16 24034)
 (vector-slots 8 573560 5264)
 (floats 8 217 6)
 (intervals 56 543 318)
 (buffers 976 158))