unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
@ 2019-12-06 20:43 Unknown
  2019-12-09 16:26 ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Unknown @ 2019-12-06 20:43 UTC (permalink / raw)
  To: 38512; +Cc: Lars Ingebrigtsen


Recently, when I read an email that has been PGP-signed and/or encrypted
by a person who has non-ascii chars in their name in the PGP-key, Gnus
gives an error on the email, showing this message:

  epg--decode-percent-escape: Can’t convert the 8th character to unibyte

This also means I can't read encrypted emails I have sent myself.

I have bisected the problem to this commit:

  98387b9e2455b0bd5a2aafe6fac939fb111eedce is the first bad commit
  commit 98387b9e2455b0bd5a2aafe6fac939fb111eedce
  Author: Lars Ingebrigtsen <larsi@gnus.org>
  Date:   Wed Oct 23 10:50:29 2019 +0200

      Make display of S/MIME signatures slightly better

      * lisp/epg.el (epg-signature-to-string): Decode percent escapes
      (bug#36101).

   lisp/epg.el | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

The problem can be seen in the news.gmane.org group
gmane.linux.debian.user.security.announce on the article:

  From: Moritz Muehlenhoff <jmm@debian.org>
  Newsgroups: gmane.linux.debian.user.security.announce
  Subject: [DSA 4578-1] libvpx security update
  Date: Thu, 28 Nov 2019 19:47:36 +0000
  Message-ID: <20191128194736.pqip4euzsmkd26ys@seger.debian.org>
  To: debian-security-announce@lists.debian.org
  Xref: news.gmane.org gmane.linux.debian.user.security.announce:4820


In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.13)
 of 2019-12-06 built on tullinup
Repository revision: 5b111f85a244a71cd6c02f46166437f542ae01f7
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12006000
System Description: Debian GNU/Linux bullseye/sid

Recent messages:
imap: Login successful...
imap: Authenticating to ‘mail.koldfront.dk’ using ‘login’...done
Fetching from INBOX...
nnml: Reading incoming mail (no new mail)...done
Reading active file via nnml...done
Reading active file from archive via nnml...
Opening nnml server on archive...done
Reading active file from archive via nnml...done
Reading active file via nndraft...done

Configured using:
 'configure --without-pop --without-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD PDUMPER
LCMS2 GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  pixel-scroll-mode: t
  engine-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  dumb-jump-mode: t
  which-function-mode: t
  global-auto-complete-mode: t
  shell-dirtrack-mode: t
  save-place-mode: t
  jabber-activity-mode: t
  winner-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-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
  buffer-read-only: t
  line-number-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa-src/ess-18.10.2/debian-autoloads hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.0/debian-autoloads
/usr/share/emacs/site-lisp/elpa-src/boxquote-2.1/boxquote hides ~/elisp/extra/boxquote
~/elisp/let-alist/let-alist hides ~/elisp/extra/let-alist
~/elisp/with-editor/with-editor hides ~/elisp/extra/with-editor
~/elisp/with-editor/with-editor-autoloads hides ~/elisp/extra/with-editor-autoloads
~/elisp/let-alist/let-alist hides /usr/src/emacs/lisp/emacs-lisp/let-alist

