unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: Tomi Ollila <tomi.ollila@iki.fi>,
	Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type
Date: Mon, 04 Jan 2021 22:07:49 +0100	[thread overview]
Message-ID: <87im8c9zru.fsf@bernoul.li> (raw)
In-Reply-To: <m235zhpyza.fsf@guru.guru-group.fi>

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Sun, Jan 03 2021, Daniel Kahn Gillmor wrote:
>
>> This is an inadequate workaround to the concerns raised in
>> id:87wnwu8tzf.fsf@fifthhorseman.net -- when it is installed, a
>> particular kind of malformed message (in particular, one containing a
>> message/rfc822 part that is improperly transfer-encoded with base64)
>> won't break the rendering.
>>
>> However, with this applied, there are definitely still problems.
>>
>> For example, the rendering of such a message shows internal errors for
>> me:
>>
>>     [ attachment.eml: message/rfc822 ]
>>
>>     !!! Bodypart handler `notmuch-show-insert-part-message/rfc822' threw an error:
>>     !!! Wrong type argument: char-or-string-p, nil
>>     !!! Bodypart handler `notmuch-show-insert-part-*/*' threw an error:
>>     !!! Symbol’s value as variable is void: gnus-newsgroup-charset
>>
>> But it's better than causing the whole thread to fail to render.
>>
>> I don't know what the right solution is, so i'm offering this
>> workaround in the spirit of harm reduction.
>>
>> (note: this is on the "release" branch -- this function has changed in
>> master, so i don't think it applies there, but i haven't tested further)
>> ---
>>  emacs/notmuch-show.el | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>> index b08ceb97..625a5d55 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -575,7 +575,9 @@ message at DEPTH in the current thread."
>>        (push (list content-id msg part) notmuch-show--cids)))
>>    ;; Recurse on sub-parts
>>    (let ((ctype (notmuch-split-content-type
>> -		(downcase (plist-get part :content-type)))))
>> +		(downcase (if (plist-get part :content-type)
>> +                              (plist-get part :content-type)
>> +                            "text/plain")))))
>
> What I remember from someone's latest patches (was it Jonas or someone
> else),
>
> 		(downcase (or (plist-get part :content-type) "text/plain"))))))

Yes, please.

> (if this were otherwise good enough to be applied :D)

There are other places in the elisp code where the `:content-type' is
assumed to be a string, so fixing it just here doesn't cut it.  To fix
it for everyone, "notmuch show..." should probably take care of falling
back to some sane default if the type cannot be determined.

     Jonas

  reply	other threads:[~2021-01-05  3:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 23:44 failure in emacs notmuch-show: notmuch-show--register-cids: Wrong type argument: char-or-string-p, nil Daniel Kahn Gillmor
2021-01-02  9:47 ` Jonas Bernoulli
2021-01-03  5:33   ` Daniel Kahn Gillmor
2021-01-03 18:31     ` [PATCH] emacs/notmuch-show: Work around errors where a part lacks a content-type Daniel Kahn Gillmor
2021-01-03 20:06       ` Tomi Ollila
2021-01-04 21:07         ` Jonas Bernoulli [this message]
2021-01-05 22:00           ` Daniel Kahn Gillmor
2021-01-10 18:38             ` Jonas Bernoulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im8c9zru.fsf@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).