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 .
"${srcdir}/test/post/test-post-common.sh"
18 expected
="$MH_TEST_DIR/test-mhfixmsg$$.expected"
19 expected_err
="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
20 actual
="$MH_TEST_DIR/test-mhfixmsg$$.actual"
21 actual_err
="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
24 if grep mhfixmsg
-format-text/html
"${MH_TEST_DIR}/Mail/mhn.defaults" \
26 can_reformat_texthtml
=1
28 echo "$0: skipping -reformat check because
29 mhfixmsg-format-text/html is not available"
30 can_reformat_texthtml
=0
36 # Verified behavior consistent with compiled sendmail.
37 cat >"$expected" <<EOF
38 Usage: mhfixmsg [+folder] [msgs] [switches]
55 mhfixmsg
-help >"$actual" 2>&1
56 check
"$expected" "$actual"
60 # Verified same behavior as compiled mhfixmsg.
61 case `mhfixmsg -version` in
63 *) printf '%s: mhfixmsg -version generated unexpected output\n' "$0" >&2
64 failed
=`expr ${failed:-0} + 1`;;
68 # check that non-MIME messages aren't modified
70 run_test
'mhfixmsg first -outfile '"$actual" ''
71 check
"`mhpath first`" "$actual" 'keep first'
74 # check that non-MIME messages with no bodies aren't modified
76 cat >`mhpath new` <<EOF
77 From: Test <test@example.com>
78 To: Some User <user@example.com>
79 Date: Fri, 29 Sep 2006 00:00:00
81 Subject: message with no body
84 run_test
'mhfixmsg last -outfile '"$actual" ''
85 check
"`mhpath last`" "$actual"
89 cat >"$MH_TEST_DIR"/Mail
/inbox
/11 <<EOF
92 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
93 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
95 Content-Type: MULTIPART/MIXED;
96 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
97 Content-Transfer-Encoding: QUOTED-PRINTABLE
99 This message is in MIME format. The first part should be readable
101 while the remaining parts are likely unreadable without MIME-aware
104 ------=_NextPart_000_0000_00000000.00000000
105 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
106 Content-Transfer-Encoding: 8BIT
108 Some text in swedish.
110 Varf=C3=B6r inte anv=C3=A4nda...
112 ------=_NextPart_000_0000_00000000.00000000--
114 And some text after the last part.
117 cp -p "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12
119 run_test
'mhfixmsg last -nofixcte' ''
120 check
"$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/12 'keep first'
123 # check -fixcte (enabled by default): fixup of erroneous C-T-E in multipart
125 cat >"$expected" <<EOF
128 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
129 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
131 Content-Type: MULTIPART/MIXED;
132 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
133 Nmh-REPLACED-INVALID-Content-Transfer-Encoding: QUOTED-PRINTABLE
134 Content-Transfer-Encoding: 8bit
136 This message is in MIME format. The first part should be readable
138 while the remaining parts are likely unreadable without MIME-aware
141 ------=_NextPart_000_0000_00000000.00000000
142 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
143 Content-Transfer-Encoding: 8BIT
145 Some text in swedish.
147 Varf=C3=B6r inte anv=C3=A4nda...
149 ------=_NextPart_000_0000_00000000.00000000--
151 And some text after the last part.
154 run_test
'mhfixmsg last -outfile '"$actual"' -verbose' \
155 "mhfixmsg: 11, replace Content-Transfer-Encoding of \
156 QUOTED-PRINTABLE with 8 bit"
157 check
"$expected" "$actual" 'keep first'
160 # check with no options: checks backup
161 cp "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
162 folder last
>/dev
/null
163 run_test
'mhfixmsg' ''
164 check
"$expected" "$MH_TEST_DIR"/Mail
/inbox
/11 'keep first'
165 cp "$MH_TEST_DIR"/Mail
/inbox
/11.original
"$MH_TEST_DIR"/Mail
/inbox
/11
166 check
"$MH_TEST_DIR"/Mail
/inbox
/,11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
169 # check backup with -file
170 cp "$MH_TEST_DIR"/Mail
/inbox
/11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
171 folder last
>/dev
/null
172 run_test
'mhfixmsg -file '"$MH_TEST_DIR"/Mail
/inbox
/11 ''
173 check
"$MH_TEST_DIR"/Mail
/inbox
/11 "$expected" 'keep first'
174 check
"$MH_TEST_DIR"/Mail
/inbox
/,11 "$MH_TEST_DIR"/Mail
/inbox
/11.original
177 # check -reformat (enabled by default): addition of text/plain part
178 # to solitary text/html part
180 cat >"$expected" <<EOF
182 From: sender@example.com
183 To: bonquiqui@example.com
185 Date: Sat, 26 Jan 2013 17:37:53 -0500
186 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
188 ------=_nmh-multipart
189 Content-Type: text/plain; charset="Windows-1252"
190 Content-Transfer-Encoding: 8bit
192 Need to go! Need ... to ... go!
194 ------=_nmh-multipart
195 Content-Type: text/html; charset="Windows-1252"
196 Content-Transfer-Encoding: 8bit
200 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
201 <meta name="Generator" content="Microsoft Exchange Server">
202 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
206 <div>Need to go! Need ... to ... go!</div>
210 ------=_nmh-multipart--
213 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
215 From: sender@example.com
216 To: bonquiqui@example.com
218 Date: Sat, 26 Jan 2013 17:37:53 -0500
219 Content-Type: text/html; charset="Windows-1252"
220 Content-Transfer-Encoding: quoted-printable
224 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
226 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
227 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
228 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
232 <div>Need to go! Need ... to ... go!</div>
237 if [ $can_reformat_texthtml -eq 1 ]; then
238 printf '%s\n' "mhfixmsg: 12, insert text/plain part
239 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
242 #### lynx inserts multiple blank lines, so use uniq to squeeze them.
243 mhfixmsg last
-outfile - -verbose 2>"$actual.err" | uniq >"$actual"
244 check
"$expected" "$actual"
245 check
"$expected.err" "$actual.err"
249 # check handling of boundary string that appears in message body
251 cat >"$expected" <<EOF
253 From: sender@example.com
254 To: bonquiqui@example.com
256 Date: Sat, 26 Jan 2013 17:37:53 -0500
257 Content-Type: multipart/alternative; boundary="----=_nmh-multipart-3"
259 ------=_nmh-multipart-3
260 Content-Type: text/plain; charset="Windows-1252"
261 Content-Transfer-Encoding: 8bit
263 ------=_nmh-multipart
264 ------=_nmh-multipart-1
265 ------=_nmh-multipart-2
267 ------=_nmh-multipart-3
268 Content-Type: text/html; charset="Windows-1252"
269 Content-Transfer-Encoding: 8bit
273 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
274 <meta name="Generator" content="Microsoft Exchange Server">
275 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
278 ------=_nmh-multipart<br>
279 ------=_nmh-multipart-1<br>
280 ------=_nmh-multipart-2<br>
284 ------=_nmh-multipart-3--
287 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
289 From: sender@example.com
290 To: bonquiqui@example.com
292 Date: Sat, 26 Jan 2013 17:37:53 -0500
293 Content-Type: text/html; charset="Windows-1252"
294 Content-Transfer-Encoding: quoted-printable
298 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
300 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
301 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
302 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
305 ------=3D_nmh-multipart<br>
306 ------=3D_nmh-multipart-1<br>
307 ------=3D_nmh-multipart-2<br>
312 if [ $can_reformat_texthtml -eq 1 ]; then
313 printf '%s\n' "mhfixmsg: 12, insert text/plain part
314 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
317 #### lynx inserts multiple blank lines, so use uniq to squeeze them.
318 mhfixmsg last
-outfile - -verbose 2>"$actual.err" | uniq >"$actual"
319 check
"$expected" "$actual"
320 check
"$expected.err" "$actual.err"
325 cat >"$expected" <<EOF
327 From: sender@example.com
328 To: bonquiqui@example.com
330 Date: Sat, 26 Jan 2013 17:37:53 -0500
331 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
333 ------=_nmh-multipart
334 Content-Type: text/plain; charset="Windows-1252"
335 Content-Transfer-Encoding: 8bit
337 Need to go! Need ... to ... go!
339 ------=_nmh-multipart
340 Content-Type: text/html; charset="Windows-1252"
341 Content-Transfer-Encoding: quoted-printable
345 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-=
347 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
348 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pa=
349 dding-left: 4pt; border-left: #800000 2px solid; } --></style>
353 <div>Need to go! Need ... to ... go!</div>
357 ------=_nmh-multipart--
360 cat >"$MH_TEST_DIR"/Mail
/inbox
/12 <<EOF
362 From: sender@example.com
363 To: bonquiqui@example.com
365 Date: Sat, 26 Jan 2013 17:37:53 -0500
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-1=
373 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
374 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
375 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
379 <div>Need to go! Need ... to ... go!</div>
384 if [ $can_reformat_texthtml -eq 1 ]; then
385 printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
387 #### lynx inserts multiple blank lines, so use uniq to squeeze them.
388 mhfixmsg last
-nodecode -outfile - -verbose 2>"$actual.err" | uniq >"$actual"
389 check
"$expected" "$actual"
390 check
"$expected.err" "$actual.err"
394 # check -decode (enabled by default)
395 cat >"$expected" <<EOF
396 To: recipient@example.com
397 From: sender@example.com
398 Subject: mhfixmsg decode test
400 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
402 ------- =_aaaaaaaaaa0
403 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
404 Content-Disposition: attachment; filename="test4.txt"
405 Content-Transfer-Encoding: 8bit
407 This is a text/plain part.
409 ------- =_aaaaaaaaaa0--
414 To: recipient@example.com
415 From: sender@example.com
416 Subject: mhfixmsg decode test
418 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
420 ------- =_aaaaaaaaaa0
421 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
422 Content-Disposition: attachment; filename="test4.txt"
423 Content-Transfer-Encoding: base64
425 VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K
427 ------- =_aaaaaaaaaa0--
430 mhfixmsg last
-outfile "$actual"
431 check
"$expected" "$actual"
434 # check -decode with more complicated content structure
436 To: recipient@example.com
437 From: sender@example.com
438 Subject: mhfixmsg decode test 2
440 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
442 This is additional content before the first subpart of the multipart.
444 ------- =_aaaaaaaaaa0
445 Content-Type: multipart/related;
446 type="multipart/alternative";
447 boundary="subpart__1.1"
450 Content-Type: text/plain; charset="iso-8859-1"
451 Content-Disposition: attachment; filename="test1.txt"
453 This is the first text/plain part, in a subpart.
457 This is additional content after the last subpart of the multipart.
459 ------- =_aaaaaaaaaa0
460 Content-Type: text/plain; charset="iso-8859-1"
461 Content-Disposition: attachment; filename="test2.txt"
462 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
463 Content-Transfer-Encoding: 8bit
465 This is the second text/plain part.
467 ------- =_aaaaaaaaaa0
468 Content-Type: text/plain; charset="iso-8859-1"
469 Content-Disposition: attachment; filename="test3.txt"
471 This is the third text/plain part.
473 ------- =_aaaaaaaaaa0
474 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
475 Content-Disposition: attachment; filename="test4.txt"
476 Content-Transfer-Encoding: 8bit
478 This is the fourth text/plain part.
480 ------- =_aaaaaaaaaa0--
482 This is additional content after the last subpart of the multipart.
487 To: recipient@example.com
488 From: sender@example.com
489 Subject: mhfixmsg decode test 2
491 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
493 This is additional content before the first subpart of the multipart.
495 ------- =_aaaaaaaaaa0
496 Content-Type: multipart/related;
497 type="multipart/alternative";
498 boundary="subpart__1.1"
501 Content-Type: text/plain; charset="iso-8859-1"
502 Content-Disposition: attachment; filename="test1.txt"
504 This is the first text/plain part, in a subpart.
508 This is additional content after the last subpart of the multipart.
510 ------- =_aaaaaaaaaa0
511 Content-Type: text/plain; charset="iso-8859-1"
512 Content-Disposition: attachment; filename="test2.txt"
513 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
514 Content-Transfer-Encoding: quoted-printable
516 This is the second text/plain part.
518 ------- =_aaaaaaaaaa0
519 Content-Type: text/plain; charset="iso-8859-1"
520 Content-Disposition: attachment; filename="test3.txt"
522 This is the third text/plain part.
524 ------- =_aaaaaaaaaa0
525 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
526 Content-Disposition: attachment; filename="test4.txt"
527 Content-Transfer-Encoding: base64
529 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
531 ------- =_aaaaaaaaaa0--
533 This is additional content after the last subpart of the multipart.
535 mhfixmsg last
-outfile "$actual"
536 check
"$expected" "$actual"
539 # check attempted -decode of binary text
540 #### Generated the encoded text below with:
541 #### $ printf '\x0d\xbd\xb2=\xbc\n' | base64
544 To: recipient@example.com
545 From: sender@example.com
546 Subject: mhfixmsg attempted binary decode test
548 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
550 ------- =_aaaaaaaaaa0
551 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
552 Content-Transfer-Encoding: base64
556 ------- =_aaaaaaaaaa0--
559 cp -p `mhpath last` "$expected"
561 check
`mhpath last` "$expected" 'keep first'
564 # check -decode of binary text
565 printf "%s\x0d\xbd\xb2=\xbc%s" "To: recipient@example.com
566 From: sender@example.com
567 Subject: mhfixmsg binary decode test
569 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
571 ------- =_aaaaaaaaaa0
572 Content-Type: text/plain; charset=\"iso-8859-1\"; name=\"square.txt\"
573 Content-Transfer-Encoding: binary
577 ------- =_aaaaaaaaaa0--
579 ## output_content() in mhoutsbr.c can't handle binary content.
580 ## mhfixmsg last -decodetext binary -outfile "$actual"
581 ## check "$expected" "$actual"
587 # Also checks preservation of attributes after one (charset) that is
589 cat >"$expected" <<EOF
590 To: recipient@example.com
591 From: sender@example.com
592 Subject: mhfixmsg textcodeset test
594 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
596 ------- =_aaaaaaaaaa0
597 Content-Type: text/plain; charset="utf-8"; name="square.txt"
598 Content-Disposition: attachment; filename="square.txt"
599 Content-Transfer-Encoding: 8bit
603 ------- =_aaaaaaaaaa0--
606 #### Generated the encoded text below with:
607 #### $ printf '\xbd\xb2=\xbc\n' | base64
610 To: recipient@example.com
611 From: sender@example.com
612 Subject: mhfixmsg textcodeset test
614 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
616 ------- =_aaaaaaaaaa0
617 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
618 Content-Disposition: attachment; filename="square.txt"
619 Content-Transfer-Encoding: base64
623 ------- =_aaaaaaaaaa0--
627 mhfixmsg last
-textcodeset utf
-8 -outfile "$actual" 2>"$actual.err"
628 if grep "mhfixmsg: Can't convert .* to .* without iconv" "$actual.err" \
630 echo skipping
-textcodeset check because nmh was built without
iconv
632 rm -f "$expected" "$actual" "$actual.err"
635 check
"$expected" "$actual"
640 # check -nofixboundary
641 cat >"$expected" <<EOF
644 cat >`mhpath new` <<EOF
645 Date: Fri, 13 May 2011 08:21:12 -0500
646 Content-Type: multipart/alternative;
647 boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
648 Content-Transfer-Encoding: 8bit
650 From: <sender@example.com>
651 To: <recipient@example.com>
652 Subject: mhfixmsg bad boundary test
654 This is a multi-part message in MIME format.
656 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
657 Content-Type: text/plain
659 The boundaries of this part don't match the header boundary.
661 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
664 cp -p `mhpath last` `mhpath new`
666 run_test
'mhfixmsg last -nofixboundary' ''
667 check
"$MH_TEST_DIR"/Mail
/inbox
/16 "$MH_TEST_DIR"/Mail
/inbox
/17 'keep first'
670 # check that message is not output when fed through stdin
671 mhfixmsg
-file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
672 check
"$expected" "$actual"
673 if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
674 "$actual.err" >/dev
/null
; then
677 echo "$0: test failed, output is in $actual.err."
678 failed
=`expr ${failed:-0} + 1`
682 # check fixup of erroneous boundary in multipart (-fixboundary,
683 # enabled by default)
685 cat >"$expected" <<EOF
686 Date: Fri, 13 May 2011 08:21:12 -0500
687 Content-Type: multipart/alternative;
688 boundary="----=_NextPart_000_1781A1A_01CC1147.81EBA8D4"
689 Content-Transfer-Encoding: 8bit
691 From: <sender@example.com>
692 To: <recipient@example.com>
693 Subject: mhfixmsg bad boundary test
695 This is a multi-part message in MIME format.
697 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
698 Content-Type: text/plain
700 The boundaries of this part don't match the header boundary.
702 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
705 run_test
'mhfixmsg last -outfile '"$actual"' -verbose' \
706 "mhfixmsg: 16, fix multipart boundary"
707 check
"$expected" "$actual"
710 # check that text/plain part is added to lone text/html in multipart/related
711 cat >"$expected" <<EOF
713 Date: Tue, 26 Feb 2013 18:07:20 -0600
714 Subject: multipart/related, not /alternative
715 Content-Type: multipart/related;
716 boundary="----=_Part_90310_101292502.1"
718 ------=_Part_90310_101292502.1
719 Content-Type: multipart/alternative; boundary="----=_nmh-multipart1"
721 ------=_nmh-multipart1
722 Content-Type: text/plain; charset="us-ascii"
723 Content-Transfer-Encoding: 7bit
725 This is the real content.
727 ------=_nmh-multipart1
728 Content-Type: text/html; charset="us-ascii"
729 Content-Transfer-Encoding: 7bit
732 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
733 <title>HTML Content</title>
736 This is the real content.
740 ------=_nmh-multipart1--
742 ------=_Part_90310_101292502.1
743 Content-Type: text/plain; charset="us-ascii"
744 Content-Transfer-Encoding: 7bit
746 Your email client does not support HTML messages
748 ------=_Part_90310_101292502.1--
751 cat >`mhpath new` <<EOF
753 Date: Tue, 26 Feb 2013 18:07:20 -0600
754 Subject: multipart/related, not /alternative
755 Content-Type: multipart/related;
756 boundary="----=_Part_90310_101292502.1"
758 ------=_Part_90310_101292502.1
759 Content-Type: text/html; charset="us-ascii"
760 Content-Transfer-Encoding: 7bit
763 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
764 <title>HTML Content</title>
767 This is the real content.
770 ------=_Part_90310_101292502.1
771 Content-Type: text/plain; charset="us-ascii"
772 Content-Transfer-Encoding: 7bit
774 Your email client does not support HTML messages
775 ------=_Part_90310_101292502.1--
778 if [ $can_reformat_texthtml -eq 1 ]; then
779 #### lynx inserts multiple blank lines, so use uniq to squeeze them.
780 mhfixmsg last
-outfile - | uniq >"$actual"
781 check
"$expected" "$actual"
786 # check handling of rfc822 message type
787 cat >"$expected" <<EOF
788 From: Test <test@example.com>
789 To: Some User <user@example.com>
790 Date: Fri, 29 Sep 2006 00:00:00
791 Message-Id: @test.nmh
792 Subject: message with message/rfc822 attachment
794 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
796 and some garbage before the attachment
798 ------- =_aaaaaaaaaa0
799 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
800 Content-Description: 1552
801 Content-Disposition: attachment; filename="1552"
803 From: Test <test@example.com>
804 To: <another_user@example.com>
805 Date: Thu, 28 Sep 2006 00:00:00
806 Message-Id: @test.nmh
807 Subject: message/rfc822 attachment
809 This is an RFC-822 message.
811 ------- =_aaaaaaaaaa0--
813 and some garbage at the end
816 cat >`mhpath new` <<EOF
817 From: Test <test@example.com>
818 To: Some User <user@example.com>
819 Date: Fri, 29 Sep 2006 00:00:00
820 Message-Id: @test.nmh
821 Subject: message with message/rfc822 attachment
823 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaa0"
825 and some garbage before the attachment
827 ------- =_aaaaaaaaaa0
828 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
829 Content-Description: 1552
830 Content-Disposition: attachment; filename="1552"
832 From: Test <test@example.com>
833 To: <another_user@example.com>
834 Date: Thu, 28 Sep 2006 00:00:00
835 Message-Id: @test.nmh
836 Subject: message/rfc822 attachment
838 This is an RFC-822 message.
840 ------- =_aaaaaaaaaa0--
842 and some garbage at the end
845 run_test
'mhfixmsg last -outfile '"$actual" ''
846 check
"$expected" "$actual"
850 cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF'
853 chmod a
+x
"${MH_TEST_DIR}/Mail/rmmproc"
854 echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH"
855 cp "${MH_TEST_DIR}/Mail/inbox/14" "${MH_TEST_DIR}/Mail/inbox/14.original"
857 run_test
'mhfixmsg 14' ''
858 check
"${MH_TEST_DIR}/Mail/inbox/14.backup" \
859 "${MH_TEST_DIR}/Mail/inbox/14.original"
863 cp "${MH_TEST_DIR}/Mail/inbox/18" "${MH_TEST_DIR}/Mail/inbox/19"
865 run_test
'mhfixmsg 18 -normmproc'
866 check
"${MH_TEST_DIR}/Mail/inbox/19" \
867 "${MH_TEST_DIR}/Mail/inbox/,18" 'keep first'
871 run_test
'mhfixmsg 19 -rmmproc true'
872 if test -f '${MH_TEST_DIR}/Mail/inbox/19.backup'; then
873 echo check of mhfixmsg
-rmmproc FAILED
, should not have created backup
file
874 failed
=`expr ${failed:-0} + 1`
878 # make sure there are no tmp files left over
879 find "$MH_TEST_DIR/Mail" \
( -name 'mhfix*' -o -name ',mhfix*' \
) -print \
881 cat >"$expected" <<EOF
884 check
"$expected" "$actual"