unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34387: 26.1; Gnus: handle empty message parts
@ 2019-02-08 14:58 Christophe Troestler
       [not found] ` <handler.34387.B.154963794230369.ack@debbugs.gnu.org>
  2019-02-12  4:34 ` bug#34387: 26.1; Gnus: handle empty message parts Katsumi Yamaoka
  0 siblings, 2 replies; 11+ messages in thread
From: Christophe Troestler @ 2019-02-08 14:58 UTC (permalink / raw)
  To: 34387

Hi,

Some messages only contain an attachment (no body) and (gnus-article-prepare-display) choke on the empty part.  More specifically, `gnus-mime-display-single' does (narrow-to-region beg (point)) which fails if the part is empty.  An easy fix is to write

      (when (< beg (point))
        (narrow-to-region beg (point))
        (if (eq handle gnus-article-mime-handles)
          ...))



In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.2)
 of 2018-12-26, modified by Debian built on x86-ubc-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description:	Debian GNU/Linux buster/sid

Recent messages:
(No changes need to be saved)
Mark set
Saved text from "(defun gnus-mime-display-single (handle)"
Mark set [2 times]
gnus-mime-display-single
Back to top level
Quit
gnus-mime-display-single
Mark saved where search started
Making completion list... [2 times]

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-3ThesY/emacs-26.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

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

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

Major mode: mu4e:view

Minor modes in effect:
  visual-fill-column-mode: t
  TeX-PDF-mode: t
  global-magit-file-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  show-paren-mode: t
  global-edit-server-edit-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
  column-number-mode: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
~/software/OCaml/dune/editor-integration/emacs/dune-flymake hides /home/trch/.opam/4.06.1/share/emacs/site-lisp/dune-flymake
~/software/OCaml/dune/editor-integration/emacs/dune hides /home/trch/.opam/4.06.1/share/emacs/site-lisp/dune
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/deb-view hides /usr/share/emacs/site-lisp/elpa/debian-el-37/deb-view
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-bug hides /usr/share/emacs/site-lisp/elpa/debian-el-37/debian-bug
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/apt-utils hides /usr/share/emacs/site-lisp/elpa/debian-el-37/apt-utils
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/preseed hides /usr/share/emacs/site-lisp/elpa/debian-el-37/preseed
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/apt-sources hides /usr/share/emacs/site-lisp/elpa/debian-el-37/apt-sources
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-autoloads hides /usr/share/emacs/site-lisp/elpa/debian-el-37/debian-autoloads
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el hides /usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el-autoloads hides /usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el-autoloads
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/gnus-BTS hides /usr/share/emacs/site-lisp/elpa/debian-el-37/gnus-BTS
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el-pkg hides /usr/share/emacs/site-lisp/elpa/debian-el-37/debian-el-pkg
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/deb-view hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/deb-view
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/apt-utils hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/apt-utils
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/preseed hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/preseed
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-bug hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-bug
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/apt-sources hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/apt-sources
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-autoloads hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-autoloads
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el-autoloads hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el-autoloads
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/gnus-BTS hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/gnus-BTS
/home/trch/.emacs.d/elpa/debian-el-20181020.1513/debian-el-pkg hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37/debian-el-pkg

Features:
(shadow emacsbug network-stream starttls mailalias face-remap timezone
cl-print debug cus-start cus-load view cal-china lunar solar cal-dst
cal-islam holidays hol-loaddefs cal-move reftex-parse misearch
multi-isearch sh-script executable texmathp qp visual-fill-column sort
gnus-cite smiley shr-color color shr svg dom mm-archive mail-extr
make-mode org-rmail org-mhe org-irc org-info org-gnus nnir org-docview
org-bibtex org-bbdb org-w3m latexenc tuareg caml caml-help reftex-auc
preview prv-emacs tex-buf reftex-dcr reftex reftex-loaddefs reftex-vars
flyspell ispell latex latex-flymake tex-ispell tex-style tex-mode vc-git
elec-pair font-latex tex dbus xml bibtex dune-flymake flymake-proc
flymake compile warnings dune skeleton smie utop utop-minor-mode pcase
merlin-cap merlin caml-types caml-emacs magit-gh-pulls subr-x s gh
gh-users gh-issues gh-pulls gh-repos gh-comments gh-gist gh-oauth gh-api
logito gh-cache pcache eieio-base gh-auth gh-url url-http url url-proxy
url-privacy url-expand url-methods url-history url-auth url-cookie
url-domsuf url-util url-gw nsm gh-profile json map 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-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff-mode magit-core magit-autorevert magit-process
magit-margin magit-mode git-commit magit-git magit-section magit-utils
magit-popup crm log-edit pcvs-util add-log with-editor cl-extra
async-bytecomp async shell dash erc-goodies erc erc-backend erc-compat
pp org-mu4e gnus-icalendar org-capture mu4e-contrib mu4e desktop
frameset mu4e-speedbar speedbar sb-image ezimage dframe mu4e-main
mu4e-view thingatpt browse-url gnus-art mm-uu mml2015 mm-view mml-smime
smime dig mailcap gnus-sum gnus-group gnus-undo gnus-start gnus-cloud
nnimap nnmail mail-source tls gnutls utf7 netrc nnoo parse-time
gnus-spec gnus-int gnus-range gnus-win gnus nnheader wid-edit
mu4e-headers mu4e-compose mu4e-context mu4e-draft mu4e-actions ido
rfc2368 smtpmail sendmail mu4e-mark mu4e-message flow-fill mu4e-proc
mu4e-utils doc-view jka-compr image-mode mu4e-lists mu4e-vars message
rmc puny dired dired-loaddefs rfc822 mml mml-sec gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader hl-line
mu4e-meta adoc-mode tempo markup-faces org-element avl-tree generator
org org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func epa-file epa derived epg cl quail help-mode
mm-util mail-prsvr autorevert filenotify edmacro kmacro paren icalendar
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs edit-server
advice server finder-inf rx tex-site debian-el gh-common marshal
eieio-compat info package easymenu 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 cconv
cl-loaddefs 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 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 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 699181 113871)
 (symbols 48 59955 1)
 (miscs 40 3906 2143)
 (strings 32 212031 19012)
 (string-bytes 1 6376648)
 (vectors 16 80239)
 (vector-slots 8 2307806 160564)
 (floats 8 1465 2911)
 (intervals 56 9982 2963)
 (buffers 992 403))





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

* bug#34387: Acknowledgement (26.1; Gnus: handle empty message parts)
       [not found] ` <handler.34387.B.154963794230369.ack@debbugs.gnu.org>
@ 2019-02-08 15:39   ` Christophe Troestler
  0 siblings, 0 replies; 11+ messages in thread
From: Christophe Troestler @ 2019-02-08 15:39 UTC (permalink / raw)
  To: 34387

For those who encounter this problem, a fix that does not require to modify the body of the function gnus-mime-display-single is:

(define-advice gnus-mime-display-single (:around (oldfn &rest handle) fix)
  "Protect against bad handling of empty message parts."
  (ignore-errors (apply oldfn handle)))





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-08 14:58 bug#34387: 26.1; Gnus: handle empty message parts Christophe Troestler
       [not found] ` <handler.34387.B.154963794230369.ack@debbugs.gnu.org>
@ 2019-02-12  4:34 ` Katsumi Yamaoka
  2019-02-12  7:31   ` Christophe Troestler
  1 sibling, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2019-02-12  4:34 UTC (permalink / raw)
  To: Christophe.Troestler; +Cc: 34387

On Fri, 08 Feb 2019 15:58:19 +0100, Christophe Troestler wrote:
> Some messages only contain an attachment (no body) and
> (gnus-article-prepare-display) choke on the empty part.
> More specifically, `gnus-mime-display-single' does
> (narrow-to-region beg (point)) which fails if the part is empty.

Could you let me know how it fails?  Otherwise, could you show
me a sample email in question?  Unfortunately I'm not successful
in making such an email that causes the problem so far, and trying
(narrow-to-region beg beg) and (narrow-to-region (point) (point))
cause nothing special.

But I found at least two other kinds of problems in relation to
an empty attachment:

1. In the article buffer, pressing the RET key on an empty
 text/plain attachment conceals the succeeding other attachments,
 does not toggle.  `g' restores them of course, though.

