Re: [PATCH 0/4] emacs: avoid type errors due to nil as content-type

Subject: Re: [PATCH 0/4] emacs: avoid type errors due to nil as content-type

Date: Mon, 11 Jan 2021 21:52:07 +0200

To: notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sun, Jan 10 2021, Jonas Bernoulli wrote:

> The fourth commit tries to address the issue raised in
> id:87k0sxa6c3.fsf@fifthhorseman.net.
>
>   The output of "notmuch show --format=sexp --format-version=4"
>   may contain `:content-type' entries with `nil' as the value,
>   when it fails to detect the correct value.  Account for that
>   in a few places where we would otherwise risk a type error.
>
> The other three commits cleanup the code I had to look at to do
> the above, because I just can't help myself.
>
> This does not apply without first applying
> id:20201214162401.19569-1-jonas@bernoul.li.

Perhaps this series still applies on top of that series from 2020-12-14,
but perhaps one should apply it on top of series (from 2021-01-10):

id:20210110140112.25930-2-jonas@bernoul.li

Meaning emails in range

id:20210110140112.25930-2-jonas@bernoul.li 
... 
id:20210110140112.25930-37-jonas@bernoul.li

(also visible in https://nmbug.notmuchmail.org/status/)

Note that messages 

20210110140112.25930-11-jonas@bernoul.li and
20210110140112.25930-12-jonas@bernoul.li

have base64 -encoded content, with CRLF line endings
so those don't apply as is, but CR's from the encoded
content must be deleted.

I used a hack to do so, appended to the end of this
email; David has done something that is more robust,
and perhaps from that we could get a tool to be added
in devel/ which could do this in the future.

Both of these series applied cleanly, and I will
start using those in my emacs mua.

I like these changes and hope these can be applied soon.

>
>      Jonas

Tomi

Usage: ./rmcr-base64.pl < input.mbox > output.mbox

--8<----8<----8<----8<----8<----8<----8<----8<--

#!/usr/bin/perl
# -*- mode: cperl; cperl-indent-level: 4 -*-

use 5.8.1;
use strict;
use warnings;
use MIME::Base64;

while (<STDIN>) {
    print $_;
    if (/^Content-Transfer-Encoding: base64/) {
	while (<STDIN>) { print $_; last if /^\s*$/ }
	my @lines;
	while (<STDIN>) { last if /^\s*$/; push @lines, $_ }
	my $decoded = decode_base64 join('', @lines);
	$decoded =~ tr/\r//d;
	print(encode_base64 $decoded);
	print "\n"
    }
}
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: