Subject: 29.0.50; mml-generate-mime gets error

From: Richard Stallman <[email-masked]>
Date: Mon, 18 Apr 2022 23:47:22 -0400

I had this in my *mail* buffer (in Mail mode):

======================================================================
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <[email-masked]>
To: rms
Subject: 
Reply-To: [email-masked]

Test.

<#part type="application/pdf" filename="~/foo.pdf" disposition=attachment>
<#/part>
======================================================================

I ran (mml-secure-message-sign-pgpmime), then typed C-c C-c
and got an error from mml-generate-mime, that assq returned nil here:

	(setcdr (assq 'type (cdr (car cont))) content-type))

cont contained this.

======================================================================
((multipart (sign . "pgpmime") (tag-location . 119) (part (type . "text/plain") (contents . "Test.

")) (part (type . "application/pdf") (filename . "~/foo.pdf") (disposition . "attachment") (tag-location . 152) (contents . ""))))
======================================================================

The code there is kludgy, but in the absence of a precise description
of that data structure, I can't directly tell what's wrong.

Is there a description somewhere?

The rest of the backtrace:
  setcdr(nil "text/plain; charset=Utf-8")
  (progn (setcdr (assq 'type (cdr (car cont))) content-type))
  (if (and (consp (car cont)) (= (length cont) 1) content-type) (progn (setcdr (assq 'type (cdr (car cont))) content-type)))
  (if (not cont) nil (if (and (consp (car cont)) (= (length cont) 1) content-type) (progn (setcdr (assq 'type (cdr (car cont))) content-type))) (if (fboundp 'libxml-parse-html-region) (progn (setq cont (mapcar #'mml-expand-all-html-into-multipart-related cont)))) (prog1 (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond (... ...) (... ...) (t ...)) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (setq message-options options)))
  (let ((cont (mml-parse)) (mml-multipart-number mml-multipart-number) (options message-options)) (if (not cont) nil (if (and (consp (car cont)) (= (length cont) 1) content-type) (progn (setcdr (assq 'type (cdr (car cont))) content-type))) (if (fboundp 'libxml-parse-html-region) (progn (setq cont (mapcar #'mml-expand-all-html-into-multipart-related cont)))) (prog1 (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-multibyte nil) (setq message-options options) (cond ... ... ...) (setq options message-options) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (setq message-options options))))
  mml-generate-mime(nil "text/plain; charset=Utf-8")
  message-encode-message-body()
  mml-to-mime()
  mail-send()
  mail-send-and-exit(nil)

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0)
 of 2022-04-13 built on freetop
Repository revision: ed6237e039e6fb51229054d0fce74df074903f19
Repository branch: master
System Description: Trisquel GNU/Linux Nabia (10.0)

Configured using:
 'configure 'CFLAGS=-O0 -g' --with-gnutls=ifavailable'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GPM GSETTINGS HARFBUZZ JPEG LIBOTF
LIBSELINUX LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK2
ZLIB

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

Major mode: Mail

Minor modes in effect:
  gpm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-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
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: linux
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow dabbrev emacsbug shortdoc thingatpt misearch multi-isearch
cl-extra vc-git diff-mode easy-mmode vc-dispatcher bug-reference
help-fns radix-tree cl-print debug backtrace help-mode find-func
cus-start cus-load mailalias qp rmailmm message sendmail yank-media
rmc puny rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader mail-parse rfc2231 rmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils dired-aux dired
dired-loaddefs t-mouse term/linux view derived advice finder-inf
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
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
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice simple 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 emoji-zwj
charscript charprop case-table epa-hook jka-cmpr-hook help abbrev
obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable
backquote threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 353614 44925)
 (symbols 48 10482 5)
 (strings 32 36669 1027)
 (string-bytes 1 1029513)
 (vectors 16 19555)
 (vector-slots 8 219774 25967)
 (floats 8 97 267)
 (intervals 56 52273 1191)
 (buffers 992 35))
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)