2. Some kind of an empty mail isn't able to be edited using the
 `e' command (gnus-summary-edit-article), that is, a single part
 email whose body is an empty attachment.  Gnus misunderstands
 that the header is its body.

On Fri, 08 Feb 2019 16:39:47 +0100, Christophe Troestler wrote:
> For those who encounter this problem, a fix that does not require to
> modify the body of the function gnus-mime-display-single is:

> (define-advice gnus-mime-display-single (:around (oldfn &rest handle) fix)
>   "Protect against bad handling of empty message parts."
>   (ignore-errors (apply oldfn handle)))

I'd like to fix those problems in the Gnus code. :)

Thanks.
Regards,





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-12  4:34 ` bug#34387: 26.1; Gnus: handle empty message parts Katsumi Yamaoka
@ 2019-02-12  7:31   ` Christophe Troestler
  2019-02-13  4:53     ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe Troestler @ 2019-02-12  7:31 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 34387

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


On 12 February 2019 at 05:34 CET, Katsumi Yamaoka wrote:
>
> […] Could you let me know how it fails?

Here is the debugger trace (message attached) :

Debugger entered--Lisp error: (args-out-of-range 4409 4410)
  #f(compiled-function (handle) #<bytecode 0x1471e8d>)((#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  apply(#f(compiled-function (handle) #<bytecode 0x1471e8d>) (#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  gnus-mime-display-single@fix(#f(compiled-function (handle) #<bytecode 0x1471e8d>) (#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  apply(gnus-mime-display-single@fix #f(compiled-function (handle) #<bytecode 0x1471e8d>) (#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  gnus-mime-display-single((#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  gnus-mime-display-part((#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil))
  mapcar(gnus-mime-display-part ((#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil) (#<buffer  *mm*-589619> ("application/pdf" (name . "homologie_de_contact_legendrienne_bilinearisee.pdf")) base64 nil ("attachment" (modification-date . "Fri, 08 Feb 2019 11:42:34 GMT") (creation-date . "Fri, 08 Feb 2019 11:40:17 GMT") (size . "308005") (filename . "homologie_de_contact_legendrienne_bilinearisee.pdf")) "homologie_de_contact_legendrienne_bilinearisee.pdf" nil nil)))
  gnus-mime-display-mixed(((#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil) (#<buffer  *mm*-589619> ("application/pdf" (name . "homologie_de_contact_legendrienne_bilinearisee.pdf")) base64 nil ("attachment" (modification-date . "Fri, 08 Feb 2019 11:42:34 GMT") (creation-date . "Fri, 08 Feb 2019 11:40:17 GMT") (size . "308005") (filename . "homologie_de_contact_legendrienne_bilinearisee.pdf")) "homologie_de_contact_legendrienne_bilinearisee.pdf" nil nil)))
  gnus-mime-display-part((#("multipart/mixed" 0 15 (boundary "_002_VI1PR0101MB215751953182701525CB4AD9E7690VI1PR0101MB2157_" buffer #<buffer  *mm*-468382> from "Damien.GALANT@student.umons.ac.be" start nil)) (#<buffer  *mm*-671873> ("text/html" (charset . "Windows-1252")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker at 4408 in *Article*> #<marker at 4408 in *Article*>))) nil nil nil nil) (#<buffer  *mm*-589619> ("application/pdf" (name . "homologie_de_contact_legendrienne_bilinearisee.pdf")) base64 nil ("attachment" (modification-date . "Fri, 08 Feb 2019 11:42:34 GMT") (creation-date . "Fri, 08 Feb 2019 11:40:17 GMT") (size . "308005") (filename . "homologie_de_contact_legendrienne_bilinearisee.pdf")) "homologie_de_contact_legendrienne_bilinearisee.pdf" nil nil)))
  gnus-display-mime()
  gnus-article-prepare-display()

> Otherwise, could you show me a sample email in question? […]

Attached.

>> […] (define-advice gnus-mime-display-single (:around (oldfn &rest handle) fix)
>>   "Protect against bad handling of empty message parts."
>>   (ignore-errors (apply oldfn handle)))
>
> I'd like to fix those problems in the Gnus code. :)

Sure — it was just a suggestion in the meantime! ;-)

Best,
Christophe


[-- Attachment #2: Plan th�orie des nSuds --]
[-- Type: message/rfc822, Size: 421186 bytes --]

[-- Attachment #2.1.1: Type: text/html, Size: 416 bytes --]

[-- Attachment #2.1.2: homologie_de_contact_legendrienne_bilinearisee.pdf --]
[-- Type: application/pdf, Size: 307661 bytes --]

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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-12  7:31   ` Christophe Troestler
@ 2019-02-13  4:53     ` Katsumi Yamaoka
  2019-02-13 17:26       ` Christophe Troestler
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2019-02-13  4:53 UTC (permalink / raw)
  To: Christophe.Troestler; +Cc: 34387

