Subject: bug#37901: 24.4; GNUS: gnus-group-customize breaks posting-style encoding

From: Sergey Organov <[email-masked]>
Date: Thu, 24 Oct 2019 14:34:51 +0300

Hello,

Even though I report this for emacs 24.4, the code that is suspect[1] is
still there in git:master:b3b7451, so it's likely the bug is not yet
fixed.

To reproduce the bug starting from "emacs -Q":

M-x gnus<ENTER>
G V test<ENTER>
G p
C-k

... type to put some non-ASCII text into 'posting-style', e.g.:

((posting-style
  ("From" "Сергей Органов <[email-masked]>")))

C-c C-c
G c
<TAB> <TAB> <ENTER>  (or press <done> button with mouse)
G p

... and now I see:

((posting-style
  ("From" "\320\241\320\265\321\200\320\263\320\265\320\271 \320\236\321\200\320\263\320\260\320\275\320\276\320\262 <[email-masked]>")))

in the group parameters buffer, that is utterly broken.

[1] The suspect code is:

    ;; Encode values posting-style holds.
    (dolist (style (cdr (assq 'posting-style params)))
      (when (stringp (cadr style))
	(setcdr style (list (encode-coding-string (cadr style) 'utf-8)))))

in gnus-group-customize-done, and it has matching chunk:

      ;; Decode values posting-style holds.
      (dolist (style (cdr (assq 'posting-style values)))
	(when (stringp (cadr style))
	  (setcdr style (list (decode-coding-string (cadr style) 'utf-8)))))

in gnus-group-customize, though the latter seems to be harmless.

--

In GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2017-09-12 on x86-csail-01, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.11 (jessie)

Configured using:
 `configure --build i586-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LC_MONETARY: en_GB.utf8
  value of $LC_NUMERIC: en_GB.utf8
  value of $LC_TIME: en_GB.utf8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r e t <backspace> <backspace> t = <backspace> 
- e , <tab> <backspace> m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer 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 make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 8 71854 6795)
 (symbols 24 17572 0)
 (miscs 20 40 146)
 (strings 16 9074 4534)
 (string-bytes 1 249887)
 (vectors 8 9550)
 (vector-slots 4 392865 5202)
 (floats 8 65 108)
 (intervals 28 217 22)
 (buffers 512 11)
 (heap 1024 34231 762))