Features:
(shadow sort gnus-cite bbdb-message nnir emacsbug sendmail gnus-topic
paren utf-7 imap rfc2104 epa-file network-stream nnml bbdb-gnus bbdb-mua
nnnil gnus-demon gnus-delay gnus-draft gnus-agent gnus-srvr gnus-score
score-mode nnvirtual nntp gnus-cache nndraft nnmh mail-extr spam
spam-stat bbdb-com gnus-uu yenc gnus-msg gnus-html url-queue help-fns
radix-tree url-cache mm-url bbdb-picture gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum gnus-group gnus-undo gnus-fun hashcash
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
gnus-spec gnus-int gnus-range gnus-win gnus nnheader gopher shr svg
pixel-scroll litable engine-mode gitpatch magithub magithub-ci
magithub-issue magithub-cache magithub-core magit-submodule
magit-obsolete magit-blame magit-stash magit-bisect magit-push
magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-collab ghub-graphql treepy graphql ghub
url-http url-gw nsm url-auth let-alist magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode diff magit-core magit-autorevert autorevert
filenotify magit-process magit-margin magit-mode git-commit recentf
tree-widget magit-git magit-section magit-utils magit-popup vc-git
diff-mode crm log-edit message rmc rfc822 mml mml-sec epa epg epg-config
gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util
with-editor term disp-table ehelp eshell esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util wgrep-ag wgrep
grep ag vc-svn find-dired dumb-jump f dash s ucs-normalize etags
fileloop generator tex-site auto-loads expand-region
cperl-mode-expansions text-mode-expansions html-mode-expansions
er-basic-expansions expand-region-core expand-region-custom which-func
cperl-mode auto-complete-config auto-complete popup cl-extra help-mode
ess-site ess-toolbar ess-mouse mouseme ess-swv ess-noweb
ess-noweb-font-lock-mode ess-jags-d ess-bugs-l essd-els ess-xls-d
ess-vst-d ess-stata-mode ess-stata-lang cc-vars cc-defs make-regexp
ess-sp6w-d ess-sp5-d ess-sp4-d ess-sas-d ess-sas-l ess-sas-a ess-s4-d
ess-s3-d ess-omg-d ess-omg-l ess-arc-d ess-lsp-l ess-sp6-d ess-dde
ess-sp3-d ess-julia julia-mode ess-r-mode ess-r-flymake rx flymake-proc
flymake warnings thingatpt ess-r-xref xref project ess-trns
ess-r-package ess-r-syntax pcase ess-r-completion ess-roxy ess-rd essddr
noutline outline hideshow ess-s-lang speedbar sb-image ezimage dframe
ess-help info reporter ess-mode ess ess-noweb-mode ess-inf ess-tracebug
easy-mmode ess-generics compile ess-utils ido ess-custom executable
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell pcomplete parse-time iso8601 ls-lisp debian-changelog-mode imenu
add-log dpkg-dev-el saveplace vc vc-dispatcher bbdb derived bbdb-site
timezone bbdb-loaddefs boxquote rect jabber-http-file-upload url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util jabber-print-html jabber-otr jabber
jabber-notifications notifications jabber-libnotify dbus jabber-awesome
jabber-osd jabber-wmii jabber-xmessage jabber-festival jabber-sawfish
jabber-ratpoison jabber-tmux jabber-screen jabber-socks5
jabber-ft-server jabber-si-server jabber-ft-client jabber-ft-common
jabber-si-client jabber-si-common jabber-feature-neg jabber-truncate
jabber-time jabber-autoaway time-date jabber-vcard-avatars
jabber-chatstates jabber-events jabber-vcard jabber-avatar mailcap
jabber-activity jabber-watch jabber-modeline advice jabber-ahc-presence
jabber-ahc jabber-version jabber-ourversion jabber-muc-nick-completion
hippie-exp comint ansi-color jabber-browse jabber-search jabber-register
jabber-roster format-spec jabber-presence jabber-muc jabber-bookmarks
jabber-private jabber-muc-nick-coloring hexrgb jabber-widget
jabber-disco wid-edit jabber-chat jabber-history jabber-chatbuffer
jabber-alert jabber-iq jabber-core jabber-console sgml-mode dom ewoc
jabber-keymap jabber-sasl sasl sasl-anonymous sasl-login sasl-plain fsm
jabber-logon jabber-conn srv dns starttls tls jabber-xml xml jabber-menu
jabber-util cl winner ring gnutls puny find-file-from-selection
find-lisp dired dired-loaddefs cap-words superword subword edmacro
kmacro server finder-inf package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib 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 tab-bar 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 charprop 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 threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 723483 45574)
 (symbols 48 39842 4)
 (strings 32 122472 8813)
 (string-bytes 1 3996220)
 (vectors 16 63321)
 (vector-slots 8 783507 44950)
 (floats 8 393 58)
 (intervals 56 689 0)
 (buffers 1000 22))

-- 
 "I wish *I* was a tiger!"                                     Adam Sjøgren
 "A common lament."                                       asjo@koldfront.dk
 





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

* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
  2019-12-06 20:43 bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error Unknown
@ 2019-12-09 16:26 ` Robert Pluim
  2019-12-09 17:08   ` Unknown
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2019-12-09 16:26 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: Lars Ingebrigtsen, 38512

>>>>> On Fri, 06 Dec 2019 21:43:37 +0100, "Adam Sjøgren <asjo@koldfront.dk>" said:

    Adam> Recently, when I read an email that has been PGP-signed and/or encrypted
    Adam> by a person who has non-ascii chars in their name in the PGP-key, Gnus
    Adam> gives an error on the email, showing this message:

    Adam>   epg--decode-percent-escape: Can’t convert the 8th character to unibyte

    Adam> This also means I can't read encrypted emails I have sent myself.

    Adam> I have bisected the problem to this commit:

    Adam>   98387b9e2455b0bd5a2aafe6fac939fb111eedce is the first bad commit
    Adam>   commit 98387b9e2455b0bd5a2aafe6fac939fb111eedce
    Adam>   Author: Lars Ingebrigtsen <larsi@gnus.org>
    Adam>   Date:   Wed Oct 23 10:50:29 2019 +0200

    Adam>       Make display of S/MIME signatures slightly better

    Adam>       * lisp/epg.el (epg-signature-to-string): Decode percent escapes
    Adam>       (bug#36101).

    Adam>    lisp/epg.el | 2 +-
    Adam>    1 file changed, 1 insertion(+), 1 deletion(-)

If I remember correctly what Eli taught me the last time this kind of
discussion came up, this should fix it:

diff --git a/lisp/epg.el b/lisp/epg.el
index 090317f422..5466716e34 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -2032,7 +2032,7 @@ epg-edit-key
     (epg-reset context)))
 
 (defun epg--decode-percent-escape (string)
-  (setq string (string-to-unibyte string))
+  (setq string (encode-coding-string string 'raw-text))
   (let ((index 0))
     (while (string-match "%\\(\\(%\\)\\|\\([[:xdigit:]][[:xdigit:]]\\)\\)"
 			 string index)





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

* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
  2019-12-09 16:26 ` Robert Pluim
@ 2019-12-09 17:08   ` Unknown
  2019-12-11 12:33     ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Unknown @ 2019-12-09 17:08 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Lars Ingebrigtsen, 38512

Robert writes:

> If I remember correctly what Eli taught me the last time this kind of
> discussion came up, this should fix it:
>
> diff --git a/lisp/epg.el b/lisp/epg.el
> index 090317f422..5466716e34 100644
> --- a/lisp/epg.el
> +++ b/lisp/epg.el
> @@ -2032,7 +2032,7 @@ epg-edit-key
>      (epg-reset context)))
>  
>  (defun epg--decode-percent-escape (string)
> -  (setq string (string-to-unibyte string))
> +  (setq string (encode-coding-string string 'raw-text))
>    (let ((index 0))
>      (while (string-match "%\\(\\(%\\)\\|\\([[:xdigit:]][[:xdigit:]]\\)\\)"
>  			 string index)
>

I can confirm that this patch fixes the problem I reported.


  Thanks!

   Adam

-- 
 "Vegetarian?? Yecchh! I'm not a vegetarian!                Adam Sjøgren
  I'm a dessertarian."                                 asjo@koldfront.dk





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

* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
  2019-12-09 17:08   ` Unknown
@ 2019-12-11 12:33     ` Robert Pluim
  2019-12-11 16:33       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2019-12-11 12:33 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: Lars Ingebrigtsen, 38512

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

>>>>> On Mon, 09 Dec 2019 18:08:33 +0100, Adam Sjøgren <asjo@koldfront.dk> said:

    Adam> I can confirm that this patch fixes the problem I reported.

Thanks for testing. Eli, is this OK for master?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Treat-passed-strings-as-raw-text-when-percent-escapi.patch --]
[-- Type: text/x-patch, Size: 1185 bytes --]

From 572f59f96c29f4ec5b8a584ba30348e475ee6598 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Mon, 9 Dec 2019 18:41:59 +0100
Subject: [PATCH] Treat passed strings as raw-text when percent-escaping in epg
To: emacs-devel@gnu.org

The strings contained in gpg keys can contain UTF-8 data, but can also
use percent-escapes to encode non-ASCII chars.  When converting those
escapes, use 'raw-text' coding system rather than 'string-to-unibyte',
since the latter signals an error for non-ASCII characters.

* lisp/epg.el (epg--decode-percent-escape): Convert the passed
string to raw-text before treating percent escapes (Bug#38512).
---
 lisp/epg.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/epg.el b/lisp/epg.el
index 090317f422..5466716e34 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -2032,7 +2032,7 @@ epg-edit-key
     (epg-reset context)))
 
 (defun epg--decode-percent-escape (string)
-  (setq string (string-to-unibyte string))
+  (setq string (encode-coding-string string 'raw-text))
   (let ((index 0))
     (while (string-match "%\\(\\(%\\)\\|\\([[:xdigit:]][[:xdigit:]]\\)\\)"
 			 string index)
-- 
2.24.0.155.gd9f6f3b619


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

* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
  2019-12-11 12:33     ` Robert Pluim
@ 2019-12-11 16:33       ` Eli Zaretskii
  2019-12-12  7:37         ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-12-11 16:33 UTC (permalink / raw)
  To: Robert Pluim; +Cc: asjo, 38512, larsi

> From: Robert Pluim <rpluim@gmail.com>
> Date: Wed, 11 Dec 2019 13:33:13 +0100
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, 38512@debbugs.gnu.org
> 
>     Adam> I can confirm that this patch fixes the problem I reported.
> 
> Thanks for testing. Eli, is this OK for master?

Yes, thanks.





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

* bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error
  2019-12-11 16:33       ` Eli Zaretskii
@ 2019-12-12  7:37         ` Robert Pluim
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Pluim @ 2019-12-12  7:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: asjo, 38512, larsi

tags 38512 fixed
close 38512 27.1
quit

>>>>> On Wed, 11 Dec 2019 18:33:18 +0200, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Date: Wed, 11 Dec 2019 13:33:13 +0100
    >> Cc: Lars Ingebrigtsen <larsi@gnus.org>, 38512@debbugs.gnu.org
    >> 
    Adam> I can confirm that this patch fixes the problem I reported.
    >> 
    >> Thanks for testing. Eli, is this OK for master?

    Eli> Yes, thanks.

Closing.
Committed as d57bb0c323

Thanks

Robert





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

end of thread, other threads:[~2019-12-12  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-06 20:43 bug#38512: 27.0.50; Reading PGP-signed email from people with non-ascii names give error Unknown
2019-12-09 16:26 ` Robert Pluim
2019-12-09 17:08   ` Unknown
2019-12-11 12:33     ` Robert Pluim
2019-12-11 16:33       ` Eli Zaretskii
2019-12-12  7:37         ` Robert Pluim

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