On Tue, 12 Feb 2019 08:31:39 +0100, Christophe Troestler wrote:
> Here is the debugger trace (message attached) :

> Debugger entered--Lisp error: (args-out-of-range 4409 4410)
>   #f(compiled-function...)(PART1)
>   apply(#f(compiled-function...) PART1)
>   gnus-mime-display-single@fix(#f(compiled-function...) PART1)
>   apply(gnus-mime-display-single@fix #f(compiled-function...) PART1)
>   gnus-mime-display-single(PART1)
>   gnus-mime-display-part(PART1)
>   mapcar(gnus-mime-display-part (PART1 PART2))
>   gnus-mime-display-mixed((PART1 PART2))
>   gnus-mime-display-part((...PART1 PART2))
>   gnus-display-mime()
>   gnus-article-prepare-display()

;; Where PART1 is the html part and PART2 is the pdf part.

If it is (narrow-to-region beg (point)) in gnus-mime-display-single
to issue (args-out-of-range 4409 4410), I guess an html rendering
function deletes buffer's contents so that the buffer's end point
may be 4409.  Here is a model to reproduce the same error:

(with-temp-buffer               ;; article buffer
  (insert-char ?x 4409)
  (let ((beg (point)))          ;; buffer's end point == 4410
    (delete-char -1)            ;; html function does this
    (narrow-to-region beg (point))))
 => (args-out-of-range 4409 4410)

The default html function is mm-shr, that gnus-mime-display-single
calls by way of mm-display-part, mm-display-inline, and
mm-inline-text-html.  At that time, the point is positioned at
the end of the article buffer, where the header lines and a
single empty line are there.

>> Otherwise, could you show me a sample email in question? […]
> Attached.

Thanks.  However, I couldn't reproduce the error with the mail
that I copied to my nnml group.  I tried it using Emacs 26.1
with no ~/.emacs, no ~/.gnus.el, but ~/.newsrc.eld,
(setq gnus-select-method '(nnnil)), and every candidate for
mm-text-html-renderer.  The only thing that reproduces it is:

(defadvice mm-shr (before delete-ceiling-newlines activate)
  "Delete newlines before the point."
  (skip-chars-backward "\n")
  (delete-region (point) (point-max)))

Well, if you have time for analyzing the problem, don't you try
edebug on the functions listed above?

Regards,

;; I'm going to fix the other 2 issues anyway.





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-13  4:53     ` Katsumi Yamaoka
@ 2019-02-13 17:26       ` Christophe Troestler
  2019-02-13 23:20         ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe Troestler @ 2019-02-13 17:26 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 34387


On 13 February 2019 at 05:53 CET, Katsumi Yamaoka wrote:
>
> […] If it is (narrow-to-region beg (point)) in gnus-mime-display-single to issue (args-out-of-range 4409 4410), I guess an html rendering function deletes buffer's contents so that the buffer's end point may be 4409.  Here is a model to reproduce the same error:
>
> (with-temp-buffer               ;; article buffer
>   (insert-char ?x 4409)
>   (let ((beg (point)))          ;; buffer's end point == 4410
>     (delete-char -1)            ;; html function does this
>     (narrow-to-region beg (point))))
>  => (args-out-of-range 4409 4410)
>
> The default html function is mm-shr, that gnus-mime-display-single calls by way of mm-display-part, mm-display-inline, and mm-inline-text-html.  At that time, the point is positioned at the end of the article buffer, where the header lines and a single empty line are there.

Thanks for your analysis.  I indeed had an advice executed after mm-shr to remove trailing whitespace—these making sometimes the rendered text hard to read.  Deleting the advice makes the call work.

What approach would you recommend to remove trailing whitespace after rendering HTML?

Best,
C.






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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-13 17:26       ` Christophe Troestler
@ 2019-02-13 23:20         ` Katsumi Yamaoka
  2019-02-14  2:16           ` Katsumi Yamaoka
  2019-02-14 12:30           ` Christophe Troestler
  0 siblings, 2 replies; 11+ messages in thread
From: Katsumi Yamaoka @ 2019-02-13 23:20 UTC (permalink / raw)
  To: Christophe.Troestler; +Cc: 34387

On Wed, 13 Feb 2019 18:26:44 +0100, Christophe Troestler wrote:
> Thanks for your analysis.  I indeed had an advice executed after
> mm-shr to remove trailing whitespace—these making sometimes the
> rendered text hard to read.  Deleting the advice makes the call
> work.

Bingo! :)

> What approach would you recommend to remove trailing whitespace
> after rendering HTML?

The point would be to delete only whitespace that mm-shr inserts.
How about this?

(defadvice mm-shr (around delete-leading-and-trailing-whitespace activate)
  "Delete leading and trailing whitespace in Gnus article buffer."
  (when (derived-mode-p 'gnus-article-mode)
    (save-restriction
      (narrow-to-region (point) (point))
      ad-do-it
      (goto-char (point-min))
      (skip-chars-forward "\t\n ")
      (delete-region (point-min) (point))
      (goto-char (point-max))
      (skip-chars-backward "\t\n ")
      (delete-region (point) (point-max))
      (insert "\n"))))

I'll close this thread after fixing the other two related bugs.

> 1. In the article buffer, pressing the RET key on an empty
>  text/plain attachment conceals the succeeding other attachments,
>  does not toggle.  `g' restores them of course, though.

> 2. Some kind of an empty mail isn't able to be edited using the
>  `e' command (gnus-summary-edit-article), that is, a single part
>  email whose body is an empty attachment.  Gnus misunderstands
>  that the header is its body.

Regards,





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-13 23:20         ` Katsumi Yamaoka
@ 2019-02-14  2:16           ` Katsumi Yamaoka
  2019-02-14 12:30           ` Christophe Troestler
  1 sibling, 0 replies; 11+ messages in thread
From: Katsumi Yamaoka @ 2019-02-14  2:16 UTC (permalink / raw)
  To: 34387-done; +Cc: Christophe.Troestler

On Thu, 14 Feb 2019 08:20:20 +0900, Katsumi Yamaoka wrote:
> I'll close this thread after fixing the other two related bugs.

>> 1. In the article buffer, pressing the RET key on an empty
>>  text/plain attachment conceals the succeeding other attachments,
>>  does not toggle.  `g' restores them of course, though.

>> 2. Some kind of an empty mail isn't able to be edited using the
>>  `e' command (gnus-summary-edit-article), that is, a single part
>>  email whose body is an empty attachment.  Gnus misunderstands
>>  that the header is its body.

Done.  Closing.





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-13 23:20         ` Katsumi Yamaoka
  2019-02-14  2:16           ` Katsumi Yamaoka
@ 2019-02-14 12:30           ` Christophe Troestler
  2019-02-14 22:50             ` Katsumi Yamaoka
  1 sibling, 1 reply; 11+ messages in thread
From: Christophe Troestler @ 2019-02-14 12:30 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 34387

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


On 14 February 2019 at 00:20 CET, Katsumi Yamaoka wrote:
>
> The point would be to delete only whitespace that mm-shr inserts.
> How about this?
>
> (defadvice mm-shr (around delete-leading-and-trailing-whitespace activate)
>   "Delete leading and trailing whitespace in Gnus article buffer."
>   (when (derived-mode-p 'gnus-article-mode)
>     (save-restriction
>       (narrow-to-region (point) (point))
>       ad-do-it
>       (goto-char (point-min))
>       (skip-chars-forward "\t\n ")
>       (delete-region (point-min) (point))
>       (goto-char (point-max))
>       (skip-chars-backward "\t\n ")
>       (delete-region (point) (point-max))
>       (insert "\n"))))

The point is to delete all trailing whitespace coming from the conversion of HTML to text.  Without this, some emails (such as the one attached) are hard to read because the lines end with so many whitespaces that they take several lines on the screen (filled with spaces).  The following does what I want (and does not trigger the bug, thanks to the narrowing).

(define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
  "Delete leading and trailing whitespace in Gnus article buffer."
  (when (derived-mode-p 'gnus-article-mode)
    (save-restriction
      (narrow-to-region (point) (point))
      (apply oldfn handle)
      (delete-trailing-whitespace))))

Thanks,
C.




[-- Attachment #2: Numerical Algorithms, Vol. 80, Issue 2 - New Issue Alert --]
[-- Type: message/rfc822, Size: 152835 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 9448 bytes --]


---------------
New Issue Alert
---------------



Dear Ch. TROESTLER,
 

We are pleased to deliver your requested table of contents alert 
for "Numerical Algorithms". 

Volume 80 Number 2 is now available on SpringerLink
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI0

=================================================================
Celebrate 2019 Chinese New Year with Springer!

Read 2017 &amp; 2018 top download books with open chapters.
Download Highly Cited Papers, top 1% cited in the field, free online until 28 Feb. 

http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI1

http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI2

-------------------------------------------------

Springer Nature Transfer Desk

Imagine a world where you only have to submit your article once. With our Transfer Desk, we’re working toward making that a reality. Learn more here:


http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI3


=================================================================

IN THIS ISSUE:

>>>Original Paper<<<

>>>Improved optimization methods for image registration problems<<<

Ke Chen, Geovani Nunes Grapiglia, Jinyun Yuan
&
Daoping Zhang

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI4
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI5

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Efficient parameterized rotated shift-splitting preconditioner for a class of complex symmetric linear systems<<<

Cheng-Liang Li
&
Chang-Feng Ma

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI6
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI7

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Modified Newton-MDPMHSS method for solving nonlinear systems with block two-by-two complex symmetric Jacobian matrices<<<

Min-Hong Chen
&
Qing-Biao Wu

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI8
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI9

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Picard iteration-based variable-order integrator with dense output employing algorithmic differentiation<<<

Herman D. Schaumburg, Afnan Al Marzouk
&
Bela Erdelyi

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIa
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIb

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>An infeasible bundle method for nonconvex constrained optimization with application to semi-infinite programming problems<<<

Jian Lv, Li-Ping Pang, Na Xu
&
Ze-Hao Xiao

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIc
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pId

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>A two-grid parallel partition of unity finite element scheme<<<

Guangzhi Du
&
Liyun Zuo

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIe
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIf

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Parallel computing investigations for the projection method applied to the interface transport scheme of a two-phase flow by the method of characteristics<<<

Mireille Haddad, Frédéric Hecht, Toni Sayah
&
Pierre Henri Tournier

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIg
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIh

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Convergence of discrete time waveform relaxation methods<<<

Zhencheng Fan

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIi
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIj

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Modified PHSS iterative methods for solving nonsingular and singular saddle point problems<<<

Zheng-Ge Huang, Li-Gong Wang, Zhong Xu
&
Jing-Jing Cui

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIk
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIl

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>On the asymptotic optimality of error bounds for some linear complementarity problems<<<

M. García-Esnaola
&
J. M. Peña

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIm
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIn

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Some second-order 𝜃 schemes combined with finite element method for nonlinear fractional cable equation<<<

Yang Liu, Yanwei Du, Hong Li, Fawang Liu
&
Yajun Wang

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIo
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIp

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>A new family of three-stage two-step P-stable multiderivative methods with vanished phase-lag and some of its derivatives for the numerical solution of radial Schrödinger equation and IVPs with oscillating solutions<<<

Ali Shokri, Mohammad Mehdizadeh Khalsaraei, Mortaza Tahmourasi
&
Raquel Garcia-Rubio

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIq
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIr

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>A modified Newton iteration for finding nonnegative Z-eigenpairs of a nonnegative tensor<<<

Chun-Hua Guo, Wen-Wei Lin
&
Ching-Sung Liu

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIs
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIt

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Selective projection methods for solving a class of variational inequalities<<<

Songnian He
&
Hanlin Tian

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIu
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIv

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Look-ahead in the two-sided reduction to compact band forms for symmetric eigenvalue problems and the SVD<<<

Rafael Rodríguez-Sánchez, Sandra Catalán, José R. Herrero, Enrique S. Quintana-Ortí
&
Andrés E. Tomás

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIw
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIx

- - - - - - - - - - - - - - - - - - - - - - - - -

>>>Original Paper<<<

>>>Truncation dimension for linear problems on multivariate function spaces<<<

Aicke Hinrichs, Peter Kritzer, Friedrich Pillichshammer
&
G. W. Wasilkowski

Abstract:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIy
Full text PDF:
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pIz
________________________________________________________________________

Do you want to publish your article in this journal?

Please visit the homepage of Numerical Algorithms
http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI10
for full details on:
	- aims and scope
	- editorial policy
	- article submission

________________________________________________________________________

Read open access articles

Anyone can access open access articles for free.
Go to http://alerts.springer.com/re?l=D0In6c9xhI6htpi7pI11
to view all open access articles published in this journal.

-------------------------------------------------
This email has been sent to christophe.troestler@umons.ac.be

You are receiving this email because you have opted to receive information 
from SpringerAlerts as a registered user of our Table of Content Alert for 
journals. 

To modify your subscription (including change of email address etc.) please 
go to springer.com/alertprofile and log in with user name and password. If 
you do not remember either of them, write to customerservice@springer.com .

To unsubscribe from this specific table of contents alert, please go to:
http://www.springer.com/tocUnsubscribe.jsp?email=christophe.troestler@umons.ac.be&journal=11075&checkval=e4d431413ef909919d45c3cbbe2c38d9
To unsubscribe from ALL table of contents alerts, please go to:
http://www.springer.com/tocUnsubscribe.jsp?email=christophe.troestler@umons.ac.be&checkval=2349bf1015e850b88cc67a4ab7abd25c
For all enquiries, problems or suggestions regarding this service, please 
contact customerservice@springer.com . 

Springer's New Book Alert is the best way to keep up to date with new 
developments in your field. 
Sign-up today for notification on new books and related information in 
your subject areas: springer.com/springeralerts/nba

Springer respects your privacy and does not disclose, sell or rent your 
personal information to any nonaffiliated third parties without your consent. 
Please visit the Springer Privacy Statement . 

To ensure the delivery to your inbox, please add the sender address 
springer@alerts.springer.com to your allow list.

Springer-Verlag GmbH Heidelberg, Tiergartenstrasse 17, 69121 Heidelberg, 
Germany, phone: +49 6221 487 0, fax: +49 6221 487 8366

[-- Attachment #2.1.2.1: Type: text/html, Size: 45828 bytes --]

[-- Attachment #2.1.2.2: cda_displayimage.jpg --]
[-- Type: image/png, Size: 6205 bytes --]

[-- Attachment #2.1.2.3: 2.jpg --]
[-- Type: image/jpeg, Size: 22883 bytes --]

[-- Attachment #2.1.2.4: cda_displayimage.jpg --]
[-- Type: image/jpeg, Size: 33899 bytes --]

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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-14 12:30           ` Christophe Troestler
@ 2019-02-14 22:50             ` Katsumi Yamaoka
  2019-02-15  8:28               ` Christophe Troestler
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2019-02-14 22:50 UTC (permalink / raw)
  To: Christophe.Troestler; +Cc: 34387

On Thu, 14 Feb 2019 13:30:34 +0100, Christophe Troestler wrote:
> The point is to delete all trailing whitespace coming from the
> conversion of HTML to text.  Without this, some emails (such as the
> one attached) are hard to read because the lines end with so many
> whitespaces that they take several lines on the screen (filled with
> spaces).  The following does what I want (and does not trigger the
> bug, thanks to the narrowing).

> (define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
>   "Delete leading and trailing whitespace in Gnus article buffer."
>   (when (derived-mode-p 'gnus-article-mode)
>     (save-restriction
>       (narrow-to-region (point) (point))
>       (apply oldfn handle)
>       (delete-trailing-whitespace))))

I see.  But, sorry, I meant to do first was:

(define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
  "Delete leading and trailing whitespace in Gnus article buffer."
  (if (derived-mode-p 'gnus-article-mode)
      (save-restriction
	(narrow-to-region (point) (point))
	(apply oldfn handle)
	(delete-trailing-whitespace))
    (apply oldfn handle)))

That is, not to do the whitespace deletion when mm-shr is used
in other than Gnus as it might require whitespace.  Anyway the
(when ...) way makes mm-shr work only in the Gnus article buffer.
:-p

Regards,





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

* bug#34387: 26.1; Gnus: handle empty message parts
  2019-02-14 22:50             ` Katsumi Yamaoka
@ 2019-02-15  8:28               ` Christophe Troestler
  0 siblings, 0 replies; 11+ messages in thread
From: Christophe Troestler @ 2019-02-15  8:28 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 34387


On 14 February 2019 at 23:50 CET, Katsumi Yamaoka wrote:
>
> […] I see.  But, sorry, I meant to do first was:
>
> (define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
>   "Delete leading and trailing whitespace in Gnus article buffer."
>   (if (derived-mode-p 'gnus-article-mode)
>       (save-restriction
> 	(narrow-to-region (point) (point))
> 	(apply oldfn handle)
> 	(delete-trailing-whitespace))
>     (apply oldfn handle)))
>
> That is, not to do the whitespace deletion when mm-shr is used
> in other than Gnus as it might require whitespace.  […]

Sure.  Thanks for taking the time to attract my attention to this.

Best,
C.





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

end of thread, other threads:[~2019-02-15  8:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-08 14:58 bug#34387: 26.1; Gnus: handle empty message parts Christophe Troestler
     [not found] ` <handler.34387.B.154963794230369.ack@debbugs.gnu.org>
2019-02-08 15:39   ` bug#34387: Acknowledgement (26.1; Gnus: handle empty message parts) Christophe Troestler
2019-02-12  4:34 ` bug#34387: 26.1; Gnus: handle empty message parts Katsumi Yamaoka
2019-02-12  7:31   ` Christophe Troestler
2019-02-13  4:53     ` Katsumi Yamaoka
2019-02-13 17:26       ` Christophe Troestler
2019-02-13 23:20         ` Katsumi Yamaoka
2019-02-14  2:16           ` Katsumi Yamaoka
2019-02-14 12:30           ` Christophe Troestler
2019-02-14 22:50             ` Katsumi Yamaoka
2019-02-15  8:28               ` Christophe Troestler

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