2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"${MH_OBJ_DIR}/test/common.sh"
19 #### Make sure that html-to-text conversion is what we expect.
20 require_locale en_US.utf
-8 en_US.utf8
21 LC_ALL
=en_US.UTF
-8; export LC_ALL
23 expected
="$MH_TEST_DIR/test-mhfixmsg$$.expected"
24 expected_err
="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
25 actual
="$MH_TEST_DIR/test-mhfixmsg$$.actual"
26 actual_err
="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
28 mhn_defaults
="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
30 if grep mhfixmsg
-format-text/html
"${mhn_defaults}" \
32 can_reformat_texthtml
=1
33 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
35 #### w3m uses $HOME/.w3m/, and creates it if it doesn't exist. To
36 #### support testing with non-writeable $HOME, and to not leave
37 #### relics from this test if it is writeable but doesn't already
38 #### have a .w3m, and to not depend on whatever is in that if it
39 #### does already exist, overwrite $HOME if using w3m.
40 HOME
="$MHTMPDIR"; export HOME
43 echo "$0: skipping -reformat check because no text browser was found"
44 can_reformat_texthtml
=0
49 cat >"$expected" <<EOF
50 Usage: mhfixmsg [+folder] [msgs] [switches]
72 run_prog mhfixmsg
-help >"$actual" 2>&1
73 check
"$expected" "$actual"
77 case `mhfixmsg -version` in
79 *) printf '%s: mhfixmsg -version generated unexpected output\n' "$0" >&2
80 failed
=`expr ${failed:-0} + 1`;;
84 # check that non-MIME messages aren't modified
86 run_test
'mhfixmsg first -outfile '"$actual" ''
87 check
"`mhpath first`" "$actual" 'keep first'
90 # check that non-MIME messages with no bodies aren't modified
92 cat >`mhpath new` <<EOF
93 From: Test <test@example.com>
94 To: Some User <user@example.com>
95 Date: Fri, 29 Sep 2006 00:00:00
97 Subject: message with no body
100 run_test
'mhfixmsg last -outfile '"$actual" ''
101 check
"`mhpath last`" "$actual"
105 cat >"$MH_TEST_DIR"/Mail
/inbox
/11 <<EOF
108 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
109 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
111 Content-Type: MULTIPART/MIXED;
112 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
113 Content-Transfer-Encoding: QUOTED-PRINTABLE
115 This message is in MIME format. The first part should be readable
117 while the remaining parts are likely unreadable without MIME-aware
120 ------=_NextPart_000_0000_00000000.00000000
121 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
122 Content-Transfer-Encoding: 8BIT
124 Some text in swedish.
126 Varf=C3=B6r inte anv=C3=A4nda...
128 ------=_NextPart_000_0000_00000000.00000000--
130 And some text after the last part.
133 cp -p "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12
135 run_test
'mhfixmsg last -nofixcte' ''
136 check
"$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12 'keep first'
139 # check -fixcte (enabled by default): fixup of erroneous C-T-E in multipart
141 cat >"$expected" <<EOF
144 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
145 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
147 Content-Type: MULTIPART/MIXED;
148 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
149 Nmh-REPLACED-INVALID-Content-Transfer-Encoding: QUOTED-PRINTABLE
150 Content-Transfer-Encoding: 8bit
152 This message is in MIME format. The first part should be readable
154 while the remaining parts are likely unreadable without MIME-aware
157 ------=_NextPart_000_0000_00000000.00000000
158 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
159 Content-Transfer-Encoding: 8BIT
161 Some text in swedish.
163 Varf=C3=B6r inte anv=C3=A4nda...
165 ------=_NextPart_000_0000_00000000.00000000--
167 And some text after the last part.
170 run_test
'mhfixmsg last -outfile '"$actual"' -verbose' \
171 "mhfixmsg: 11, replace Content-Transfer-Encoding of \
172 QUOTED-PRINTABLE with 8 bit"
173 check
"$expected" "$actual" 'keep first'
176 # check with no options: checks backup
177 cp "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
178 folder last
>/dev
/null
179 run_test
'mhfixmsg' ''
180 check
"$expected" "$MH_TEST_DIR"/Mail
/inbox
/11 'keep first'
181 cp "$MH_TEST_DIR"/Mail
/inbox
/11.original
"$MH_TEST_DIR"/Mail
/inbox
/11
182 check
"$MH_TEST_DIR"/Mail
/inbox
/,11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
185 # check backup with -file
186 cp "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
187 folder last
>/dev
/null
188 run_test
'mhfixmsg -file '"$MH_TEST_DIR"/Mail
/inbox
/11 ''
189 check
"$MH_TEST_DIR"/Mail
/inbox
/11 "$expected" 'keep first'
190 check
"$MH_TEST_DIR"/Mail
/inbox
/,11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
193 # check -reformat (enabled by default): addition of text/plain part
194 # to solitary text/html part
196 prepare_space
>"$expected" <<EOF
198 From: sender@example.com
199 To: bonquiqui@example.com
201 Date: Sat, 26 Jan 2013 17:37:53 -0500
202 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
204 ------=_nmh-multipart
205 Content-Type: text/plain; charset="Windows-1252"
206 Content-Transfer-Encoding: 8bit
208 Need to go! Need ... to ... go!
210 ------=_nmh-multipart
211 Content-Type: text/html; charset="Windows-1252"
212 Content-Transfer-Encoding: 8bit
216 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
217 <meta name="Generator" content="Microsoft Exchange Server">
218 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
222 <div>Need to go! Need ... to ... go!</div>
226 ------=_nmh-multipart--
229 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
231 From: sender@example.com
232 To: bonquiqui@example.com
234 Date: Sat, 26 Jan 2013 17:37:53 -0500
235 Content-Type: text/html; charset="Windows-1252"
236 Content-Transfer-Encoding: quoted-printable
240 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
242 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
243 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
244 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
248 <div>Need to go! Need ... to ... go!</div>
253 if [ $can_reformat_texthtml -eq 1 ]; then
254 printf '%s\n' "mhfixmsg: 12, insert text/plain part
255 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
258 #### lynx inserts multiple blank lines, so squeeze them.
259 run_prog mhfixmsg last
-outfile - -verbose 2>"$actual.err" | \
260 squeeze_lines
>"$actual"
261 check
"$expected" "$actual" 'ignore space'
262 check
"$expected.err" "$actual.err"
268 # check implicit -file with absolute pathname
269 run_test
"mhfixmsg `mhpath last` -outfile /dev/null" ''
272 # check handling of boundary string that appears in message body
274 prepare_space
>"$expected" <<EOF
276 From: sender@example.com
277 To: bonquiqui@example.com
279 Date: Sat, 26 Jan 2013 17:37:53 -0500
280 Content-Type: multipart/alternative; boundary="----=_nmh-multipart-3"
282 ------=_nmh-multipart-3
283 Content-Type: text/plain; charset="Windows-1252"
284 Content-Transfer-Encoding: 8bit
286 ------=_nmh-multipart
287 ------=_nmh-multipart-1
288 ------=_nmh-multipart-2
290 ------=_nmh-multipart-3
291 Content-Type: text/html; charset="Windows-1252"
292 Content-Transfer-Encoding: 8bit
296 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
297 <meta name="Generator" content="Microsoft Exchange Server">
298 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
301 ------=_nmh-multipart<br>
302 ------=_nmh-multipart-1<br>
303 ------=_nmh-multipart-2<br>
307 ------=_nmh-multipart-3--
310 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
312 From: sender@example.com
313 To: bonquiqui@example.com
315 Date: Sat, 26 Jan 2013 17:37:53 -0500
316 Content-Type: text/html; charset="Windows-1252"
317 Content-Transfer-Encoding: quoted-printable
321 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
323 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
324 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
325 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
328 ------=3D_nmh-multipart<br>
329 ------=3D_nmh-multipart-1<br>
330 ------=3D_nmh-multipart-2<br>
335 if [ $can_reformat_texthtml -eq 1 ]; then
336 printf '%s\n' "mhfixmsg: 12, insert text/plain part
337 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
340 #### lynx inserts multiple blank lines, so squeeze them.
341 run_prog mhfixmsg last
-outfile - -verbose 2>"$actual.err" | \
342 squeeze_lines
>"$actual"
343 check
"$expected" "$actual" 'ignore space'
344 check
"$expected.err" "$actual.err"
351 prepare_space
>"$expected" <<EOF
353 From: sender@example.com
354 To: bonquiqui@example.com
356 Date: Sat, 26 Jan 2013 17:37:53 -0500
357 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
359 ------=_nmh-multipart
360 Content-Type: text/plain; charset="Windows-1252"
361 Content-Transfer-Encoding: 8bit
363 Need to go! Need ... to ... go!
365 ------=_nmh-multipart
366 Content-Type: text/html; charset="Windows-1252"
367 Content-Transfer-Encoding: quoted-printable
371 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-=
373 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
374 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pa=
375 dding-left: 4pt; border-left: #800000 2px solid; } --></style>
379 <div>Need to go! Need ... to ... go!</div>
383 ------=_nmh-multipart--
386 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
388 From: sender@example.com
389 To: bonquiqui@example.com
391 Date: Sat, 26 Jan 2013 17:37:53 -0500
392 Content-Type: text/html; charset="Windows-1252"
393 Content-Transfer-Encoding: quoted-printable
397 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
399 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
400 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
401 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
405 <div>Need to go! Need ... to ... go!</div>
410 if [ $can_reformat_texthtml -eq 1 ]; then
411 printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
413 #### lynx inserts multiple blank lines, so squeeze them.
414 run_prog mhfixmsg last
-nodecode -outfile - -verbose 2>"$actual.err" | \
415 squeeze_lines
>"$actual"
416 check
"$expected" "$actual" 'ignore space'
417 check
"$expected.err" "$actual.err"
423 # check -decodetext (enabled by default)
424 cat >"$expected" <<EOF
425 To: recipient@example.com
426 From: sender@example.com
427 Subject: mhfixmsg decode test 1
429 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
431 ------- =_aaaaaaaaaa0
432 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
433 Content-Disposition: attachment; filename="test4.txt"
434 Content-Transfer-Encoding: 8bit
436 This is a text/plain part.
438 ------- =_aaaaaaaaaa0--
441 cat >`mhpath new` <<EOF
442 To: recipient@example.com
443 From: sender@example.com
444 Subject: mhfixmsg decode test 1
446 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
448 ------- =_aaaaaaaaaa0
449 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
450 Content-Disposition: attachment; filename="test4.txt"
451 Content-Transfer-Encoding: base64
453 VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K
455 ------- =_aaaaaaaaaa0--
458 run_prog mhfixmsg last
-outfile "$actual"
459 check
"$expected" "$actual"
462 # check -decodetext with more complicated content structure
464 To: recipient@example.com
465 From: sender@example.com
466 Subject: mhfixmsg decode test 2
468 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
470 This is additional content before the first subpart of the multipart.
472 ------- =_aaaaaaaaaa0
473 Content-Type: multipart/related;
474 type="text/plain"; boundary="subpart__1.1"
477 Content-Type: text/plain; charset="iso-8859-1"
478 Content-Disposition: attachment; filename="test1.txt"
480 This is the first text/plain part, in a subpart.
484 This is additional content after the last subpart of the multipart.
486 ------- =_aaaaaaaaaa0
487 Content-Type: text/plain; charset="iso-8859-1"
488 Content-Disposition: attachment; filename="test2.txt"
489 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
490 Content-Transfer-Encoding: 8bit
492 This is the second text/plain part.
494 ------- =_aaaaaaaaaa0
495 Content-Type: text/plain; charset="iso-8859-1"
496 Content-Disposition: attachment; filename="test3.txt"
498 This is the third text/plain part.
500 ------- =_aaaaaaaaaa0
501 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
502 Content-Disposition: attachment; filename="test4.txt"
503 Content-Transfer-Encoding: 8bit
505 This is the fourth text/plain part.
507 ------- =_aaaaaaaaaa0--
509 This is additional content after the last subpart of the multipart.
512 cat >`mhpath new` <<EOF
513 To: recipient@example.com
514 From: sender@example.com
515 Subject: mhfixmsg decode test 2
517 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
519 This is additional content before the first subpart of the multipart.
521 ------- =_aaaaaaaaaa0
522 Content-Type: multipart/related;
523 type="text/plain"; boundary="subpart__1.1"
526 Content-Type: text/plain; charset="iso-8859-1"
527 Content-Disposition: attachment; filename="test1.txt"
529 This is the first text/plain part, in a subpart.
533 This is additional content after the last subpart of the multipart.
535 ------- =_aaaaaaaaaa0
536 Content-Type: text/plain; charset="iso-8859-1"
537 Content-Disposition: attachment; filename="test2.txt"
538 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
539 Content-Transfer-Encoding: quoted-printable
541 This is the second text/plain part.
543 ------- =_aaaaaaaaaa0
544 Content-Type: text/plain; charset="iso-8859-1"
545 Content-Disposition: attachment; filename="test3.txt"
547 This is the third text/plain part.
549 ------- =_aaaaaaaaaa0
550 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
551 Content-Disposition: attachment; filename="test4.txt"
552 Content-Transfer-Encoding: base64
554 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
556 ------- =_aaaaaaaaaa0--
558 This is additional content after the last subpart of the multipart.
560 run_prog mhfixmsg last
-outfile "$actual"
561 check
"$expected" "$actual"
564 # check attempted -decodetext of binary text
565 #### Generated the encoded text below with:
566 #### $ printf '\x0\xbd\xb2=\xbc\n' | base64
567 cat >`mhpath new` <<EOF
568 To: recipient@example.com
569 From: sender@example.com
570 Subject: mhfixmsg attempted binary decode test
572 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
574 ------- =_aaaaaaaaaa0
575 Content-Type: text/plain; charset="iso-8859-1"; name="nul+square.txt"
576 Content-Transfer-Encoding: base64
580 ------- =_aaaaaaaaaa0--
583 cp -p `mhpath last` "$expected"
584 run_prog mhfixmsg last
585 check
`mhpath last` "$expected" 'keep first'
588 # check for successful decode of a different part with attempted -decodetext
590 #### Generated the encoded text below with:
591 #### $ printf '\x0\xbd\xb2=\xbc\n' | base64
593 To: recipient@example.com
594 From: sender@example.com
595 Subject: mhfixmsg successful decode of text/plain with failed binary decode
597 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
599 ------- =_aaaaaaaaaa0
600 Content-Type: text/plain; charset="iso-8859-1"
601 Content-Transfer-Encoding: 8bit
603 This is a text plain part
605 ------- =_aaaaaaaaaa0
606 Content-Type: text/html; charset="ascii"
607 Content-Transfer-Encoding: base64
608 Content-Disposition: inline
610 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
611 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
612 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
613 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
614 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
615 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
616 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
617 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
618 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
619 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
620 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
621 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
622 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
623 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
624 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
625 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
626 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
627 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
628 ICA8L2JvZHk+PC9odG1sPg==
630 ------- =_aaaaaaaaaa0--
633 cat >`mhpath new` <<EOF
634 To: recipient@example.com
635 From: sender@example.com
636 Subject: mhfixmsg successful decode of text/plain with failed binary decode
638 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
640 ------- =_aaaaaaaaaa0
641 Content-Type: text/plain; charset="iso-8859-1"
642 Content-Transfer-Encoding: base64
644 VGhpcyBpcyBhIHRleHQgcGxhaW4gcGFydAo=
646 ------- =_aaaaaaaaaa0
647 Content-Type: text/html; charset="ascii"
648 Content-Transfer-Encoding: base64
649 Content-Disposition: inline
651 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
652 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
653 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
654 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
655 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
656 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
657 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
658 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
659 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
660 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
661 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
662 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
663 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
664 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
665 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
666 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
667 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
668 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
669 ICA8L2JvZHk+PC9odG1sPg==
671 ------- =_aaaaaaaaaa0--
674 run_prog mhfixmsg
-noreformat last
675 check
`mhpath last` "$expected"
678 # check -decodetext of binary text
679 printf "%s\x0d\xbd\xb2=\xbc%s" "To: recipient@example.com
680 From: sender@example.com
681 Subject: mhfixmsg binary decode test
683 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
685 ------- =_aaaaaaaaaa0
686 Content-Type: text/plain; charset=\"iso-8859-1\"; name=\"nul+square.txt\"
687 Content-Transfer-Encoding: binary
691 ------- =_aaaaaaaaaa0--
693 ## output_content() in mhoutsbr.c can't handle binary content.
694 ## mhfixmsg last -decodetext binary -outfile "$actual"
695 ## check "$expected" "$actual"
700 # check that -reformat succeeds when decode of binary text fails
701 prepare_space
>"$expected" <<'EOF'
703 Date: Thu, 11 Apr 2013 02:47:08 -0700
705 From: <sender@example.com>
706 Subject: body requires binary encoding
707 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
709 ------=_nmh-multipart
710 Content-Type: text/plain; charset="ISO-8859-1"
711 Content-Transfer-Encoding: 8bit
716 Vehicle License Fee $1.84
719 ------=_nmh-multipart
720 Content-Type: text/html; charset="ISO-8859-1"
721 Content-Transfer-Encoding: quoted-printable
726 cat >`mhpath new` <<'EOF'
728 Content-Type: text/html; charset="ISO-8859-1"
729 Content-Transfer-Encoding: quoted-printable
730 Date: Thu, 11 Apr 2013 02:47:08 -0700
732 From: <sender@example.com>
733 Subject: body requires binary encoding
736 <table width=3D"325" border=3D"0" cellspacing=3D"0" cellpadding=3D"0">
737 <tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
738 =3D"2"><strong>Mile</strong></font></td><td height=3D"3"> </td><td ali=
739 gn=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" =
740 size=3D"2">$0.00</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sa=
741 ns-serif" color=3D"#333333" size=3D"2"><strong>Time</strong></font></td><td=
742 height=3D"3"> </td><td align=3D"right"><font face=3D"Arial, Helvetica=
743 , sans-serif" color=3D"#333333" size=3D"2">$78.71</font></td></tr><tr><td><=
744 font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=3D"2"><st=
745 rong>State Tax</strong></font></td><td height=3D"3"> </td><td align=3D=
746 "right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
747 =3D"2">$5.90</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sans-s=
748 erif" color=3D"#333333" size=3D"2"><strong>Vehicle License Fee</strong></fo=
749 nt></td><td height=3D"3"> </td><td align=3D"right"><font face=3D"Arial=
750 , Helvetica, sans-serif" color=3D"#333333" size=3D"2">$1.84</font></td></tr=
751 ><tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
752 =3D"2"><strong>State Txn Tax</strong></font></td><td height=3D"3"> </t=
753 d><td align=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"=
754 #333333" size=3D"2">$6.00</font></td></tr>
760 if [ $can_reformat_texthtml -eq 1 ]; then
761 #### lynx inserts multiple blank lines, so squeeze them.
762 #### Truncate to avoid comparing the html portion because it can
763 #### get reformatted.
764 run_prog mhfixmsg last
-outfile - | squeeze_lines
| head -22 >"$actual"
765 check
"$expected" "$actual" 'ignore space'
767 cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup"
773 # Also checks preservation of attributes after one (charset) that is
775 cat >"$expected" <<EOF
776 To: recipient@example.com
777 From: sender@example.com
778 Subject: mhfixmsg textcharset test
780 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
782 ------- =_aaaaaaaaaa0
783 Content-Type: text/plain; charset="utf-8"; name="square.txt"
784 Content-Disposition: attachment; filename="square.txt"
785 Content-Transfer-Encoding: 8bit
789 ------- =_aaaaaaaaaa0--
792 #### Generated the encoded text below with:
793 #### $ printf '\xbd\xb2=\xbc\n' | base64
794 cat >`mhpath new` <<EOF
795 To: recipient@example.com
796 From: sender@example.com
797 Subject: mhfixmsg textcharset test
799 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
801 ------- =_aaaaaaaaaa0
802 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
803 Content-Disposition: attachment; filename="square.txt"
804 Content-Transfer-Encoding: base64
808 ------- =_aaaaaaaaaa0--
811 if test "$ICONV_ENABLED" -eq 1; then
812 run_prog mhfixmsg last
-textcharset utf
-8 -outfile "$actual" 2>&1
813 check
"$expected" "$actual"
815 echo "$0: skipping -textcharset check because nmh was built without iconv"
820 # check -nofixboundary
821 cat >"$expected" <<EOF
824 cat >`mhpath new` <<EOF
825 Date: Fri, 13 May 2011 08:21:12 -0500
826 Content-Type: multipart/alternative;
827 boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
828 Content-Transfer-Encoding: 8bit
830 From: <sender@example.com>
831 To: <recipient@example.com>
832 Subject: mhfixmsg bad boundary test
834 This is a multi-part message in MIME format.
836 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
837 Content-Type: text/plain
839 The boundaries of this part don't match the header boundary.
841 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
844 cp -p `mhpath last` `mhpath new`
846 run_test
'mhfixmsg last -nofixboundary' ''
847 check
"$MH_TEST_DIR"/Mail
/inbox
/17 "$MH_TEST_DIR"/Mail
/inbox
/18 'keep first'
850 # check that message is not output when fed through stdin
851 run_prog mhfixmsg
-file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
852 check
"$expected" "$actual"
853 if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
854 "$actual.err" >/dev
/null
; then
857 echo "$0: test failed, output is in $actual.err."
858 failed
=`expr ${failed:-0} + 1`
862 # check fixup of erroneous boundary in multipart (-fixboundary,
863 # enabled by default)
865 cat >"$expected" <<EOF
866 Date: Fri, 13 May 2011 08:21:12 -0500
867 Content-Type: multipart/alternative;
868 boundary="----=_NextPart_000_1781A1A_01CC1147.81EBA8D4"
869 Content-Transfer-Encoding: 8bit
871 From: <sender@example.com>
872 To: <recipient@example.com>
873 Subject: mhfixmsg bad boundary test
875 This is a multi-part message in MIME format.
877 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
878 Content-Type: text/plain
880 The boundaries of this part don't match the header boundary.
882 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
885 run_test
'mhfixmsg last -outfile '"$actual"' -verbose' \
886 "mhfixmsg: 17, fix multipart boundary"
887 check
"$expected" "$actual"
890 # check that text/plain part is not added to text/html in multipart/related
891 # when it shouldn't be
892 cat >`mhpath new` <<EOF
894 Date: Tue, 26 Feb 2013 18:07:20 -0600
895 Subject: multipart/related, not /alternative
896 Content-Type: multipart/related;
897 type="text/html"; boundary="----=_Part_90310_101292502.1"
899 ------=_Part_90310_101292502.1
900 Content-Type: text/html; charset="us-ascii"
901 Content-Transfer-Encoding: 7bit
904 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
905 <title>HTML Content</title>
908 This is the real content.
912 ------=_Part_90310_101292502.1
913 Content-Type: text/plain; charset="us-ascii"
914 Content-Transfer-Encoding: 7bit
916 Your email client does not support HTML messages
918 ------=_Part_90310_101292502.1--
921 cp -p `mhpath last` "$expected"
923 if [ $can_reformat_texthtml -eq 1 ]; then
924 #### lynx inserts multiple blank lines, so squeeze them.
925 run_prog mhfixmsg last
-outfile - | squeeze_lines
>"$actual"
926 check
"$expected" "$actual" 'ignore space'
932 # check that text/plain part is added to text/html in multipart/related
934 cat >"$expected" <<EOF
936 Date: Tue, 26 Feb 2013 18:07:20 -0600
937 Subject: multipart/related, not /alternative
938 Content-Type: multipart/alternative; boundary="----=_Part_90310_101292502.1"
940 ------=_Part_90310_101292502.1
941 Content-Type: text/plain; charset="us-ascii"
942 Content-Transfer-Encoding: 7bit
944 This is the real content.
946 ------=_Part_90310_101292502.1
947 Content-Type: text/html; charset="us-ascii"
948 Content-Transfer-Encoding: 7bit
951 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
952 <title>HTML Content</title>
955 This is the real content.
959 ------=_Part_90310_101292502.1--
962 cat >`mhpath new` <<EOF
964 Date: Tue, 26 Feb 2013 18:07:20 -0600
965 Subject: multipart/related, not /alternative
966 Content-Type: multipart/related;
967 type="text/html"; boundary="----=_Part_90310_101292502.1"
969 ------=_Part_90310_101292502.1
970 Content-Type: text/html; charset="us-ascii"
971 Content-Transfer-Encoding: 7bit
974 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
975 <title>HTML Content</title>
978 This is the real content.
982 ------=_Part_90310_101292502.1--
985 if [ $can_reformat_texthtml -eq 1 ]; then
986 #### lynx inserts multiple blank lines, so squeeze them.
987 run_prog mhfixmsg last
-outfile - | squeeze_lines
>"$actual"
988 check
"$expected" "$actual" 'ignore space'
994 # check handling of rfc822 message type
995 cat >"$expected" <<EOF
996 From: Test <test@example.com>
997 To: Some User <user@example.com>
998 Date: Fri, 29 Sep 2006 00:00:00
999 Message-Id: @test.nmh
1000 Subject: message with message/rfc822 attachment
1002 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1004 and some garbage before the attachment
1006 ------- =_aaaaaaaaaa0
1007 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1008 Content-Description: 1552
1009 Content-Disposition: attachment; filename="1552"
1011 From: Test <test@example.com>
1012 To: <another_user@example.com>
1013 Date: Thu, 28 Sep 2006 00:00:00
1014 Message-Id: @test.nmh
1015 Subject: message/rfc822 attachment
1017 This is an RFC-822 message.
1019 ------- =_aaaaaaaaaa0--
1021 and some garbage at the end
1024 cat >`mhpath new` <<EOF
1025 From: Test <test@example.com>
1026 To: Some User <user@example.com>
1027 Date: Fri, 29 Sep 2006 00:00:00
1028 Message-Id: @test.nmh
1029 Subject: message with message/rfc822 attachment
1031 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaa0"
1033 and some garbage before the attachment
1035 ------- =_aaaaaaaaaa0
1036 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1037 Content-Description: 1552
1038 Content-Disposition: attachment; filename="1552"
1040 From: Test <test@example.com>
1041 To: <another_user@example.com>
1042 Date: Thu, 28 Sep 2006 00:00:00
1043 Message-Id: @test.nmh
1044 Subject: message/rfc822 attachment
1046 This is an RFC-822 message.
1048 ------- =_aaaaaaaaaa0--
1050 and some garbage at the end
1053 run_test
'mhfixmsg last -outfile '"$actual" ''
1054 check
"$expected" "$actual"
1057 # check not stripping of CRs from ASCII text context (default)
1058 cat >"$expected" <<EOF
1060 From: sender@example.com
1061 To: recipient@example.com
1062 Subject: message with CR's
1063 Date: Mon, 29 Apr 2013 11:51:45 -0400
1065 There are two CR-LF pairs at the end of this sentence.
1069 cat >`mhpath new` <<'EOF'
1071 From: sender@example.com
1072 To: recipient@example.com
1073 Subject: message with CR's
1074 Date: Mon, 29 Apr 2013 11:51:45 -0400
1076 There are two CR-LF pairs at the end of this sentence.
1080 run_prog mhfixmsg last
-outfile "$actual"
1081 check
"$expected" "$actual"
1084 # check stripping of CRs from ASCII text context
1085 cat >"$expected" <<EOF
1087 From: sender@example.com
1088 To: recipient@example.com
1089 Subject: message with CR's
1090 Date: Mon, 29 Apr 2013 11:51:45 -0400
1092 There were two CR-LF pairs at the end of this sentence.
1096 cat >`mhpath new` <<'EOF'
1098 From: sender@example.com
1099 To: recipient@example.com
1100 Subject: message with CR's
1101 Date: Mon, 29 Apr 2013 11:51:45 -0400
1103 There were two CR-LF pairs at the end of this sentence.
1107 run_prog mhfixmsg last
-outfile "$actual" -nocrlflinebreaks
1108 check
"$expected" "$actual"
1111 # check -replacetextplain
1112 prepare_space
>"$expected" <<EOF
1113 To: recipient@example.com
1114 From: sender@example.com
1115 Subject: mhfixmsg replacement of bad text/plain part test
1117 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1120 Content-Type: text/plain; charset="UTF-8"
1121 Content-Transfer-Encoding: 8bit
1123 Yes, the text/plain part really was empty.
1126 Content-Type: text/html; charset="UTF-8"
1127 Content-Transfer-Encoding: 8bit
1128 Content-Disposition: inline
1131 <title>eticket</title>
1134 Yes, the text/plain part really was empty.
1138 ------=_Part_876302--
1141 cat >`mhpath new` <<'EOF'
1142 To: recipient@example.com
1143 From: sender@example.com
1144 Subject: mhfixmsg replacement of bad text/plain part test
1146 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1149 Content-Type: text/plain; charset="iso-8859-15"
1150 Content-Transfer-Encoding: 7bit
1151 Content-Disposition: inline
1156 Content-Type: text/html; charset="UTF-8"
1157 Content-Transfer-Encoding: 8bit
1158 Content-Disposition: inline
1161 <title>eticket</title>
1164 Yes, the text/plain part really was empty.
1168 ------=_Part_876302--
1171 if [ $can_reformat_texthtml -eq 1 ]; then
1172 #### lynx inserts multiple blank lines, so squeeze them.
1173 run_prog mhfixmsg last
-replacetextplain -outfile - | \
1174 squeeze_lines
> "$actual"
1175 check
"$expected" "$actual" 'ignore space'
1181 # check -noreplacetextplain
1182 cat >"$expected" <<EOF
1183 To: recipient@example.com
1184 From: sender@example.com
1185 Subject: mhfixmsg replacement of bad text/plain part test
1187 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1190 Content-Type: text/plain; charset="iso-8859-15"
1191 Content-Transfer-Encoding: 7bit
1192 Content-Disposition: inline
1197 Content-Type: text/html; charset="UTF-8"
1198 Content-Transfer-Encoding: 8bit
1199 Content-Disposition: inline
1202 <title>eticket</title>
1205 Yes, the text/plain part really was empty.
1209 ------=_Part_876302--
1212 run_prog mhfixmsg last
-replacetextplain -noreplacetextplain -outfile "$actual"
1213 check
"$expected" "$actual"
1216 # check removal of extraneous trailing semicolon from header parameter list
1217 cat >"$expected" <<EOF
1218 To: recipient@example.com
1220 From: sender@example.com
1222 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1224 ------- =_aaaaaaaaaa0
1225 Content-Type: text/plain; charset="us-ascii"
1229 ------- =_aaaaaaaaaa0
1230 Content-Type: text/plain; charset="us-ascii";
1232 Content-Description: check folded headers, with and without trailing semicolon
1233 Content-Disposition: attachment;
1238 ------- =_aaaaaaaaaa0--
1241 cat >`mhpath new` <<EOF
1242 To: recipient@example.com
1244 From: sender@example.com
1246 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1248 ------- =_aaaaaaaaaa0
1249 Content-Type: text/plain; charset="us-ascii";
1253 ------- =_aaaaaaaaaa0
1254 Content-Type: text/plain; charset="us-ascii";
1256 Content-Description: check folded headers, with and without trailing semicolon
1257 Content-Disposition: attachment;
1262 ------- =_aaaaaaaaaa0--
1264 run_test
'mhfixmsg last -outfile '"$actual" ''
1265 check
"$expected" "$actual"
1269 cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF'
1272 chmod a
+x
"${MH_TEST_DIR}/Mail/rmmproc"
1273 echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH"
1274 cp "${MH_TEST_DIR}/Mail/inbox/15" "${MH_TEST_DIR}/Mail/inbox/15.original"
1276 run_test
'mhfixmsg 15' ''
1277 check
"${MH_TEST_DIR}/Mail/inbox/15.backup" \
1278 "${MH_TEST_DIR}/Mail/inbox/15.original"
1282 cp "${MH_TEST_DIR}/Mail/inbox/19" "${MH_TEST_DIR}/Mail/inbox/20"
1284 run_test
'mhfixmsg 19 -normmproc'
1285 check
"${MH_TEST_DIR}/Mail/inbox/20" \
1286 "${MH_TEST_DIR}/Mail/inbox/,19" 'keep first'
1290 run_test
'mhfixmsg 20 -rmmproc true'
1291 if test -f '${MH_TEST_DIR}/Mail/inbox/20.backup'; then
1292 echo check of mhfixmsg
-rmmproc FAILED
, should not have created backup
file
1293 failed
=`expr ${failed:-0} + 1`
1298 cat >"$expected" <<EOF
1299 To: recipient@example.com
1300 From: sender@example.com
1301 Subject: mhfixmsg with incorrect Content-Type
1303 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1305 ------- =_aaaaaaaaaa0
1306 Content-Type: text/plain; name="plaintext.txt"
1310 ------- =_aaaaaaaaaa0--
1313 cat >`mhpath new` <<EOF
1314 To: recipient@example.com
1315 From: sender@example.com
1316 Subject: mhfixmsg with incorrect Content-Type
1318 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1320 ------- =_aaaaaaaaaa0
1321 Content-Type: application/octet-stream; name="plaintext.txt"
1325 ------- =_aaaaaaaaaa0--
1328 mhfixmsg
-fixtype application
/octet
-stream last
1329 check
"$expected" `mhpath last`
1332 # check default -decodetypes
1333 cat >$expected <<EOF
1334 To: recipient@example.com
1335 From: sender@example.com
1336 Subject: mhfixmsg decode test 3
1338 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1340 ------- =_aaaaaaaaaa0
1341 Content-Type: text/plain; charset="iso-8859-1"
1342 Content-Disposition: attachment; filename="test1.txt"
1343 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1344 Content-Transfer-Encoding: 8bit
1346 This is the text/plain part.
1348 ------- =_aaaaaaaaaa0
1349 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1350 Content-Disposition: attachment; filename="test2.txt"
1351 Content-Transfer-Encoding: 8bit
1355 This was the text/html part.
1360 ------- =_aaaaaaaaaa0--
1363 cat >`mhpath new` <<EOF
1364 To: recipient@example.com
1365 From: sender@example.com
1366 Subject: mhfixmsg decode test 3
1368 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1370 ------- =_aaaaaaaaaa0
1371 Content-Type: text/plain; charset="iso-8859-1"
1372 Content-Disposition: attachment; filename="test1.txt"
1373 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1374 Content-Transfer-Encoding: quoted-printable
1376 This is the text/plain part.
1378 ------- =_aaaaaaaaaa0
1379 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1380 Content-Disposition: attachment; filename="test2.txt"
1381 Content-Transfer-Encoding: base64
1383 PGh0bWw+CjxoZWFkPgogICAgVGhpcyB3YXMgdGhlIHRleHQvaHRtbCBwYXJ0Lgo8L2hlYWQ+Cjwv
1384 Ym9keT4KPC9odG1sPgo=
1386 ------- =_aaaaaaaaaa0--
1388 run_prog mhfixmsg last
-outfile "$actual" -noreformat
1389 check
"$expected" "$actual"
1392 # check -decodetypes text/plain
1393 cat >$expected <<EOF
1394 To: recipient@example.com
1395 From: sender@example.com
1396 Subject: mhfixmsg decode test 4
1398 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1400 ------- =_aaaaaaaaaa0
1401 Content-Type: text/plain; charset="iso-8859-1"
1402 Content-Disposition: attachment; filename="test1.txt"
1403 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1404 Content-Transfer-Encoding: 8bit
1406 This is the text/plain part.
1408 ------- =_aaaaaaaaaa0
1409 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1410 Content-Disposition: attachment; filename="test2.txt"
1411 Content-Transfer-Encoding: base64
1413 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1414 CjwvYm9keT4NCjwvaHRtbD4NCg==
1416 ------- =_aaaaaaaaaa0--
1419 cat >`mhpath new` <<EOF
1420 To: recipient@example.com
1421 From: sender@example.com
1422 Subject: mhfixmsg decode test 4
1424 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1426 ------- =_aaaaaaaaaa0
1427 Content-Type: text/plain; charset="iso-8859-1"
1428 Content-Disposition: attachment; filename="test1.txt"
1429 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1430 Content-Transfer-Encoding: quoted-printable
1432 This is the text/plain part.
1434 ------- =_aaaaaaaaaa0
1435 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1436 Content-Disposition: attachment; filename="test2.txt"
1437 Content-Transfer-Encoding: base64
1439 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1440 CjwvYm9keT4NCjwvaHRtbD4NCg==
1442 ------- =_aaaaaaaaaa0--
1444 run_prog mhfixmsg last
-outfile "$actual" -decodetypes text
/plain
-noreformat
1445 check
"$expected" "$actual"
1448 # check -decodetypes attachment/ics
1449 cat >$expected <<EOF
1450 To: recipient@example.com
1451 From: sender@example.com
1452 Subject: mhfixmsg decode test 5
1454 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1456 ------- =_aaaaaaaaaa0
1457 Content-Type: text/plain; charset="iso-8859-1"
1458 Content-Disposition: attachment; filename="test1.txt"
1459 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1460 Content-Transfer-Encoding: 8bit
1462 This is the text/plain part.
1464 ------- =_aaaaaaaaaa0
1465 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1466 Content-Disposition: attachment; filename="invite.ics"
1467 Content-Transfer-Encoding: 8bit
1473 DTSTAMP:20150101T162400Z
1474 DTSTART:20150105T160000
1475 DTEND:20150105T163000
1476 SUMMARY:4 pm meeting
1480 ------- =_aaaaaaaaaa0--
1483 cat >`mhpath new` <<EOF
1484 To: recipient@example.com
1485 From: sender@example.com
1486 Subject: mhfixmsg decode test 5
1488 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1490 ------- =_aaaaaaaaaa0
1491 Content-Type: text/plain; charset="iso-8859-1"
1492 Content-Disposition: attachment; filename="test1.txt"
1493 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1494 Content-Transfer-Encoding: quoted-printable
1499 ------- =_aaaaaaaaaa0
1500 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1501 Content-Disposition: attachment; filename="invite.ics"
1502 Content-Transfer-Encoding: base64
1504 QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
1505 RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
1506 CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
1507 CkVORDpWQ0FMRU5EQVINCg==
1509 ------- =_aaaaaaaaaa0--
1511 run_prog mhfixmsg last
-outfile "$actual" -noreformat
1512 check
"$expected" "$actual"
1515 # check -decodetypes attachment/ics and -nocrlflinebreaks
1516 cat >$expected <<EOF
1517 To: recipient@example.com
1518 From: sender@example.com
1519 Subject: mhfixmsg decode test 5
1521 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1523 ------- =_aaaaaaaaaa0
1524 Content-Type: text/plain; charset="iso-8859-1"
1525 Content-Disposition: attachment; filename="test1.txt"
1526 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1527 Content-Transfer-Encoding: 8bit
1529 This is the text/plain part.
1531 ------- =_aaaaaaaaaa0
1532 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1533 Content-Disposition: attachment; filename="invite.ics"
1534 Content-Transfer-Encoding: 8bit
1540 DTSTAMP:20150101T162400Z
1541 DTSTART:20150105T160000
1542 DTEND:20150105T163000
1543 SUMMARY:4 pm meeting
1547 ------- =_aaaaaaaaaa0--
1550 cat >`mhpath new` <<EOF
1551 To: recipient@example.com
1552 From: sender@example.com
1553 Subject: mhfixmsg decode test 5
1555 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1557 ------- =_aaaaaaaaaa0
1558 Content-Type: text/plain; charset="iso-8859-1"
1559 Content-Disposition: attachment; filename="test1.txt"
1560 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1561 Content-Transfer-Encoding: quoted-printable
1566 ------- =_aaaaaaaaaa0
1567 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1568 Content-Disposition: attachment; filename="invite.ics"
1569 Content-Transfer-Encoding: base64
1571 QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
1572 RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
1573 CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
1574 CkVORDpWQ0FMRU5EQVINCg==
1576 ------- =_aaaaaaaaaa0--
1578 run_prog mhfixmsg last
-outfile "$actual" -nocrlflinebreaks -noreformat
1579 check
"$expected" "$actual"
1582 # make sure there are no tmp files left over
1583 find "$MH_TEST_DIR/Mail" \
( -name 'mhfix*' -o -name ',mhfix*' \
) -print \
1585 cat >"$expected" <<EOF
1588 check
"$expected" "$actual"