Wednesday, August 28, 2024

mail/mblaze: backport diff to relax body line length limit

I keep recompiling mblaze to have this in. It allows to set
MBLAZE_RELAXED_MIME to not encode the body of the mail if it
is longer than 72 chars, but still does if it exceedes 998.

This is committed upstream but not yet in a release. Lucas,
would you be fine with backporting this?

Thanks,

Omar Polo

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/mail/mblaze/Makefile,v
diff -u -p -r1.17 Makefile
--- Makefile 26 Sep 2023 12:28:12 -0000 1.17
+++ Makefile 28 Aug 2024 21:59:30 -0000
@@ -1,7 +1,7 @@
COMMENT = set of Maildir utilities

DISTNAME = mblaze-1.2
-REVISION = 0
+REVISION = 1
CATEGORIES = mail

HOMEPAGE = https://git.vuxu.org/mblaze/
Index: patches/patch-man_mmime_1
===================================================================
RCS file: patches/patch-man_mmime_1
diff -N patches/patch-man_mmime_1
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-man_mmime_1 28 Aug 2024 22:01:36 -0000
@@ -0,0 +1,20 @@
+allow to relax body line length limit; backport of
+https://git.vuxu.org/mblaze/commit/?id=e951b0ba27f878e4daa09c59a89e8f5196e31e07
+
+Index: man/mmime.1
+--- man/mmime.1.orig
++++ man/mmime.1
+@@ -46,6 +46,13 @@ Override Content-Type for the toplevel part.
+ Defaults to
+ .Sq Li multipart/mixed .
+ .El
++.Sh ENVIRONMENT
++.Bl -tag -width Ds
++.It Ev MBLAZE_RELAXED_MIME
++If set,
++.Ic Nm Fl c
++will relax the body line length check and only consider bodies with lines
++longer than 998 characters need to be MIME formatted.
+ .Sh EXIT STATUS
+ .Ex -std
+ .Sh SEE ALSO
Index: patches/patch-mmime_c
===================================================================
RCS file: patches/patch-mmime_c
diff -N patches/patch-mmime_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-mmime_c 28 Aug 2024 22:01:33 -0000
@@ -0,0 +1,23 @@
+allow to relax body line length limit; backport of
+https://git.vuxu.org/mblaze/commit/?id=e951b0ba27f878e4daa09c59a89e8f5196e31e07
+
+Index: mmime.c
+--- mmime.c.orig
++++ mmime.c
+@@ -517,6 +517,7 @@ check()
+ off_t linelen = 0;
+ off_t maxheadlinelen = 0;
+ off_t maxbodylinelen = 0;
++ off_t bodylinelenlimit = getenv("MBLAZE_RELAXED_MIME") ? 998 : 78;
+
+ int c;
+ int l = -1;
+@@ -554,7 +555,7 @@ check()
+ }
+
+ if (bitlow == 0 && bithigh == 0 &&
+- maxheadlinelen < 998 && maxbodylinelen <= 78 &&
++ maxheadlinelen < 998 && maxbodylinelen <= bodylinelenlimit &&
+ l == '\n')
+ return 0;
+ else
Index: patches/patch-t_1000-mmime_t
===================================================================
RCS file: patches/patch-t_1000-mmime_t
diff -N patches/patch-t_1000-mmime_t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-t_1000-mmime_t 28 Aug 2024 22:01:21 -0000
@@ -0,0 +1,29 @@
+allow to relax body line length limit; backport of
+https://git.vuxu.org/mblaze/commit/?id=e951b0ba27f878e4daa09c59a89e8f5196e31e07
+
+Index: t/1000-mmime.t
+--- t/1000-mmime.t.orig
++++ t/1000-mmime.t
+@@ -2,7 +2,7 @@
+ cd ${0%/*}
+ . ./lib.sh
+
+-plan 17
++plan 19
+
+ cat <<EOF >tmp
+ References: <aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@a> <bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@b> <ccccccccccccccccccccccccccccccc@c>
+@@ -124,3 +124,13 @@ Subject: inclusion without further content
+ EOF
+
+ check 'no empty parts are generated after inclusion lines' '! mmime <tmp2 | mshow -t - | grep -q size=0'
++
++cat <<EOF >tmp2
++Subject: Strict mode
++
++Body with lines longer than 78 characters
++aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
++EOF
++
++check 'body lines longer than 78 characters needs MIME formatting' '! mmime -c <tmp2'
++check 'MBLAZE_RELAXED_MIME allows body lines longer than 78 characters' 'MBLAZE_RELAXED_MIME= mmime -c <tmp2'

No comments:

Post a Comment