unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
@ 2017-03-29 12:15 Torsten Bronger
  2017-08-14 20:33 ` Toon Claes
  0 siblings, 1 reply; 22+ messages in thread
From: Torsten Bronger @ 2017-03-29 12:15 UTC (permalink / raw)
  To: 26298


If I sign an email with C-c RET s o and try to send it, Emacs aborts
with the following backtrace:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  mml1991-epg-sign((part (sign . "pgp") (tag-location . 845) (contents . "asdsd\n-- \nTorsten Bronger\n")))
  mml1991-sign((part (sign . "pgp") (tag-location . 845) (contents . "asdsd\n-- \nTorsten Bronger\n")))
  (or (mml1991-sign cont) (error "Signing failed... inspect message logs for errors"))
  mml-pgp-sign-buffer((part (sign . "pgp") (tag-location . 845) (contents . "asdsd\n-- \nTorsten Bronger\n")))
  mml-generate-mime-1((part (sign . "pgp") (tag-location . 845) (contents . "asdsd\n-- \nTorsten Bronger\n")))
  mml-generate-mime()
  message-encode-message-body()
  message-send-mail(nil)
  message-send-via-mail(nil)
  message-send(nil)
  message-send-and-exit(nil)
  funcall-interactively(message-send-and-exit nil)
  call-interactively(message-send-and-exit nil nil)
  command-execute(message-send-and-exit)



In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu)
 of 2017-03-20 built on wilson
Repository revision: 09d50834206ff48bf6ac214e8cfb31d281ba993c
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.1 LTS

Recent messages:
Sending...
Mark set [2 times]
Entering debugger...
Auto-saving...done
Quit [4 times]
Making completion list...
Quit
Mark set
next-line: End of buffer [2 times]
Making completion list...

Configured using:
 'configure --prefix=/usr/local/ --mandir=/usr/local/share/man/
 --infodir=/usr/local/share/info/ --with-x-toolkit=no --without-makeinfo
 --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-x'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY GNUTLS LIBXML2
FREETYPE XFT ZLIB X11

Important settings:
  value of $EMACSLOADPATH: /home/bronger/.emacs.d/lisp:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  diff-auto-refine-mode: t
  global-auto-revert-mode: t
  shell-dirtrack-mode: t
  savehist-mode: t
  desktop-save-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Load-path shadows:
/home/bronger/.emacs.d/lisp/visual-basic-mode hides /home/bronger/.emacs.d/lisp/nxhtml/related/visual-basic-mode
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/snippets/prog-mode/.yas-setup
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/snippets/python-mode/.yas-setup
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/html-mode/.yas-setup
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/objc-mode/.yas-setup
/home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/html-mode/.yasmate-extra-substitutions hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/rails-mode/.yasmate-extra-substitutions
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/rails-mode/.yas-setup
/home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/html-mode/.yasmate-extra-substitutions hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/ruby-mode/.yasmate-extra-substitutions
/home/bronger/.emacs.d/lisp/yasnippet/snippets/fundamental-mode/.yas-setup hides /home/bronger/.emacs.d/lisp/yasnippet/yasmate/snippets/ruby-mode/.yas-setup
/home/bronger/.emacs.d/lisp/mmm/mmm-noweb hides /usr/local/share/emacs/site-lisp/mmm-noweb
/home/bronger/.emacs.d/lisp/po-mode hides /usr/local/share/emacs/site-lisp/po-mode
/home/bronger/.emacs.d/lisp/mmm/mmm-erb hides /usr/local/share/emacs/site-lisp/mmm-erb
/home/bronger/.emacs.d/lisp/browse-kill-ring hides /usr/local/share/emacs/site-lisp/browse-kill-ring
/home/bronger/.emacs.d/lisp/mmm/mmm-vars hides /usr/local/share/emacs/site-lisp/mmm-vars
/home/bronger/.emacs.d/lisp/mmm/mmm-cweb hides /usr/local/share/emacs/site-lisp/mmm-cweb
/home/bronger/.emacs.d/lisp/mmm/mmm-auto hides /usr/local/share/emacs/site-lisp/mmm-auto
/home/bronger/.emacs.d/lisp/mmm/mmm-rpm hides /usr/local/share/emacs/site-lisp/mmm-rpm
/home/bronger/.emacs.d/lisp/mmm/mmm-univ hides /usr/local/share/emacs/site-lisp/mmm-univ
/home/bronger/.emacs.d/lisp/mmm/mmm-mode hides /usr/local/share/emacs/site-lisp/mmm-mode
/home/bronger/.emacs.d/lisp/mmm/mmm-sample hides /usr/local/share/emacs/site-lisp/mmm-sample
/home/bronger/.emacs.d/lisp/mmm/mmm-region hides /usr/local/share/emacs/site-lisp/mmm-region
/home/bronger/.emacs.d/lisp/mmm/mmm-class hides /usr/local/share/emacs/site-lisp/mmm-class
/home/bronger/.emacs.d/lisp/auctex hides /usr/local/share/emacs/site-lisp/auctex
/home/bronger/.emacs.d/lisp/mmm/mmm-cmds hides /usr/local/share/emacs/site-lisp/mmm-cmds
/home/bronger/.emacs.d/lisp/mmm/mmm-compat hides /usr/local/share/emacs/site-lisp/mmm-compat
/home/bronger/.emacs.d/lisp/mmm/mmm-utils hides /usr/local/share/emacs/site-lisp/mmm-utils
/home/bronger/.emacs.d/lisp/mmm/mmm-mason hides /usr/local/share/emacs/site-lisp/mmm-mason
/home/bronger/.emacs.d/lisp/mmm/mmm-myghty hides /usr/local/share/emacs/site-lisp/mmm-myghty
/home/bronger/.emacs.d/lisp/tex-site hides /usr/local/share/emacs/site-lisp/tex-site
/home/bronger/.emacs.d/lisp/preview-latex hides /usr/local/share/emacs/site-lisp/preview-latex
/home/bronger/.emacs.d/lisp/bbdb/bbdb-xemacs hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-xemacs
/home/bronger/.emacs.d/lisp/bbdb/bbdb hides /usr/local/share/emacs/site-lisp/bbdb/bbdb
/home/bronger/.emacs.d/lisp/bbdb/bbdb-whois hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-whois
/home/bronger/.emacs.d/lisp/bbdb/bbdb-gnus hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-gnus
/home/bronger/.emacs.d/lisp/bbdb/bbdb-sc hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-sc
/home/bronger/.emacs.d/lisp/bbdb/bbdb-merge hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-merge
/home/bronger/.emacs.d/lisp/bbdb/bbdb-autoloads hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-autoloads
/home/bronger/.emacs.d/lisp/bbdb/bbdb-hooks hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-hooks
/home/bronger/.emacs.d/lisp/bbdb/bbdb-com hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-com
/home/bronger/.emacs.d/lisp/bbdb/bbdb-print hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-print
/home/bronger/.emacs.d/lisp/bbdb/bbdb-migrate hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-migrate
/home/bronger/.emacs.d/lisp/bbdb/bbdb-reportmail hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-reportmail
/home/bronger/.emacs.d/lisp/bbdb/bbdb-vm hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-vm
/home/bronger/.emacs.d/lisp/bbdb/bbdb-gui hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-gui
/home/bronger/.emacs.d/lisp/bbdb/bbdb-ftp hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-ftp
/home/bronger/.emacs.d/lisp/bbdb/bbdb-w3 hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-w3
/home/bronger/.emacs.d/lisp/bbdb/bbdb-srv hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-srv
/home/bronger/.emacs.d/lisp/bbdb/bbdb-snarf hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-snarf
/home/bronger/.emacs.d/lisp/bbdb/bbdb-rmail hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-rmail
/home/bronger/.emacs.d/lisp/bbdb/bbdb-mhe hides /usr/local/share/emacs/site-lisp/bbdb/bbdb-mhe
/home/bronger/.emacs.d/lisp/w3m/w3m-cookie hides /usr/local/share/emacs/site-lisp/w3m/w3m-cookie
/home/bronger/.emacs.d/lisp/w3m/w3m-bug hides /usr/local/share/emacs/site-lisp/w3m/w3m-bug
/home/bronger/.emacs.d/lisp/w3m/bookmark-w3m hides /usr/local/share/emacs/site-lisp/w3m/bookmark-w3m
/home/bronger/.emacs.d/lisp/w3m/w3m-symbol hides /usr/local/share/emacs/site-lisp/w3m/w3m-symbol
/home/bronger/.emacs.d/lisp/w3m/w3m-bookmark hides /usr/local/share/emacs/site-lisp/w3m/w3m-bookmark
/home/bronger/.emacs.d/lisp/w3m/w3m-mail hides /usr/local/share/emacs/site-lisp/w3m/w3m-mail
/home/bronger/.emacs.d/lisp/w3m/w3m-session hides /usr/local/share/emacs/site-lisp/w3m/w3m-session
/home/bronger/.emacs.d/lisp/w3m/w3m-lnum hides /usr/local/share/emacs/site-lisp/w3m/w3m-lnum
/home/bronger/.emacs.d/lisp/w3m/w3m-util hides /usr/local/share/emacs/site-lisp/w3m/w3m-util
/home/bronger/.emacs.d/lisp/w3m/w3m hides /usr/local/share/emacs/site-lisp/w3m/w3m
/home/bronger/.emacs.d/lisp/w3m/w3m-search hides /usr/local/share/emacs/site-lisp/w3m/w3m-search
/home/bronger/.emacs.d/lisp/w3m/w3m-image hides /usr/local/share/emacs/site-lisp/w3m/w3m-image
/home/bronger/.emacs.d/lisp/w3m/w3m-load hides /usr/local/share/emacs/site-lisp/w3m/w3m-load
/home/bronger/.emacs.d/lisp/w3m/w3m-dtree hides /usr/local/share/emacs/site-lisp/w3m/w3m-dtree
/home/bronger/.emacs.d/lisp/w3m/w3m-ccl hides /usr/local/share/emacs/site-lisp/w3m/w3m-ccl
/home/bronger/.emacs.d/lisp/w3m/w3m-weather hides /usr/local/share/emacs/site-lisp/w3m/w3m-weather
/home/bronger/.emacs.d/lisp/w3m/w3m-tabmenu hides /usr/local/share/emacs/site-lisp/w3m/w3m-tabmenu
/home/bronger/.emacs.d/lisp/w3m/w3m-form hides /usr/local/share/emacs/site-lisp/w3m/w3m-form
/home/bronger/.emacs.d/lisp/w3m/w3m-perldoc hides /usr/local/share/emacs/site-lisp/w3m/w3m-perldoc
/home/bronger/.emacs.d/lisp/w3m/w3m-namazu hides /usr/local/share/emacs/site-lisp/w3m/w3m-namazu
/home/bronger/.emacs.d/lisp/w3m/w3m-rss hides /usr/local/share/emacs/site-lisp/w3m/w3m-rss
/home/bronger/.emacs.d/lisp/w3m/w3m-favicon hides /usr/local/share/emacs/site-lisp/w3m/w3m-favicon
/home/bronger/.emacs.d/lisp/w3m/mime-w3m hides /usr/local/share/emacs/site-lisp/w3m/mime-w3m
/home/bronger/.emacs.d/lisp/w3m/w3m-antenna hides /usr/local/share/emacs/site-lisp/w3m/w3m-antenna
/home/bronger/.emacs.d/lisp/w3m/w3m-hist hides /usr/local/share/emacs/site-lisp/w3m/w3m-hist
/home/bronger/.emacs.d/lisp/w3m/w3m-filter hides /usr/local/share/emacs/site-lisp/w3m/w3m-filter
/home/bronger/.emacs.d/lisp/w3m/w3m-proc hides /usr/local/share/emacs/site-lisp/w3m/w3m-proc
/home/bronger/.emacs.d/lisp/w3m/octet hides /usr/local/share/emacs/site-lisp/w3m/octet
/home/bronger/.emacs.d/lisp/w3m/w3m-ucs hides /usr/local/share/emacs/site-lisp/w3m/w3m-ucs
/home/bronger/.emacs.d/lisp/w3m/mew-w3m hides /usr/local/share/emacs/site-lisp/w3m/mew-w3m
/home/bronger/.emacs.d/lisp/w3m/w3m-ems hides /usr/local/share/emacs/site-lisp/w3m/w3m-ems
/home/bronger/.emacs.d/lisp/w3m/w3m-fb hides /usr/local/share/emacs/site-lisp/w3m/w3m-fb

Features:
(shadow emacsbug sendmail misearch multi-isearch eieio-opt speedbar
sb-image ezimage dframe help-fns radix-tree debug mml1991 nnir
gnus-picon sort smiley gnus-cite gnus-async gnus-bcklg gnus-draft
gnus-ml disp-table nndraft nnmh gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg nnml nnfolder gnus-cache bbdb-gnus
bbdb-snarf mail-extr bbdb-com warnings network-stream nsm starttls nntp
gnus-topic add-log gmane gnus-art mm-uu mml2015 mm-view mml-smime smime
dig gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls gnutls utf7 netrc nnoo gnus-spec gnus-int gnus-range
message rfc822 mml mml-sec epa epg mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win vc-cvs
go-oracle flyspell ispell conf-mode js moz imenu cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
css-mode eww puny mm-url gnus nnheader url-queue shr svg rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap sgml-mode dom nxml-util nxml-enc xmltok hideshow
dired-aux reftex-dcr reftex reftex-loaddefs reftex-vars font-latex
latexenc vc-git diff-mode python tramp-sh json map darkroom cql-mode sql
view rust-mode swift-mode go-errcheck go-mode url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap find-file ffap thingatpt etags xref project yaml-mode
dockerfile-mode derived rx sh-script smie executable dired-x
adaptive-wrap vc-dispatcher vc-bzr org-element org-rmail org-mhe org-irc
org-info org-gnus gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums mail-utils org-docview org-bibtex bibtex org-bbdb org-w3m
org-agenda ob-python org org-macro org-footnote org-pcomplete org-list
org-faces org-entities noutline outline org-version ob-emacs-lisp ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint
ob-core ob-eval org-compat org-macs org-loaddefs find-func server w3m
browse-url doc-view subr-x jka-compr dired dired-loaddefs image-mode
w3m-hist w3m-fb bookmark-w3m w3m-ems wid-edit w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util rst compile browse-kill-ring mmm-mode
mmm-univ mmm-class mmm-region mmm-auto mmm-vars mmm-utils mmm-compat cl
bbdb-autoloads bbdb timezone cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs appt diary-lib diary-loaddefs
cal-menu calendar cal-loaddefs preview prv-emacs info reporter latex
easy-mmode tex-style tex-buf tex dbus xml mm-util mail-prsvr autorevert
filenotify preview-latex tex-site auto-loads edmacro kmacro tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
comint ansi-color ring parse-time format-spec advice savehist desktop
frameset delsel cus-start cus-load finder-inf package epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors 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 composite charscript case-table
epa-hook jka-cmpr-hook help simple abbrev obarray 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 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 871277 112392)
 (symbols 48 136658 1)
 (miscs 40 8775 673)
 (strings 32 201286 28052)
 (string-bytes 1 6150598)
 (vectors 16 80569)
 (vector-slots 8 1398799 46356)
 (floats 8 1890 586)
 (intervals 56 27999 212)
 (buffers 976 407)
 (heap 1024 99104 3681))

-- 
Torsten Bronger





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-03-29 12:15 bug#26298: 26.0.50; Gnus fails to sign mail with PGP Torsten Bronger
@ 2017-08-14 20:33 ` Toon Claes
  2017-08-14 21:19   ` Toon Claes
  0 siblings, 1 reply; 22+ messages in thread
From: Toon Claes @ 2017-08-14 20:33 UTC (permalink / raw)
  To: Torsten Bronger; +Cc: 26298

Torsten Bronger <bronger@physik.rwth-aachen.de> writes:

> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p
> nil)

I've been digging deeper into this bug.

What I've found so far, `epg-start-sign' (or `epg-wait-for-completion',
I am not sure) called in `epg-sign-string' is failing with the error:

  gpg: signing failed: Inappropriate ioctl for device

I have to stop digging for today, but I'd like to know why
`epg-sign-string' fails to get passphrase, while `epa-sign-file'
succeeds.


-- Toon





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-14 20:33 ` Toon Claes
@ 2017-08-14 21:19   ` Toon Claes
  2017-08-14 23:46     ` npostavs
  2018-04-29 14:38     ` Noam Postavsky
  0 siblings, 2 replies; 22+ messages in thread
From: Toon Claes @ 2017-08-14 21:19 UTC (permalink / raw)
  To: Torsten Bronger; +Cc: 26298

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]


I have found what is happening.

If I add the following line to `mml-secure-epg-sign', I can successfully
sign my email:

#+begin_src emacs-lisp :tangle yes
    (setf (epg-context-pinentry-mode context) 'loopback)
#+end_src

Now I also understand why `epa-sign-file' works, I have set
`(setq epa-pinentry-mode 'loopback)' in my init.el.

But, I could use some advice on building a proper fix that would work
for everyone. We could do something similar like as epa.el does, and add
yet another defcustom, but doesn't feel very DRY.
So I hope someone can chime in to give some advice.


-- Toon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-14 21:19   ` Toon Claes
@ 2017-08-14 23:46     ` npostavs
  2017-08-15  5:54       ` Toon Claes
  2018-04-29 14:38     ` Noam Postavsky
  1 sibling, 1 reply; 22+ messages in thread
From: npostavs @ 2017-08-14 23:46 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Torsten Bronger

Toon Claes <toon@iotcl.com> writes:

> I have found what is happening.
>
> If I add the following line to `mml-secure-epg-sign', I can successfully
> sign my email:
>
> #+begin_src emacs-lisp :tangle yes
>     (setf (epg-context-pinentry-mode context) 'loopback)
> #+end_src
>
> Now I also understand why `epa-sign-file' works, I have set
> `(setq epa-pinentry-mode 'loopback)' in my init.el.
>
> But, I could use some advice on building a proper fix that would work
> for everyone. We could do something similar like as epa.el does, and add
> yet another defcustom, but doesn't feel very DRY.
> So I hope someone can chime in to give some advice.

Does the patch at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14
help?  Maybe not since it doesn't look like mml1991.el calls
epg-context-set-passphrase-callback, although mml2015.el does.  Perhaps
mml1991.el should too?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-14 23:46     ` npostavs
@ 2017-08-15  5:54       ` Toon Claes
  2017-08-15 15:23         ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Toon Claes @ 2017-08-15  5:54 UTC (permalink / raw)
  To: npostavs; +Cc: 26298, Torsten Bronger

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

npostavs@users.sourceforge.net writes:

> Does the patch at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14
> help?  Maybe not since it doesn't look like mml1991.el calls
> epg-context-set-passphrase-callback, although mml2015.el does.  Perhaps
> mml1991.el should too?

Well, actually it does help. The signing goes through mml2015.el and not
through mml1991.el. Or, at least in my setup it does.


-- Toon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-15  5:54       ` Toon Claes
@ 2017-08-15 15:23         ` Noam Postavsky
  2018-01-28 19:39           ` Toon Claes
  0 siblings, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2017-08-15 15:23 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Torsten Bronger

On Tue, Aug 15, 2017 at 1:54 AM, Toon Claes <toon@iotcl.com> wrote:
> npostavs@users.sourceforge.net writes:
>
>> Does the patch at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14
>> help?  Maybe not since it doesn't look like mml1991.el calls
>> epg-context-set-passphrase-callback, although mml2015.el does.  Perhaps
>> mml1991.el should too?
>
> Well, actually it does help. The signing goes through mml2015.el and not
> through mml1991.el. Or, at least in my setup it does.

Okay, I don't really know how it works, I assumed mml1991.el is used
based on mml1991-sign showing up in the OP's backtrace.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-15 15:23         ` Noam Postavsky
@ 2018-01-28 19:39           ` Toon Claes
  2018-01-28 21:23             ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Toon Claes @ 2018-01-28 19:39 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 26298, Torsten Bronger

On Tue, Aug 15, 2017 at 1:54 AM, Toon Claes <toon@iotcl.com> wrote:
> npostavs@users.sourceforge.net writes:
>
>> Does the patch at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14
>> help?
>
> Well, actually it does help.

One thing though, with this patch, if I enter the incorrect passphrase,
it gives me an error:

    Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
      mml2015-epg-sign((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))
      mml2015-sign((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))
      mml-pgpmime-sign-buffer((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))
      mml-generate-mime-1((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))
      mml-generate-mime()
      message-encode-message-body()
      message-send-mail(nil)
      message-send-via-mail(nil)
      message-send(nil)
      message-send-and-exit(nil)
      funcall-interactively(message-send-and-exit nil)
      call-interactively(message-send-and-exit nil nil)
      command-execute(message-send-and-exit)

When I try again instantly, it does not ask me for the passphrase and
just pops up the same error. When I wait for, I think, about 10 seconds
to retry, it asks for a passphrase again.

I'm not sure it's related to this bug, or is a separate bug.

-- Toon





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-01-28 19:39           ` Toon Claes
@ 2018-01-28 21:23             ` Noam Postavsky
  2018-04-11 22:06               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2018-01-28 21:23 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Torsten Bronger

Toon Claes <toon@iotcl.com> writes:

> On Tue, Aug 15, 2017 at 1:54 AM, Toon Claes <toon@iotcl.com> wrote:
>> npostavs@users.sourceforge.net writes:
>>
>>> Does the patch at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14
>>> help?
>>
>> Well, actually it does help.
>
> One thing though, with this patch, if I enter the incorrect passphrase,
> it gives me an error:
>
>     Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
>       mml2015-epg-sign((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))
>       mml2015-sign((part (sign . "pgpmime") (tag-location . 803) (contents . "<redacted>")))

I can't reproduce the original bug, but this I can, although with
mml1991 (not clear to me how this get's chosen).  I think it's just a
matter of making the error a bit clearer, e.g.:

--- i/lisp/gnus/mml1991.el
+++ w/lisp/gnus/mml1991.el
@@ -277,6 +277,8 @@ mml1991-epg-sign
 	(mm-decode-content-transfer-encoding cte)))
     (let* ((pair (mml-secure-epg-sign 'OpenPGP 'clear))
 	   (signature (car pair)))
+      (unless (stringp signature)
+        (error "Signature failed"))
       (delete-region (point-min) (point-max))
       (insert
        (with-temp-buffer
diff --git i/lisp/gnus/mml2015.el w/lisp/gnus/mml2015.el
index b220a96098..6baae80309 100644
--- i/lisp/gnus/mml2015.el
+++ w/lisp/gnus/mml2015.el
@@ -958,6 +958,8 @@ mml2015-epg-sign
     (let* ((pair (mml-secure-epg-sign 'OpenPGP t))
 	   (signature (car pair))
 	   (micalg (cdr pair)))
+      (unless (stringp signature)
+        (error "Signature failed"))
       (goto-char (point-min))
       (insert (format "Content-Type: multipart/signed; boundary=\"%s\";\n"
 		      boundary))

> When I try again instantly, it does not ask me for the passphrase and
> just pops up the same error. When I wait for, I think, about 10 seconds
> to retry, it asks for a passphrase again.

Hmm, I can't reproduce this one, I guess it's related to gpg version (I
have 2.1.18) and how the caching works.





^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-01-28 21:23             ` Noam Postavsky
@ 2018-04-11 22:06               ` Lars Ingebrigtsen
  2018-04-12  7:25                 ` Noam Postavsky
  2018-04-14  6:52                 ` Toon Claes
  0 siblings, 2 replies; 22+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-11 22:06 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Toon Claes, 26298, Torsten Bronger

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> I can't reproduce the original bug, but this I can, although with
> mml1991 (not clear to me how this get's chosen).  I think it's just a
> matter of making the error a bit clearer, e.g.:
>
> --- i/lisp/gnus/mml1991.el
> +++ w/lisp/gnus/mml1991.el
> @@ -277,6 +277,8 @@ mml1991-epg-sign
>  	(mm-decode-content-transfer-encoding cte)))
>      (let* ((pair (mml-secure-epg-sign 'OpenPGP 'clear))
>  	   (signature (car pair)))
> +      (unless (stringp signature)
> +        (error "Signature failed"))
>        (delete-region (point-min) (point-max))
>        (insert
>         (with-temp-buffer

I've applied this patch to Emacs 27.1.

I don't do any signing, so the rest of this thread was greek to me.  :-)
Were the other issues worked out?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-11 22:06               ` Lars Ingebrigtsen
@ 2018-04-12  7:25                 ` Noam Postavsky
  2018-04-12 11:37                   ` Lars Ingebrigtsen
  2018-04-14  6:52                 ` Toon Claes
  1 sibling, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2018-04-12  7:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Toon Claes, 26298, Torsten Bronger

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I don't do any signing, so the rest of this thread was greek to me.  :-)
> Were the other issues worked out?

I haven't applied the loopback patch, because I'm not entirely sure if
it's the right thing (see also Bug#30363).  But maybe the best way to
find out is to push to master and see if it causes anyone problems...

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30363#14





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-12  7:25                 ` Noam Postavsky
@ 2018-04-12 11:37                   ` Lars Ingebrigtsen
  2018-04-12 12:45                     ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-12 11:37 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Toon Claes, 26298, Torsten Bronger

Noam Postavsky <npostavs@gmail.com> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> I don't do any signing, so the rest of this thread was greek to me.  :-)
>> Were the other issues worked out?
>
> I haven't applied the loopback patch, because I'm not entirely sure if
> it's the right thing (see also Bug#30363).  But maybe the best way to
> find out is to push to master and see if it causes anyone problems...
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30363#14

Should these two bug reports be merged?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-12 11:37                   ` Lars Ingebrigtsen
@ 2018-04-12 12:45                     ` Noam Postavsky
  0 siblings, 0 replies; 22+ messages in thread
From: Noam Postavsky @ 2018-04-12 12:45 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Toon Claes, 26298, Torsten Bronger

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>
>>> I don't do any signing, so the rest of this thread was greek to me.  :-)
>>> Were the other issues worked out?
>>
>> I haven't applied the loopback patch, because I'm not entirely sure if
>> it's the right thing (see also Bug#30363).  But maybe the best way to
>> find out is to push to master and see if it causes anyone problems...
>>
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30363#14
>
> Should these two bug reports be merged?

I don't think so, the other one is mainly about epa-decrypt-file, and
just incidentally mentions mml at the end.






^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-11 22:06               ` Lars Ingebrigtsen
  2018-04-12  7:25                 ` Noam Postavsky
@ 2018-04-14  6:52                 ` Toon Claes
  2018-04-14 13:12                   ` Lars Ingebrigtsen
  2018-04-14 13:15                   ` Lars Ingebrigtsen
  1 sibling, 2 replies; 22+ messages in thread
From: Toon Claes @ 2018-04-14  6:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 26298, Noam Postavsky, Torsten Bronger

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Noam Postavsky <npostavs@users.sourceforge.net> writes:
>
>> --- i/lisp/gnus/mml1991.el
>> +++ w/lisp/gnus/mml1991.el
>> @@ -277,6 +277,8 @@ mml1991-epg-sign
>>  	(mm-decode-content-transfer-encoding cte)))
>>      (let* ((pair (mml-secure-epg-sign 'OpenPGP 'clear))
>>  	   (signature (car pair)))
>> +      (unless (stringp signature)
>> +        (error "Signature failed"))
>>        (delete-region (point-min) (point-max))
>>        (insert
>>         (with-temp-buffer
>
> I've applied this patch to Emacs 27.1.

I've built 20c6a516ec (which contains ef2059e877), and now I'm getting
"Signature failed" whenever I'm trying to sign an email. Independent if
my passphrase was correct or not. As a matter of fact, it no longer
giving me the possibility to fill in my passphrase in the minibuffer.

So I'm getting a proper error now, but my original problem is not
resolved.

TBH I'm getting a bit lost in the maze of bugs:

- #26298: (this one)
- #30363: epa-decrypt-file not using epa-pinentry-mode
- #23619: Some epg tests fail

Anyway, the patch provided in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14 does solve my
problem. But as Noam mentioned, I am not sure "it's the right thing".


-- Toon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-14  6:52                 ` Toon Claes
@ 2018-04-14 13:12                   ` Lars Ingebrigtsen
  2018-04-14 13:36                     ` Toon Claes
  2018-04-14 13:15                   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 22+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-14 13:12 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Noam Postavsky, Torsten Bronger

Toon Claes <toon@iotcl.com> writes:

> I've built 20c6a516ec (which contains ef2059e877), and now I'm getting
> "Signature failed" whenever I'm trying to sign an email. Independent if
> my passphrase was correct or not. As a matter of fact, it no longer
> giving me the possibility to fill in my passphrase in the minibuffer.

OK, I'll revert that patch.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-14  6:52                 ` Toon Claes
  2018-04-14 13:12                   ` Lars Ingebrigtsen
@ 2018-04-14 13:15                   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 22+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-14 13:15 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Noam Postavsky, Torsten Bronger

Toon Claes <toon@iotcl.com> writes:

> So I'm getting a proper error now, but my original problem is not
> resolved.
>
> TBH I'm getting a bit lost in the maze of bugs:
>
> - #26298: (this one)
> - #30363: epa-decrypt-file not using epa-pinentry-mode
> - #23619: Some epg tests fail

Me too.  :-)

> Anyway, the patch provided in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23619#14 does solve my
> problem. But as Noam mentioned, I am not sure "it's the right thing".

Well, I don't use signing at all, so I shouldn't really be poking my
head in here, and I'll leave applying the patches to somebody who knows
what they're doing.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-14 13:12                   ` Lars Ingebrigtsen
@ 2018-04-14 13:36                     ` Toon Claes
  2018-04-14 13:54                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 22+ messages in thread
From: Toon Claes @ 2018-04-14 13:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 26298, Noam Postavsky, Torsten Bronger


> On 14 Apr 2018, at 15:12, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> 
> OK, I'll revert that patch.

Oh sorry, I don’t think that’s needed. I wasn’t really clear. But without the patch I couldn’t either fill in the passphrase. The only difference, now I’m getting a nice error instead of a backtrace. 

— Toon






^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-14 13:36                     ` Toon Claes
@ 2018-04-14 13:54                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 22+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-14 13:54 UTC (permalink / raw)
  To: Toon Claes; +Cc: 26298, Noam Postavsky, Torsten Bronger

Toon Claes <toon@iotcl.com> writes:

>> On 14 Apr 2018, at 15:12, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>> 
>> OK, I'll revert that patch.
>
> Oh sorry, I don’t think that’s needed. I wasn’t really clear. But
> without the patch I couldn’t either fill in the passphrase. The only
> difference, now I’m getting a nice error instead of a backtrace.

Oh, I misunderstood.  I thought you said that you got that error message
even when you signed successfully.

I guess I'll un-revert the reversion.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2017-08-14 21:19   ` Toon Claes
  2017-08-14 23:46     ` npostavs
@ 2018-04-29 14:38     ` Noam Postavsky
  2018-05-17 23:41       ` Noam Postavsky
  1 sibling, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2018-04-29 14:38 UTC (permalink / raw)
  To: Toon Claes; +Cc: Joseph Mingrone, 26298, Torsten Bronger

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

Toon Claes <toon@iotcl.com> writes:
> If I add the following line to `mml-secure-epg-sign', I can successfully
> sign my email:
>
> #+begin_src emacs-lisp :tangle yes
>     (setf (epg-context-pinentry-mode context) 'loopback)
> #+end_src
>
> Now I also understand why `epa-sign-file' works, I have set
> `(setq epa-pinentry-mode 'loopback)' in my init.el.
>
> But, I could use some advice on building a proper fix that would work
> for everyone. We could do something similar like as epa.el does, and add
> yet another defcustom, but doesn't feel very DRY.
> So I hope someone can chime in to give some advice.

So perhaps the best solution is simply rename epa-pinentry-mode to
epg-pinentry-mode, and use it is as the default
epg-context-pinentry-mode value (see attached).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3013 bytes --]

From 937c2cf8a751bbc7581a0ca187f4cac023e607b3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 29 Apr 2018 10:32:03 -0400
Subject: [PATCH v1] Move epa-pinentry-mode to epg-config (Bug#26298)

* lisp/epa.el (epa-pinentry-mode): Make into obsolete alias for...
* lisp/epg-config.el (epg-pinentry-mode): ...this new user option.
* lisp/epg.el (epg-context): Use it as the default value for
pinentry-mode.
---
 lisp/epa.el        | 23 ++---------------------
 lisp/epg-config.el | 22 ++++++++++++++++++++++
 lisp/epg.el        |  2 +-
 3 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 5c237bca9b..e03933af30 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -56,27 +56,8 @@ epa-info-window-height
   :type 'integer
   :group 'epa)
 
-;; In the doc string below, we say "symbol `error'" to avoid producing
-;; a hyperlink for `error' the function.
-(defcustom epa-pinentry-mode nil
-  "The pinentry mode.
-
-GnuPG 2.1 or later has an option to control the behavior of
-Pinentry invocation.  The value should be the symbol `error',
-`ask', `cancel', or `loopback'.  See the GnuPG manual for the
-meanings.
-
-In epa commands, a particularly useful mode is `loopback', which
-redirects all Pinentry queries to the caller, so Emacs can query
-passphrase through the minibuffer, instead of external Pinentry
-program."
-  :type '(choice (const nil)
-		 (const ask)
-		 (const cancel)
-		 (const error)
-		 (const loopback))
-  :group 'epa
-  :version "25.1")
+(define-obsolete-variable-alias
+  'epa-entry-mode 'epg-entry-mode "27.1")
 
 (defgroup epa-faces nil
   "Faces for epa-mode."
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index d30ebea2d6..ea57adc12f 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -74,6 +74,28 @@ epg-passphrase-coding-system
   :group 'epg
   :type 'symbol)
 
+
+;; In the doc string below, we say "symbol `error'" to avoid producing
+;; a hyperlink for `error' the function.
+(defcustom epg-pinentry-mode nil
+  "The pinentry mode.
+
+GnuPG 2.1 or later has an option to control the behavior of
+Pinentry invocation.  The value should be the symbol `error',
+`ask', `cancel', or `loopback'.  See the GnuPG manual for the
+meanings.
+
+A particularly useful mode is `loopback', which redirects all
+Pinentry queries to the caller, so Emacs can query passphrase
+through the minibuffer, instead of external Pinentry program."
+  :type '(choice (const nil)
+		 (const ask)
+		 (const cancel)
+		 (const error)
+		 (const loopback))
+  :group 'epa
+  :version "27.1")
+
 (defcustom epg-debug nil
   "If non-nil, debug output goes to the \" *epg-debug*\" buffer.
 Note that the buffer name starts with a space."
diff --git a/lisp/epg.el b/lisp/epg.el
index dc0e2df583..c42520e3db 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -211,7 +211,7 @@ epg--gv-nreverse
   output-file
   result
   operation
-  pinentry-mode
+  (pinentry-mode epg-pinentry-mode)
   (error-output "")
   error-buffer)
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-04-29 14:38     ` Noam Postavsky
@ 2018-05-17 23:41       ` Noam Postavsky
  2018-05-18  9:55         ` Basil L. Contovounesios
  0 siblings, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2018-05-17 23:41 UTC (permalink / raw)
  To: Toon Claes; +Cc: Joseph Mingrone, 26298, Torsten Bronger

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

Noam Postavsky <npostavs@gmail.com> writes:

> So perhaps the best solution is simply rename epa-pinentry-mode to
> epg-pinentry-mode, and use it is as the default
> epg-context-pinentry-mode value (see attached).

Here's a more complete patch.  I will push to master in a few days.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 6879 bytes --]

From 034448c4d8e1adf85ef599e8612cdb1386433b09 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 29 Apr 2018 10:32:03 -0400
Subject: [PATCH v2] Move epa-pinentry-mode to epg-config (Bug#26298)

* lisp/epa.el (epa-pinentry-mode): Make into obsolete alias for...
* lisp/epg-config.el (epg-pinentry-mode): ...this new user option.
* lisp/epg.el (epg-context): Use it as the default value for
pinentry-mode.
* etc/NEWS: Announce name change.

* lisp/epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region):
* lisp/epa.el(epa-decrypt-file, epa-sign-file)
(epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Don't change
epg-context-pinentry-mode from the default.
---
 etc/NEWS           |  3 +++
 lisp/epa-file.el   |  2 --
 lisp/epa.el        | 30 ++----------------------------
 lisp/epg-config.el | 22 ++++++++++++++++++++++
 lisp/epg.el        |  2 +-
 5 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c7ffb17ad3..4a4c8f2de4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -442,6 +442,9 @@ are formatted as MIME digests.
 *** 'message-forward-included-headers' has changed its default to
 exclude most headers when forwarding.
 
+** 'epa-pinentry-mode' is renamed to 'epg-pinentry-mode',
+It now applies to epg functions as well as epa functions.
+
 * New Modes and Packages in Emacs 27.1
 
 +++
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 1de2f9ba2d..866a4ae03a 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -147,7 +147,6 @@ epa-file-insert-file-contents
      context
      (cons #'epa-progress-callback-function
 	   (format "Decrypting %s" file)))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (unwind-protect
 	(progn
 	  (if replace
@@ -236,7 +235,6 @@ epa-file-write-region
      (cons #'epa-progress-callback-function
 	   (format "Encrypting %s" file)))
     (setf (epg-context-armor context) epa-armor)
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (condition-case error
 	(setq string
 	      (epg-encrypt-string
diff --git a/lisp/epa.el b/lisp/epa.el
index a375cd6170..b9e7cbbb94 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -56,27 +56,8 @@ epa-info-window-height
   :type 'integer
   :group 'epa)
 
-;; In the doc string below, we say "symbol `error'" to avoid producing
-;; a hyperlink for `error' the function.
-(defcustom epa-pinentry-mode nil
-  "The pinentry mode.
-
-GnuPG 2.1 or later has an option to control the behavior of
-Pinentry invocation.  The value should be the symbol `error',
-`ask', `cancel', or `loopback'.  See the GnuPG manual for the
-meanings.
-
-In epa commands, a particularly useful mode is `loopback', which
-redirects all Pinentry queries to the caller, so Emacs can query
-passphrase through the minibuffer, instead of external Pinentry
-program."
-  :type '(choice (const nil)
-		 (const ask)
-		 (const cancel)
-		 (const error)
-		 (const loopback))
-  :group 'epa
-  :version "25.1")
+(define-obsolete-variable-alias
+  'epa-entry-mode 'epg-entry-mode "27.1")
 
 (defgroup epa-faces nil
   "Faces for epa-mode."
@@ -695,7 +676,6 @@ epa-decrypt-file
 					#'epa-progress-callback-function
 					(format "Decrypting %s..."
 						(file-name-nondirectory decrypt-file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Decrypting %s..." (file-name-nondirectory decrypt-file))
     (condition-case error
 	(epg-decrypt-file context decrypt-file plain-file)
@@ -791,7 +771,6 @@ epa-sign-file
 					#'epa-progress-callback-function
 					(format "Signing %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Signing %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-sign-file context file signature mode)
@@ -822,7 +801,6 @@ epa-encrypt-file
 					#'epa-progress-callback-function
 					(format "Encrypting %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-encrypt-file context file recipients cipher)
@@ -865,7 +843,6 @@ epa-decrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Decrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Decrypting...")
       (condition-case error
 	  (setq plain (epg-decrypt-string context (buffer-substring start end)))
@@ -1070,7 +1047,6 @@ epa-sign-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Signing..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Signing...")
       (condition-case error
 	  (setq signature (epg-sign-string context
@@ -1159,7 +1135,6 @@ epa-encrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Encrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Encrypting...")
       (condition-case error
 	  (setq cipher (epg-encrypt-string context
@@ -1328,7 +1303,6 @@ epa-insert-keys
 ;; 	                                  (cons
 ;; 	                                    #'epa-progress-callback-function
 ;; 	                                    "Signing keys..."))
-;;     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
 ;;     (message "Signing keys...")
 ;;     (epg-sign-keys context keys local)
 ;;     (message "Signing keys...done")))
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index d30ebea2d6..ea57adc12f 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -74,6 +74,28 @@ epg-passphrase-coding-system
   :group 'epg
   :type 'symbol)
 
+
+;; In the doc string below, we say "symbol `error'" to avoid producing
+;; a hyperlink for `error' the function.
+(defcustom epg-pinentry-mode nil
+  "The pinentry mode.
+
+GnuPG 2.1 or later has an option to control the behavior of
+Pinentry invocation.  The value should be the symbol `error',
+`ask', `cancel', or `loopback'.  See the GnuPG manual for the
+meanings.
+
+A particularly useful mode is `loopback', which redirects all
+Pinentry queries to the caller, so Emacs can query passphrase
+through the minibuffer, instead of external Pinentry program."
+  :type '(choice (const nil)
+		 (const ask)
+		 (const cancel)
+		 (const error)
+		 (const loopback))
+  :group 'epa
+  :version "27.1")
+
 (defcustom epg-debug nil
   "If non-nil, debug output goes to the \" *epg-debug*\" buffer.
 Note that the buffer name starts with a space."
diff --git a/lisp/epg.el b/lisp/epg.el
index e6b4af2b36..f79f2046de 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -207,7 +207,7 @@ 'epg-error
   output-file
   result
   operation
-  pinentry-mode
+  (pinentry-mode epg-pinentry-mode)
   (error-output "")
   error-buffer)
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-05-17 23:41       ` Noam Postavsky
@ 2018-05-18  9:55         ` Basil L. Contovounesios
  2018-05-18 13:38           ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Basil L. Contovounesios @ 2018-05-18  9:55 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Joseph Mingrone, Toon Claes, 26298, Torsten Bronger

Noam Postavsky <npostavs@gmail.com> writes:

> * lisp/epa-file.el (epa-file-insert-file-contents)
> (epa-file-write-region):
> * lisp/epa.el(epa-decrypt-file, epa-sign-file)
              ^^
Should there be a space here, or does it not matter?

> diff --git a/etc/NEWS b/etc/NEWS
> index c7ffb17ad3..4a4c8f2de4 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -442,6 +442,9 @@ are formatted as MIME digests.
>  *** 'message-forward-included-headers' has changed its default to
>  exclude most headers when forwarding.
>  
> +** 'epa-pinentry-mode' is renamed to 'epg-pinentry-mode',

Looks like that trailing comma should be a full stop.

> diff --git a/lisp/epa.el b/lisp/epa.el
> index a375cd6170..b9e7cbbb94 100644
> --- a/lisp/epa.el
> +++ b/lisp/epa.el
> @@ -56,27 +56,8 @@ epa-info-window-height
>    :type 'integer
>    :group 'epa)
>  
> -;; In the doc string below, we say "symbol `error'" to avoid producing
> -;; a hyperlink for `error' the function.
> -(defcustom epa-pinentry-mode nil
> -  "The pinentry mode.
> -
> -GnuPG 2.1 or later has an option to control the behavior of
> -Pinentry invocation.  The value should be the symbol `error',
> -`ask', `cancel', or `loopback'.  See the GnuPG manual for the
> -meanings.
> -
> -In epa commands, a particularly useful mode is `loopback', which
> -redirects all Pinentry queries to the caller, so Emacs can query
> -passphrase through the minibuffer, instead of external Pinentry
> -program."
> -  :type '(choice (const nil)
> -		 (const ask)
> -		 (const cancel)
> -		 (const error)
> -		 (const loopback))
> -  :group 'epa
> -  :version "25.1")
> +(define-obsolete-variable-alias
> +  'epa-entry-mode 'epg-entry-mode "27.1")

These should be epa-pinentry-mode and epg-pinentry-mode, respectively,
right?

> diff --git a/lisp/epg-config.el b/lisp/epg-config.el
> index d30ebea2d6..ea57adc12f 100644
> --- a/lisp/epg-config.el
> +++ b/lisp/epg-config.el
> @@ -74,6 +74,28 @@ epg-passphrase-coding-system
>    :group 'epg
>    :type 'symbol)
>  
> +
> +;; In the doc string below, we say "symbol `error'" to avoid producing
> +;; a hyperlink for `error' the function.
> +(defcustom epg-pinentry-mode nil
> +  "The pinentry mode.
> +
> +GnuPG 2.1 or later has an option to control the behavior of
> +Pinentry invocation.  The value should be the symbol `error',
> +`ask', `cancel', or `loopback'.  See the GnuPG manual for the
> +meanings.
> +
> +A particularly useful mode is `loopback', which redirects all
> +Pinentry queries to the caller, so Emacs can query passphrase
> +through the minibuffer, instead of external Pinentry program."
> +  :type '(choice (const nil)
> +		 (const ask)
> +		 (const cancel)
> +		 (const error)
> +		 (const loopback))
> +  :group 'epa
> +  :version "27.1")

Should the :group be changed to 'epg?

-- 
Basil





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-05-18  9:55         ` Basil L. Contovounesios
@ 2018-05-18 13:38           ` Noam Postavsky
  2018-05-23 23:09             ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Noam Postavsky @ 2018-05-18 13:38 UTC (permalink / raw)
  To: Toon Claes; +Cc: Joseph Mingrone, 26298, Torsten Bronger

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
>> * lisp/epa-file.el (epa-file-insert-file-contents)
>> (epa-file-write-region):
>> * lisp/epa.el(epa-decrypt-file, epa-sign-file)
>               ^^
> Should there be a space here, or does it not matter?

>> +** 'epa-pinentry-mode' is renamed to 'epg-pinentry-mode',
>
> Looks like that trailing comma should be a full stop.

>> +(define-obsolete-variable-alias
>> +  'epa-entry-mode 'epg-entry-mode "27.1")
>
> These should be epa-pinentry-mode and epg-pinentry-mode, respectively,
> right?

Oops, thanks for catching these; especially that last one, yikes.

>> +(defcustom epg-pinentry-mode nil

>> +  :group 'epa

> Should the :group be changed to 'epg?

Or we can just remove it altogether since :group defaults to the last
created group.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 6870 bytes --]

From 23caf10d96f14ecc4ec81a8e373001c96b82e5fc Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 29 Apr 2018 10:32:03 -0400
Subject: [PATCH v3] Move epa-pinentry-mode to epg-config (Bug#26298)

* lisp/epa.el (epa-pinentry-mode): Make into obsolete alias for...
* lisp/epg-config.el (epg-pinentry-mode): ...this new user option.
* lisp/epg.el (epg-context): Use it as the default value for
pinentry-mode.
* etc/NEWS: Announce name change.

* lisp/epa-file.el (epa-file-insert-file-contents)
(epa-file-write-region):
* lisp/epa.el (epa-decrypt-file, epa-sign-file)
(epa-encrypt-file, epa-decrypt-region)
(epa-sign-region, epa-encrypt-region): Don't change
epg-context-pinentry-mode from the default.
---
 etc/NEWS           |  3 +++
 lisp/epa-file.el   |  2 --
 lisp/epa.el        | 30 ++----------------------------
 lisp/epg-config.el | 21 +++++++++++++++++++++
 lisp/epg.el        |  2 +-
 5 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c7ffb17ad3..ba9f58a73f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -442,6 +442,9 @@ are formatted as MIME digests.
 *** 'message-forward-included-headers' has changed its default to
 exclude most headers when forwarding.
 
+** 'epa-pinentry-mode' is renamed to 'epg-pinentry-mode'.
+It now applies to epg functions as well as epa functions.
+
 * New Modes and Packages in Emacs 27.1
 
 +++
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 1de2f9ba2d..866a4ae03a 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -147,7 +147,6 @@ epa-file-insert-file-contents
      context
      (cons #'epa-progress-callback-function
 	   (format "Decrypting %s" file)))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (unwind-protect
 	(progn
 	  (if replace
@@ -236,7 +235,6 @@ epa-file-write-region
      (cons #'epa-progress-callback-function
 	   (format "Encrypting %s" file)))
     (setf (epg-context-armor context) epa-armor)
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (condition-case error
 	(setq string
 	      (epg-encrypt-string
diff --git a/lisp/epa.el b/lisp/epa.el
index a375cd6170..16621659a6 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -56,27 +56,8 @@ epa-info-window-height
   :type 'integer
   :group 'epa)
 
-;; In the doc string below, we say "symbol `error'" to avoid producing
-;; a hyperlink for `error' the function.
-(defcustom epa-pinentry-mode nil
-  "The pinentry mode.
-
-GnuPG 2.1 or later has an option to control the behavior of
-Pinentry invocation.  The value should be the symbol `error',
-`ask', `cancel', or `loopback'.  See the GnuPG manual for the
-meanings.
-
-In epa commands, a particularly useful mode is `loopback', which
-redirects all Pinentry queries to the caller, so Emacs can query
-passphrase through the minibuffer, instead of external Pinentry
-program."
-  :type '(choice (const nil)
-		 (const ask)
-		 (const cancel)
-		 (const error)
-		 (const loopback))
-  :group 'epa
-  :version "25.1")
+(define-obsolete-variable-alias
+  'epa-pinentry-mode 'epg-pinentry-mode "27.1")
 
 (defgroup epa-faces nil
   "Faces for epa-mode."
@@ -695,7 +676,6 @@ epa-decrypt-file
 					#'epa-progress-callback-function
 					(format "Decrypting %s..."
 						(file-name-nondirectory decrypt-file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Decrypting %s..." (file-name-nondirectory decrypt-file))
     (condition-case error
 	(epg-decrypt-file context decrypt-file plain-file)
@@ -791,7 +771,6 @@ epa-sign-file
 					#'epa-progress-callback-function
 					(format "Signing %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Signing %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-sign-file context file signature mode)
@@ -822,7 +801,6 @@ epa-encrypt-file
 					#'epa-progress-callback-function
 					(format "Encrypting %s..."
 						(file-name-nondirectory file))))
-    (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
     (message "Encrypting %s..." (file-name-nondirectory file))
     (condition-case error
 	(epg-encrypt-file context file recipients cipher)
@@ -865,7 +843,6 @@ epa-decrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Decrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Decrypting...")
       (condition-case error
 	  (setq plain (epg-decrypt-string context (buffer-substring start end)))
@@ -1070,7 +1047,6 @@ epa-sign-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Signing..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Signing...")
       (condition-case error
 	  (setq signature (epg-sign-string context
@@ -1159,7 +1135,6 @@ epa-encrypt-region
 					 (cons
 					  #'epa-progress-callback-function
 					  "Encrypting..."))
-      (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
       (message "Encrypting...")
       (condition-case error
 	  (setq cipher (epg-encrypt-string context
@@ -1328,7 +1303,6 @@ epa-insert-keys
 ;; 	                                  (cons
 ;; 	                                    #'epa-progress-callback-function
 ;; 	                                    "Signing keys..."))
-;;     (setf (epg-context-pinentry-mode context) epa-pinentry-mode)
 ;;     (message "Signing keys...")
 ;;     (epg-sign-keys context keys local)
 ;;     (message "Signing keys...done")))
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index d30ebea2d6..33262394a7 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -74,6 +74,27 @@ epg-passphrase-coding-system
   :group 'epg
   :type 'symbol)
 
+
+;; In the doc string below, we say "symbol `error'" to avoid producing
+;; a hyperlink for `error' the function.
+(defcustom epg-pinentry-mode nil
+  "The pinentry mode.
+
+GnuPG 2.1 or later has an option to control the behavior of
+Pinentry invocation.  The value should be the symbol `error',
+`ask', `cancel', or `loopback'.  See the GnuPG manual for the
+meanings.
+
+A particularly useful mode is `loopback', which redirects all
+Pinentry queries to the caller, so Emacs can query passphrase
+through the minibuffer, instead of external Pinentry program."
+  :type '(choice (const nil)
+		 (const ask)
+		 (const cancel)
+		 (const error)
+		 (const loopback))
+  :version "27.1")
+
 (defcustom epg-debug nil
   "If non-nil, debug output goes to the \" *epg-debug*\" buffer.
 Note that the buffer name starts with a space."
diff --git a/lisp/epg.el b/lisp/epg.el
index e6b4af2b36..f79f2046de 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -207,7 +207,7 @@ 'epg-error
   output-file
   result
   operation
-  pinentry-mode
+  (pinentry-mode epg-pinentry-mode)
   (error-output "")
   error-buffer)
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#26298: 26.0.50; Gnus fails to sign mail with PGP
  2018-05-18 13:38           ` Noam Postavsky
@ 2018-05-23 23:09             ` Noam Postavsky
  0 siblings, 0 replies; 22+ messages in thread
From: Noam Postavsky @ 2018-05-23 23:09 UTC (permalink / raw)
  To: Toon Claes; +Cc: Joseph Mingrone, 26298, Torsten Bronger

tags 26298 fixed
close 26298 27.1
quit

Noam Postavsky <npostavs@gmail.com> writes:

> Subject: [PATCH v3] Move epa-pinentry-mode to epg-config (Bug#26298)

Pushed to master.

[1: 302e500087]: 2018-05-23 07:53:58 -0400
  Move epa-pinentry-mode to epg-config (Bug#26298)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=302e500087fd4cc1c5f37ec87c98e828b22aaa05





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-05-23 23:09 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29 12:15 bug#26298: 26.0.50; Gnus fails to sign mail with PGP Torsten Bronger
2017-08-14 20:33 ` Toon Claes
2017-08-14 21:19   ` Toon Claes
2017-08-14 23:46     ` npostavs
2017-08-15  5:54       ` Toon Claes
2017-08-15 15:23         ` Noam Postavsky
2018-01-28 19:39           ` Toon Claes
2018-01-28 21:23             ` Noam Postavsky
2018-04-11 22:06               ` Lars Ingebrigtsen
2018-04-12  7:25                 ` Noam Postavsky
2018-04-12 11:37                   ` Lars Ingebrigtsen
2018-04-12 12:45                     ` Noam Postavsky
2018-04-14  6:52                 ` Toon Claes
2018-04-14 13:12                   ` Lars Ingebrigtsen
2018-04-14 13:36                     ` Toon Claes
2018-04-14 13:54                       ` Lars Ingebrigtsen
2018-04-14 13:15                   ` Lars Ingebrigtsen
2018-04-29 14:38     ` Noam Postavsky
2018-05-17 23:41       ` Noam Postavsky
2018-05-18  9:55         ` Basil L. Contovounesios
2018-05-18 13:38           ` Noam Postavsky
2018-05-23 23:09             ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).