]> diplodocus.org Git - nmh/blob - test/mhfixmsg/test-mhfixmsg
mh-mkstemp.man: Detail exit status as 255 rather than -1.
[nmh] / test / mhfixmsg / test-mhfixmsg
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhfixmsg
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "${MH_OBJ_DIR}/test/common.sh"
16
17 setup_test
18
19 check_exit '-eq 1' mhfixmsg - # gcov
20
21 #### Make sure that html-to-text conversion is what we expect.
22 require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
23
24 expected="$MH_TEST_DIR/test-mhfixmsg$$.expected"
25 expected_err="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
26 actual="$MH_TEST_DIR/test-mhfixmsg$$.actual"
27 actual_err="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
28
29 mhn_defaults="$MH_INST_DIR${nmhetcdir}/mhn.defaults"
30
31 if grep mhfixmsg-format-text/html "${mhn_defaults}" \
32 >/dev/null; then
33 can_reformat_texthtml=1
34 if grep 'mhfixmsg-format-text/html.*w3m' "${mhn_defaults}" \
35 >/dev/null; then
36 #### w3m uses $HOME/.w3m/, and creates it if it doesn't exist. To
37 #### support testing with non-writeable $HOME, and to not leave
38 #### relics from this test if it is writeable but doesn't already
39 #### have a .w3m, and to not depend on whatever is in that if it
40 #### does already exist, overwrite $HOME if using w3m.
41 HOME="$MHTMPDIR"; export HOME
42 fi
43 else
44 echo "$0: skipping -reformat check because no text browser was found"
45 can_reformat_texthtml=0
46 fi
47
48
49 # check -help
50 start_test "-help"
51 cat >"$expected" <<EOF
52 Usage: mhfixmsg [+folder] [msgs] [switches]
53 switches are:
54 -decodetext 8bit|7bit|binary
55 -nodecodetext
56 -decodetypes
57 -[no]crlflinebreaks
58 -[no]textcharset
59 -[no]reformat
60 -[no]replacetextplain
61 -[no]fixboundary
62 -[no]fixcte
63 -fixtype mimetype
64 -file file
65 -outfile file
66 -rmmproc program
67 -normmproc
68 -[no]changecur
69 -[no]verbose
70 -version
71 -help
72 EOF
73
74 #### Skip nmh intro text.
75 run_prog mhfixmsg -help | sed '/^$/,$d' >"$actual" 2>&1
76 check "$expected" "$actual"
77
78
79 # check -version
80 start_test "-version"
81 case `mhfixmsg -version` in
82 mhfixmsg\ --*) ;;
83 *) printf '%s: mhfixmsg -version generated unexpected output\n' "$0" >&2
84 failed=`expr ${failed:-0} + 1`;;
85 esac
86
87
88 # check that non-MIME messages aren't modified
89 # check -outfile
90 start_test "that non-MIME messages aren't modified, and -outfile"
91 run_test 'mhfixmsg first -outfile '"$actual" ''
92 check "`mhpath first`" "$actual" 'keep first'
93
94
95 # check that non-MIME messages with no bodies aren't modified
96 # check -outfile
97 start_test "that non-MIME messages with no bodies aren't modified, and -outfile"
98 cat >`mhpath new` <<EOF
99 From: Test <test@example.com>
100 To: Some User <user@example.com>
101 Date: Fri, 29 Sep 2006 00:00:00
102 Message-Id: @test.nmh
103 Subject: message with no body
104 EOF
105
106 run_test 'mhfixmsg last -outfile '"$actual" ''
107 check "`mhpath last`" "$actual"
108
109
110 # check -nofixcte
111 start_test "-nofixcte"
112 cat >"$MH_TEST_DIR"/Mail/inbox/11 <<EOF
113 From: Anon
114 To: Mailinglist
115 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
116 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
117 MIME-Version: 1.0
118 Content-Type: MULTIPART/MIXED;
119 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
120 Content-Transfer-Encoding: QUOTED-PRINTABLE
121
122 This message is in MIME format. The first part should be readable
123 text,
124 while the remaining parts are likely unreadable without MIME-aware
125 tools.
126
127 ------=_NextPart_000_0000_00000000.00000000
128 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
129 Content-Transfer-Encoding: 8BIT
130
131 Some text in swedish.
132
133 Varf=C3=B6r inte anv=C3=A4nda...
134
135 ------=_NextPart_000_0000_00000000.00000000--
136
137 And some text after the last part.
138 EOF
139
140 cp -p "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/12
141
142 run_test 'mhfixmsg last -nofixcte' ''
143 check "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/12 'keep first'
144
145
146 # check -fixcte (enabled by default): fixup of erroneous C-T-E in multipart
147 # check -verbose
148 start_test "-fixcte (enabled by default): fixup of erroneous C-T-E in multipart, and -verbose"
149 cat >"$expected" <<EOF
150 From: Anon
151 To: Mailinglist
152 Subject: =?ISO-8859-15?Q?Re=3A_H=E5lla_linuxsystem_uppdaterade?=
153 User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
154 MIME-Version: 1.0
155 Content-Type: MULTIPART/MIXED;
156 BOUNDARY="----=_NextPart_000_0000_00000000.00000000"
157 Nmh-REPLACED-INVALID-Content-Transfer-Encoding: QUOTED-PRINTABLE
158 Content-Transfer-Encoding: 8bit
159
160 This message is in MIME format. The first part should be readable
161 text,
162 while the remaining parts are likely unreadable without MIME-aware
163 tools.
164
165 ------=_NextPart_000_0000_00000000.00000000
166 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15
167 Content-Transfer-Encoding: 8BIT
168
169 Some text in swedish.
170
171 Varf=C3=B6r inte anv=C3=A4nda...
172
173 ------=_NextPart_000_0000_00000000.00000000--
174
175 And some text after the last part.
176 EOF
177
178 run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \
179 "mhfixmsg: 11, replace Content-Transfer-Encoding of \
180 QUOTED-PRINTABLE with 8 bit"
181 check "$expected" "$actual" 'keep first'
182
183
184 # check with no options: checks backup
185 start_test "with no options: checks backup"
186 cp "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/11.original
187 folder last >/dev/null
188 run_test 'mhfixmsg' ''
189 check "$expected" "$MH_TEST_DIR"/Mail/inbox/11 'keep first'
190 cp "$MH_TEST_DIR"/Mail/inbox/11.original "$MH_TEST_DIR"/Mail/inbox/11
191 check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original
192
193
194 # check backup with -file
195 start_test "backup with -file"
196 cp "$MH_TEST_DIR"/Mail/inbox/11 "$MH_TEST_DIR"/Mail/inbox/11.original
197 folder last >/dev/null
198 run_test 'mhfixmsg -file '"$MH_TEST_DIR"/Mail/inbox/11 ''
199 check "$MH_TEST_DIR"/Mail/inbox/11 "$expected" 'keep first'
200 check "$MH_TEST_DIR"/Mail/inbox/,11 "$MH_TEST_DIR"/Mail/inbox/11.original
201
202
203 # check -reformat (enabled by default): addition of text/plain part
204 # to solitary text/html part
205 start_test "-reformat (enabled by default): addition of text/plain part"
206 prepare_space >"$expected" <<EOF
207 MIME-Version: 1.0
208 From: sender@example.com
209 To: bonquiqui@example.com
210 Subject: rue
211 Date: Sat, 26 Jan 2013 17:37:53 -0500
212 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
213
214 ------=_nmh-multipart
215 Content-Type: text/plain; charset="Windows-1252"
216 Content-Transfer-Encoding: 7bit
217
218 Need to go! Need ... to ... go!
219
220 ------=_nmh-multipart
221 Content-Type: text/html; charset="Windows-1252"
222 Content-Transfer-Encoding: 7bit
223
224 <html>
225 <head>
226 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
227 <meta name="Generator" content="Microsoft Exchange Server">
228 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
229 </head>
230 <body>
231 <div>
232 <div>Need to go! Need ... to ... go!</div>
233 </body>
234 </html>
235
236 ------=_nmh-multipart--
237 EOF
238
239 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
240 MIME-Version: 1.0
241 From: sender@example.com
242 To: bonquiqui@example.com
243 Subject: rue
244 Date: Sat, 26 Jan 2013 17:37:53 -0500
245 Content-Type: text/html; charset="Windows-1252"
246 Content-Transfer-Encoding: quoted-printable
247
248 <html>
249 <head>
250 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
251 252">
252 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
253 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
254 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
255 </head>
256 <body>
257 <div>
258 <div>Need to go! Need ... to ... go!</div>
259 </body>
260 </html>
261 EOF
262
263 if [ $can_reformat_texthtml -eq 1 ]; then
264 printf '%s\n' "mhfixmsg: 12, insert text/plain part
265 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
266 >"$expected.err"
267
268 #### lynx inserts multiple blank lines, so squeeze them.
269 run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
270 squeeze_lines >"$actual"
271 check "$expected" "$actual" 'ignore space'
272 check "$expected.err" "$actual.err"
273 else
274 rm -f "$expected"
275 fi
276
277
278 # check implicit -file with absolute pathname
279 start_test "implicit -file with absolute pathname"
280 run_test "mhfixmsg `mhpath last` -outfile /dev/null" ''
281
282
283 # check handling of boundary string that appears in message body
284 start_test "handling of boundary string that appears in message body"
285 prepare_space >"$expected" <<EOF
286 MIME-Version: 1.0
287 From: sender@example.com
288 To: bonquiqui@example.com
289 Subject: rue
290 Date: Sat, 26 Jan 2013 17:37:53 -0500
291 Content-Type: multipart/alternative; boundary="----=_nmh-multipart-3"
292
293 ------=_nmh-multipart-3
294 Content-Type: text/plain; charset="Windows-1252"
295 Content-Transfer-Encoding: 7bit
296
297 ------=_nmh-multipart
298 ------=_nmh-multipart-1
299 ------=_nmh-multipart-2
300
301 ------=_nmh-multipart-3
302 Content-Type: text/html; charset="Windows-1252"
303 Content-Transfer-Encoding: 7bit
304
305 <html>
306 <head>
307 <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
308 <meta name="Generator" content="Microsoft Exchange Server">
309 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
310 </head>
311 <body>
312 ------=_nmh-multipart<br>
313 ------=_nmh-multipart-1<br>
314 ------=_nmh-multipart-2<br>
315 </body>
316 </html>
317
318 ------=_nmh-multipart-3--
319 EOF
320
321 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
322 MIME-Version: 1.0
323 From: sender@example.com
324 To: bonquiqui@example.com
325 Subject: rue
326 Date: Sat, 26 Jan 2013 17:37:53 -0500
327 Content-Type: text/html; charset="Windows-1252"
328 Content-Transfer-Encoding: quoted-printable
329
330 <html>
331 <head>
332 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
333 252">
334 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
335 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
336 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
337 </head>
338 <body>
339 ------=3D_nmh-multipart<br>
340 ------=3D_nmh-multipart-1<br>
341 ------=3D_nmh-multipart-2<br>
342 </body>
343 </html>
344 EOF
345
346 if [ $can_reformat_texthtml -eq 1 ]; then
347 printf '%s\n' "mhfixmsg: 12, insert text/plain part
348 mhfixmsg: 12 part 1, decode text/html; charset=\"Windows-1252\"" \
349 >"$expected.err"
350
351 #### lynx inserts multiple blank lines, so squeeze them.
352 run_prog mhfixmsg last -outfile - -verbose 2>"$actual.err" | \
353 squeeze_lines >"$actual"
354 check "$expected" "$actual" 'ignore space'
355 check "$expected.err" "$actual.err"
356 else
357 rm -f "$expected"
358 fi
359
360
361 # check -nodecode
362 start_test "-nodecode"
363 prepare_space >"$expected" <<EOF
364 MIME-Version: 1.0
365 From: sender@example.com
366 To: bonquiqui@example.com
367 Subject: rue
368 Date: Sat, 26 Jan 2013 17:37:53 -0500
369 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
370
371 ------=_nmh-multipart
372 Content-Type: text/plain; charset="Windows-1252"
373 Content-Transfer-Encoding: 7bit
374
375 Need to go! Need ... to ... go!
376
377 ------=_nmh-multipart
378 Content-Type: text/html; charset="Windows-1252"
379 Content-Transfer-Encoding: quoted-printable
380
381 <html>
382 <head>
383 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-=
384 1252">
385 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
386 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pa=
387 dding-left: 4pt; border-left: #800000 2px solid; } --></style>
388 </head>
389 <body>
390 <div>
391 <div>Need to go! Need ... to ... go!</div>
392 </body>
393 </html>
394
395 ------=_nmh-multipart--
396 EOF
397
398 cat >"$MH_TEST_DIR"/Mail/inbox/12 <<EOF
399 MIME-Version: 1.0
400 From: sender@example.com
401 To: bonquiqui@example.com
402 Subject: rue
403 Date: Sat, 26 Jan 2013 17:37:53 -0500
404 Content-Type: text/html; charset="Windows-1252"
405 Content-Transfer-Encoding: quoted-printable
406
407 <html>
408 <head>
409 <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
410 252">
411 <meta name=3D"Generator" content=3D"Microsoft Exchange Server">
412 <!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; pad=
413 ding-left: 4pt; border-left: #800000 2px solid; } --></style>
414 </head>
415 <body>
416 <div>
417 <div>Need to go! Need ... to ... go!</div>
418 </body>
419 </html>
420 EOF
421
422 if [ $can_reformat_texthtml -eq 1 ]; then
423 printf '%s\n' 'mhfixmsg: 12, insert text/plain part' >"$expected.err"
424
425 #### lynx inserts multiple blank lines, so squeeze them.
426 run_prog mhfixmsg last -nodecode -outfile - -verbose 2>"$actual.err" | \
427 squeeze_lines >"$actual"
428 check "$expected" "$actual" 'ignore space'
429 check "$expected.err" "$actual.err"
430 else
431 rm -f "$expected"
432 fi
433
434
435 # check -decodetext (enabled by default)
436 start_test "-decodetext (enabled by default)"
437 cat >"$expected" <<EOF
438 To: recipient@example.com
439 From: sender@example.com
440 Subject: mhfixmsg decode test 1
441 MIME-Version: 1.0
442 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
443
444 ------- =_aaaaaaaaaa0
445 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
446 Content-Disposition: attachment; filename="test4.txt"
447 Content-Transfer-Encoding: 7bit
448
449 This is a text/plain part.
450
451 ------- =_aaaaaaaaaa0--
452 EOF
453
454 cat >`mhpath new` <<EOF
455 To: recipient@example.com
456 From: sender@example.com
457 Subject: mhfixmsg decode test 1
458 MIME-Version: 1.0
459 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
460
461 ------- =_aaaaaaaaaa0
462 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
463 Content-Disposition: attachment; filename="test4.txt"
464 Content-Transfer-Encoding: base64
465
466 VGhpcyBpcyBhIHRleHQvcGxhaW4gcGFydC4K
467
468 ------- =_aaaaaaaaaa0--
469 EOF
470
471 run_prog mhfixmsg last -outfile "$actual"
472 check "$expected" "$actual"
473
474
475 # check -decodetext with more complicated content structure
476 start_test "-decodetext with more complicated content structure"
477 cat >$expected <<EOF
478 To: recipient@example.com
479 From: sender@example.com
480 Subject: mhfixmsg decode test 2
481 MIME-Version: 1.0
482 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
483
484 This is additional content before the first subpart of the multipart.
485
486 ------- =_aaaaaaaaaa0
487 Content-Type: multipart/related;
488 type="text/plain"; boundary="subpart__1.1"
489
490 --subpart__1.1
491 Content-Type: text/plain; charset="iso-8859-1"
492 Content-Disposition: attachment; filename="test1.txt"
493
494 This is the first text/plain part, in a subpart.
495
496 --subpart__1.1--
497
498 This is additional content after the last subpart of the multipart.
499
500 ------- =_aaaaaaaaaa0
501 Content-Type: text/plain; charset="iso-8859-1"
502 Content-Disposition: attachment; filename="test2.txt"
503 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
504 Content-Transfer-Encoding: 7bit
505
506 This is the second text/plain part.
507
508 ------- =_aaaaaaaaaa0
509 Content-Type: text/plain; charset="iso-8859-1"
510 Content-Disposition: attachment; filename="test3.txt"
511
512 This is the third text/plain part.
513
514 ------- =_aaaaaaaaaa0
515 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
516 Content-Disposition: attachment; filename="test4.txt"
517 Content-Transfer-Encoding: 7bit
518
519 This is the fourth text/plain part.
520
521 ------- =_aaaaaaaaaa0--
522
523 This is additional content after the last subpart of the multipart.
524 EOF
525
526 cat >`mhpath new` <<EOF
527 To: recipient@example.com
528 From: sender@example.com
529 Subject: mhfixmsg decode test 2
530 MIME-Version: 1.0
531 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
532
533 This is additional content before the first subpart of the multipart.
534
535 ------- =_aaaaaaaaaa0
536 Content-Type: multipart/related;
537 type="text/plain"; boundary="subpart__1.1"
538
539 --subpart__1.1
540 Content-Type: text/plain; charset="iso-8859-1"
541 Content-Disposition: attachment; filename="test1.txt"
542
543 This is the first text/plain part, in a subpart.
544
545 --subpart__1.1--
546
547 This is additional content after the last subpart of the multipart.
548
549 ------- =_aaaaaaaaaa0
550 Content-Type: text/plain; charset="iso-8859-1"
551 Content-Disposition: attachment; filename="test2.txt"
552 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
553 Content-Transfer-Encoding: quoted-printable
554
555 This is the second text/plain part.
556
557 ------- =_aaaaaaaaaa0
558 Content-Type: text/plain; charset="iso-8859-1"
559 Content-Disposition: attachment; filename="test3.txt"
560
561 This is the third text/plain part.
562
563 ------- =_aaaaaaaaaa0
564 Content-Type: text/plain; charset="iso-8859-1"; name="test4.txt"
565 Content-Disposition: attachment; filename="test4.txt"
566 Content-Transfer-Encoding: base64
567
568 VGhpcyBpcyB0aGUgZm91cnRoIHRleHQvcGxhaW4gcGFydC4K
569
570 ------- =_aaaaaaaaaa0--
571
572 This is additional content after the last subpart of the multipart.
573 EOF
574 run_prog mhfixmsg last -outfile "$actual"
575 check "$expected" "$actual"
576
577
578 # check attempted (default, 8 bit) -decodetext of binary text
579 #### Generated the encoded text below with:
580 #### $ printf '\275\262=\274\000\n' | base64
581 start_test "attempted (default, 8 bit) -decodetext of binary text"
582 cat >`mhpath new` <<EOF
583 To: recipient@example.com
584 From: sender@example.com
585 Subject: mhfixmsg binary decode test
586 MIME-Version: 1.0
587 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
588
589 ------- =_aaaaaaaaaa0
590 Content-Type: text/plain; charset="UTF-8"; name="nul+square.txt"
591 Content-Transfer-Encoding: base64
592
593 vbI9vAAK
594
595 ------- =_aaaaaaaaaa0--
596 EOF
597
598 cp -p `mhpath last` "$expected"
599 run_prog mhfixmsg last
600 check `mhpath last` "$expected" 'keep first'
601
602
603 # check for successful decode of a different part with attempted -decodetext
604 # of binary (>998 characters) text
605 start_test "for successful decode of a different part with attempted -decodetext"
606 cat >$expected <<EOF
607 To: recipient@example.com
608 From: sender@example.com
609 Subject: mhfixmsg successful decode of text/plain with failed binary decode
610 MIME-Version: 1.0
611 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
612
613 ------- =_aaaaaaaaaa0
614 Content-Type: text/plain; charset="iso-8859-1"
615 Content-Transfer-Encoding: 7bit
616
617 This is a text plain part
618
619 ------- =_aaaaaaaaaa0
620 Content-Type: text/html; charset="ascii"
621 Content-Transfer-Encoding: base64
622 Content-Disposition: inline
623
624 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
625 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
626 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
627 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
628 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
629 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
630 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
631 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
632 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
633 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
634 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
635 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
636 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
637 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
638 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
639 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
640 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
641 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
642 ICA8L2JvZHk+PC9odG1sPg==
643
644 ------- =_aaaaaaaaaa0--
645 EOF
646
647 cat >`mhpath new` <<EOF
648 To: recipient@example.com
649 From: sender@example.com
650 Subject: mhfixmsg successful decode of text/plain with failed binary decode
651 MIME-Version: 1.0
652 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
653
654 ------- =_aaaaaaaaaa0
655 Content-Type: text/plain; charset="iso-8859-1"
656 Content-Transfer-Encoding: base64
657
658 VGhpcyBpcyBhIHRleHQgcGxhaW4gcGFydAo=
659
660 ------- =_aaaaaaaaaa0
661 Content-Type: text/html; charset="ascii"
662 Content-Transfer-Encoding: base64
663 Content-Disposition: inline
664
665 PGh0bWw+PGhlYWQ+PHRpdGxlPmxvbmcgbGluZTwvdGl0bGU+PC9oZWFkPjxib2R5PlRoaXMgbGlu
666 ZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQg
667 c2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hh
668 cmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBU
669 aGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhp
670 cyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4g
671 OTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNv
672 ZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgs
673 IHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRl
674 ciB0aGFuIDk5OCBjaGFyYWN0ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3Qg
675 YmUgZGVjb2RlZC4gIFRoaXMgbGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4g
676 bGVuZ3RoLCBzbyB0aGlzIHBhcnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlz
677 IGdyZWF0ZXIgdGhhbiA5OTggY2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91
678 bGQgbm90IGJlIGRlY29kZWQuICBUaGlzIGxpbmUgaXMgZ3JlYXRlciB0aGFuIDk5OCBjaGFyYWN0
679 ZXJzIGluIGxlbmd0aCwgc28gdGhpcyBwYXJ0IHNob3VsZCBub3QgYmUgZGVjb2RlZC4gIFRoaXMg
680 bGluZSBpcyBncmVhdGVyIHRoYW4gOTk4IGNoYXJhY3RlcnMgaW4gbGVuZ3RoLCBzbyB0aGlzIHBh
681 cnQgc2hvdWxkIG5vdCBiZSBkZWNvZGVkLiAgVGhpcyBsaW5lIGlzIGdyZWF0ZXIgdGhhbiA5OTgg
682 Y2hhcmFjdGVycyBpbiBsZW5ndGgsIHNvIHRoaXMgcGFydCBzaG91bGQgbm90IGJlIGRlY29kZWQu
683 ICA8L2JvZHk+PC9odG1sPg==
684
685 ------- =_aaaaaaaaaa0--
686 EOF
687
688 run_prog mhfixmsg -noreformat last
689 check `mhpath last` "$expected" 'keep first'
690
691
692 # check for successful decode of a different part with -decodetext of binary
693 # (>998 characters) text
694 start_test "for successful decode of a different part with -decodetext of binary"
695 cat >$expected <<EOF
696 To: recipient@example.com
697 From: sender@example.com
698 Subject: mhfixmsg successful decode of text/plain with failed binary decode
699 MIME-Version: 1.0
700 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
701 Content-Transfer-Encoding: binary
702
703 ------- =_aaaaaaaaaa0
704 Content-Type: text/plain; charset="iso-8859-1"
705 Content-Transfer-Encoding: 7bit
706
707 This is a text plain part
708
709 ------- =_aaaaaaaaaa0
710 Content-Type: text/html; charset="ascii"
711 Content-Transfer-Encoding: binary
712 Content-Disposition: inline
713
714 <html><head><title>long line</title></head><body>This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. This line is greater than 998 characters in length, so this part should not be decoded. </body></html>
715
716 ------- =_aaaaaaaaaa0--
717 EOF
718
719 run_prog mhfixmsg -noreformat -decodetext binary last
720 check `mhpath last` "$expected"
721
722
723 # check -decodetext of binary (containing ASCII NUL) text
724 start_test "-decodetext of binary (containing ASCII NUL) text"
725 printf "%s\275\262=\274\000%s" "To: recipient@example.com
726 From: sender@example.com
727 Subject: mhfixmsg binary decode test
728 MIME-Version: 1.0
729 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
730 Content-Transfer-Encoding: binary
731
732 ------- =_aaaaaaaaaa0
733 Content-Type: text/plain; charset=\"UTF-8\"; name=\"nul+square.txt\"
734 Content-Transfer-Encoding: binary
735
736 " "
737
738 ------- =_aaaaaaaaaa0--
739 " >"$expected"
740 mhfixmsg last -decodetext binary -outfile "$actual"
741 check "$expected" "$actual"
742
743
744 # check that -reformat succeeds when decode of binary text fails
745 start_test "that -reformat succeeds when decode of binary text fails"
746 prepare_space >"$expected" <<'EOF'
747 MIME-Version: 1.0
748 Date: Thu, 11 Apr 2013 02:47:08 -0700
749 To: <me@example.com>
750 From: <sender@example.com>
751 Subject: body requires binary encoding
752 Content-Type: multipart/alternative; boundary="----=_nmh-multipart"
753
754 ------=_nmh-multipart
755 Content-Type: text/plain; charset="ISO-8859-1"
756 Content-Transfer-Encoding: 7bit
757
758 Mile $0.00
759 Time $78.71
760 State Tax $5.90
761 Vehicle License Fee $1.84
762 State Txn Tax $6.00
763
764 ------=_nmh-multipart
765 Content-Type: text/html; charset="ISO-8859-1"
766 Content-Transfer-Encoding: quoted-printable
767
768 <body>
769 EOF
770
771 cat >`mhpath new` <<'EOF'
772 MIME-Version: 1.0
773 Content-Type: text/html; charset="ISO-8859-1"
774 Content-Transfer-Encoding: quoted-printable
775 Date: Thu, 11 Apr 2013 02:47:08 -0700
776 To: <me@example.com>
777 From: <sender@example.com>
778 Subject: body requires binary encoding
779
780 <body>
781 <table width=3D"325" border=3D"0" cellspacing=3D"0" cellpadding=3D"0">
782 <tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
783 =3D"2"><strong>Mile</strong></font></td><td height=3D"3">&nbsp;</td><td ali=
784 gn=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" =
785 size=3D"2">$0.00</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sa=
786 ns-serif" color=3D"#333333" size=3D"2"><strong>Time</strong></font></td><td=
787 height=3D"3">&nbsp;</td><td align=3D"right"><font face=3D"Arial, Helvetica=
788 , sans-serif" color=3D"#333333" size=3D"2">$78.71</font></td></tr><tr><td><=
789 font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=3D"2"><st=
790 rong>State Tax</strong></font></td><td height=3D"3">&nbsp;</td><td align=3D=
791 "right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
792 =3D"2">$5.90</font></td></tr><tr><td><font face=3D"Arial, Helvetica, sans-s=
793 erif" color=3D"#333333" size=3D"2"><strong>Vehicle License Fee</strong></fo=
794 nt></td><td height=3D"3">&nbsp;</td><td align=3D"right"><font face=3D"Arial=
795 , Helvetica, sans-serif" color=3D"#333333" size=3D"2">$1.84</font></td></tr=
796 ><tr><td><font face=3D"Arial, Helvetica, sans-serif" color=3D"#333333" size=
797 =3D"2"><strong>State Txn Tax</strong></font></td><td height=3D"3">&nbsp;</t=
798 d><td align=3D"right"><font face=3D"Arial, Helvetica, sans-serif" color=3D"=
799 #333333" size=3D"2">$6.00</font></td></tr>
800
801 </body>
802 </html>
803 EOF
804
805 if [ $can_reformat_texthtml -eq 1 ]; then
806 #### lynx inserts multiple blank lines, so squeeze them.
807 #### Truncate to avoid comparing the html portion because it can
808 #### get reformatted.
809 run_prog mhfixmsg last -outfile - | squeeze_lines | head -22 >"$actual"
810 check "$expected" "$actual" 'ignore space'
811 else
812 cp -p "$MH_TEST_DIR/Mail/inbox/15" "$MH_TEST_DIR/Mail/inbox/15.backup"
813 rm -f "$expected"
814 fi
815
816
817 # check -textcharset
818 # Also checks preservation of attributes after one (charset) that is
819 # modified.
820 start_test "-textcharset"
821 cat >"$expected" <<EOF
822 To: recipient@example.com
823 From: sender@example.com
824 Subject: mhfixmsg textcharset test
825 MIME-Version: 1.0
826 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
827 Content-Transfer-Encoding: 8bit
828
829 ------- =_aaaaaaaaaa0
830 Content-Type: text/plain; charset="utf-8"; name="square.txt"
831 Content-Disposition: attachment; filename="square.txt"
832 Content-Transfer-Encoding: 8bit
833
834 ½²=¼
835
836 ------- =_aaaaaaaaaa0--
837 EOF
838
839 #### Generated the encoded text below with:
840 #### $ printf '\275\262=\274\n' | base64
841 cat >`mhpath new` <<EOF
842 To: recipient@example.com
843 From: sender@example.com
844 Subject: mhfixmsg textcharset test
845 MIME-Version: 1.0
846 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
847
848 ------- =_aaaaaaaaaa0
849 Content-Type: text/plain; charset="iso-8859-1"; name="square.txt"
850 Content-Disposition: attachment; filename="square.txt"
851 Content-Transfer-Encoding: base64
852
853 vbI9vAo=
854
855 ------- =_aaaaaaaaaa0--
856 EOF
857
858 if test "$ICONV_ENABLED" -eq 1; then
859 run_prog mhfixmsg last -textcharset utf-8 -outfile "$actual" 2>&1
860 check "$expected" "$actual"
861 else
862 echo "$0: skipping -textcharset check because nmh was built without iconv"
863 rm -f "$expected"
864 fi
865
866
867 # check -nofixboundary
868 start_test "-nofixboundary"
869 cat >"$expected" <<EOF
870 EOF
871
872 cat >`mhpath new` <<EOF
873 Date: Fri, 13 May 2011 08:21:12 -0500
874 Content-Type: multipart/alternative;
875 boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
876 Content-Transfer-Encoding: 8bit
877 MIME-Version: 1.0
878 From: <sender@example.com>
879 To: <recipient@example.com>
880 Subject: mhfixmsg bad boundary test
881
882 This is a multi-part message in MIME format.
883
884 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
885 Content-Type: text/plain
886
887 The boundaries of this part don't match the header boundary.
888
889 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
890 EOF
891
892 cp -p `mhpath last` `mhpath new`
893
894 run_test 'mhfixmsg last -nofixboundary' ''
895 check "$MH_TEST_DIR"/Mail/inbox/18 "$MH_TEST_DIR"/Mail/inbox/19 'keep first'
896
897
898 # check that message is not output when fed through stdin
899 start_test "that message is not output when fed through stdin"
900 run_prog mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
901 check "$expected" "$actual"
902 if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
903 "$actual.err" >/dev/null; then
904 rm -f "$actual.err"
905 else
906 echo "$0: test failed, output is in $actual.err."
907 failed=`expr ${failed:-0} + 1`
908 fi
909
910
911 # check fixup of erroneous boundary in multipart (-fixboundary,
912 # enabled by default)
913 # check -verbose
914 start_test "fixup of erroneous boundary in multipart (-fixboundary, enabled by default)"
915 cat >"$expected" <<EOF
916 Date: Fri, 13 May 2011 08:21:12 -0500
917 Content-Type: multipart/alternative;
918 boundary="----=_NextPart_000_1781A1A_01CC1147.81EBA8D4"
919 Content-Transfer-Encoding: 8bit
920 MIME-Version: 1.0
921 From: <sender@example.com>
922 To: <recipient@example.com>
923 Subject: mhfixmsg bad boundary test
924
925 This is a multi-part message in MIME format.
926
927 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4
928 Content-Type: text/plain
929
930 The boundaries of this part don't match the header boundary.
931
932 ------=_NextPart_000_1781A1A_01CC1147.81EBA8D4--
933 EOF
934
935 run_test 'mhfixmsg last -outfile '"$actual"' -verbose' \
936 "mhfixmsg: 18, fix multipart boundary"
937 check "$expected" "$actual"
938
939
940 # check that message is not modified when -fixboundary fails
941 start_test "that message is not modified when -fixboundary fails"
942 cat >`mhpath new` <<EOF
943 Date: Fri, 13 May 2011 08:21:12 -0500
944 Content-Type: multipart/alternative;
945 boundary="----=_ NextPart_000_1781A17_01CC1147.81E9467A"
946 Content-Transfer-Encoding: 8bit
947 MIME-Version: 1.0
948 From: <sender@example.com>
949 To: <recipient@example.com>
950 Subject: mhfixmsg bad boundary test
951
952 This is a multi-part message in MIME format.
953
954 ------=_ NextPart_000_1781A1A_01CC1147.81EBA8D4
955 Content-Type: text/plain
956
957 The boundary below doesn't match the header boundary.
958
959 ------=_
960 NextPart_000_1781A1A_01CC1147.81EBA8D4--
961 EOF
962
963 cp -p `mhpath last` "$expected"
964 run_test "mhfixmsg last -outfile $actual" ''
965 check "$expected" "$actual"
966
967
968 # check that text/plain part is not added to text/html in multipart/related
969 # when it shouldn't be
970 start_test "that text/plain part is not added to text/html in multipart/related when it shouldn't be"
971 cat >`mhpath new` <<EOF
972 MIME-Version: 1.0
973 Date: Tue, 26 Feb 2013 18:07:20 -0600
974 Subject: multipart/related, not /alternative
975 Content-Type: multipart/related;
976 type="text/html"; boundary="----=_Part_90310_101292502.1"
977
978 ------=_Part_90310_101292502.1
979 Content-Type: text/html; charset="us-ascii"
980 Content-Transfer-Encoding: 7bit
981
982 <html><head>
983 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
984 <title>HTML Content</title>
985 </head>
986 <body>
987 This is the real content.
988 </body>
989 </html>
990
991 ------=_Part_90310_101292502.1
992 Content-Type: text/plain; charset="us-ascii"
993 Content-Transfer-Encoding: 7bit
994
995 Your email client does not support HTML messages
996
997 ------=_Part_90310_101292502.1--
998 EOF
999
1000 cp -p `mhpath last` "$expected"
1001
1002 if [ $can_reformat_texthtml -eq 1 ]; then
1003 #### lynx inserts multiple blank lines, so squeeze them.
1004 run_prog mhfixmsg last -outfile - | squeeze_lines >"$actual"
1005 check "$expected" "$actual" 'ignore space'
1006 else
1007 rm -f "$expected"
1008 fi
1009
1010
1011 # check that text/plain part is added to text/html in multipart/related
1012 # when it should be
1013 start_test "that text/plain part is added to text/html in multipart/related when it should be"
1014 cat >"$expected" <<EOF
1015 MIME-Version: 1.0
1016 Date: Tue, 26 Feb 2013 18:07:20 -0600
1017 Subject: multipart/related, not /alternative
1018 Content-Type: multipart/alternative; boundary="----=_Part_90310_101292502.1"
1019
1020 ------=_Part_90310_101292502.1
1021 Content-Type: text/plain; charset="us-ascii"
1022 Content-Transfer-Encoding: 7bit
1023
1024 This is the real content.
1025
1026 ------=_Part_90310_101292502.1
1027 Content-Type: text/html; charset="us-ascii"
1028 Content-Transfer-Encoding: 7bit
1029
1030 <html><head>
1031 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
1032 <title>HTML Content</title>
1033 </head>
1034 <body>
1035 This is the real content.
1036 </body>
1037 </html>
1038
1039 ------=_Part_90310_101292502.1--
1040 EOF
1041
1042 cat >`mhpath new` <<EOF
1043 MIME-Version: 1.0
1044 Date: Tue, 26 Feb 2013 18:07:20 -0600
1045 Subject: multipart/related, not /alternative
1046 Content-Type: multipart/related;
1047 type="text/html"; boundary="----=_Part_90310_101292502.1"
1048
1049 ------=_Part_90310_101292502.1
1050 Content-Type: text/html; charset="us-ascii"
1051 Content-Transfer-Encoding: 7bit
1052
1053 <html><head>
1054 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
1055 <title>HTML Content</title>
1056 </head>
1057 <body>
1058 This is the real content.
1059 </body>
1060 </html>
1061
1062 ------=_Part_90310_101292502.1--
1063 EOF
1064
1065 if [ $can_reformat_texthtml -eq 1 ]; then
1066 #### lynx inserts multiple blank lines, so squeeze them.
1067 run_prog mhfixmsg last -outfile - | squeeze_lines >"$actual"
1068 check "$expected" "$actual" 'ignore space'
1069 else
1070 rm -f "$expected"
1071 fi
1072
1073
1074 # check handling of rfc822 message type
1075 start_test "handling of rfc822 message type"
1076 cat >"$expected" <<EOF
1077 From: Test <test@example.com>
1078 To: Some User <user@example.com>
1079 Date: Fri, 29 Sep 2006 00:00:00
1080 Message-Id: @test.nmh
1081 Subject: message with message/rfc822 attachment
1082 MIME-Version: 1.0
1083 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1084
1085 and some garbage before the attachment
1086
1087 ------- =_aaaaaaaaaa0
1088 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1089 Content-Description: 1552
1090 Content-Disposition: attachment; filename="1552"
1091
1092 From: Test <test@example.com>
1093 To: <another_user@example.com>
1094 Date: Thu, 28 Sep 2006 00:00:00
1095 Message-Id: @test.nmh
1096 Subject: message/rfc822 attachment
1097
1098 This is an RFC-822 message.
1099
1100 ------- =_aaaaaaaaaa0--
1101
1102 and some garbage at the end
1103 EOF
1104
1105 cat >`mhpath new` <<EOF
1106 From: Test <test@example.com>
1107 To: Some User <user@example.com>
1108 Date: Fri, 29 Sep 2006 00:00:00
1109 Message-Id: @test.nmh
1110 Subject: message with message/rfc822 attachment
1111 MIME-Version: 1.0
1112 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaa0"
1113
1114 and some garbage before the attachment
1115
1116 ------- =_aaaaaaaaaa0
1117 Content-Type: message/rfc822; name="1552"; charset="us-ascii"
1118 Content-Description: 1552
1119 Content-Disposition: attachment; filename="1552"
1120
1121 From: Test <test@example.com>
1122 To: <another_user@example.com>
1123 Date: Thu, 28 Sep 2006 00:00:00
1124 Message-Id: @test.nmh
1125 Subject: message/rfc822 attachment
1126
1127 This is an RFC-822 message.
1128
1129 ------- =_aaaaaaaaaa0--
1130
1131 and some garbage at the end
1132 EOF
1133
1134 run_test 'mhfixmsg last -outfile '"$actual" ''
1135 check "$expected" "$actual"
1136
1137
1138 # check not stripping of CRs from ASCII text context (default)
1139 start_test "not stripping of CRs from ASCII text context (default)"
1140 cat >"$expected" <<EOF
1141 MIME-Version: 1.0
1142 From: sender@example.com
1143 To: recipient@example.com
1144 Subject: message with CR's
1145 Date: Mon, 29 Apr 2013 11:51:45 -0400
1146
1147 There are two CR-LF pairs at the end of this sentence.
1148
1149 EOF
1150
1151 cat >`mhpath new` <<'EOF'
1152 MIME-Version: 1.0
1153 From: sender@example.com
1154 To: recipient@example.com
1155 Subject: message with CR's
1156 Date: Mon, 29 Apr 2013 11:51:45 -0400
1157
1158 There are two CR-LF pairs at the end of this sentence.
1159
1160 EOF
1161
1162 run_prog mhfixmsg last -outfile "$actual"
1163 check "$expected" "$actual"
1164
1165
1166 # check stripping of CRs from ASCII text context
1167 start_test "stripping of CRs from ASCII text context"
1168 cat >"$expected" <<EOF
1169 MIME-Version: 1.0
1170 From: sender@example.com
1171 To: recipient@example.com
1172 Subject: message with CR's
1173 Date: Mon, 29 Apr 2013 11:51:45 -0400
1174
1175 There were two CR-LF pairs at the end of this sentence.
1176
1177 EOF
1178
1179 cat >`mhpath new` <<'EOF'
1180 MIME-Version: 1.0
1181 From: sender@example.com
1182 To: recipient@example.com
1183 Subject: message with CR's
1184 Date: Mon, 29 Apr 2013 11:51:45 -0400
1185
1186 There were two CR-LF pairs at the end of this sentence.
1187
1188 EOF
1189
1190 run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks
1191 check "$expected" "$actual"
1192
1193
1194 # check -replacetextplain
1195 start_test "-replacetextplain"
1196 prepare_space >"$expected" <<EOF
1197 To: recipient@example.com
1198 From: sender@example.com
1199 Subject: mhfixmsg replacement of bad text/plain part test
1200 MIME-Version: 1.0
1201 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1202
1203 ------=_Part_876302
1204 Content-Type: text/plain; charset="UTF-8"
1205 Content-Transfer-Encoding: 7bit
1206
1207 Yes, the text/plain part really was empty.
1208
1209 ------=_Part_876302
1210 Content-Type: text/html; charset="UTF-8"
1211 Content-Disposition: inline
1212
1213 <html><head>
1214 <title>eticket</title>
1215 </head>
1216 <body>
1217 Yes, the text/plain part really was empty.
1218 </body>
1219 </html>
1220
1221 ------=_Part_876302--
1222 EOF
1223
1224 cat >`mhpath new` <<'EOF'
1225 To: recipient@example.com
1226 From: sender@example.com
1227 Subject: mhfixmsg replacement of bad text/plain part test
1228 MIME-Version: 1.0
1229 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1230
1231 ------=_Part_876302
1232 Content-Type: text/plain; charset="iso-8859-15"
1233 Content-Transfer-Encoding: 7bit
1234 Content-Disposition: inline
1235
1236
1237
1238 ------=_Part_876302
1239 Content-Type: text/html; charset="UTF-8"
1240 Content-Disposition: inline
1241
1242 <html><head>
1243 <title>eticket</title>
1244 </head>
1245 <body>
1246 Yes, the text/plain part really was empty.
1247 </body>
1248 </html>
1249
1250 ------=_Part_876302--
1251 EOF
1252
1253 if [ $can_reformat_texthtml -eq 1 ]; then
1254 #### lynx inserts multiple blank lines, so squeeze them.
1255 run_prog mhfixmsg last -replacetextplain -outfile - | \
1256 squeeze_lines > "$actual"
1257 check "$expected" "$actual" 'ignore space'
1258 else
1259 rm -f "$expected"
1260 fi
1261
1262
1263 # check -noreplacetextplain
1264 start_test "-noreplacetextplain"
1265 cat >"$expected" <<EOF
1266 To: recipient@example.com
1267 From: sender@example.com
1268 Subject: mhfixmsg replacement of bad text/plain part test
1269 MIME-Version: 1.0
1270 Content-Type: multipart/alternative; boundary="----=_Part_876302"
1271
1272 ------=_Part_876302
1273 Content-Type: text/plain; charset="iso-8859-15"
1274 Content-Transfer-Encoding: 7bit
1275 Content-Disposition: inline
1276
1277
1278
1279 ------=_Part_876302
1280 Content-Type: text/html; charset="UTF-8"
1281 Content-Disposition: inline
1282
1283 <html><head>
1284 <title>eticket</title>
1285 </head>
1286 <body>
1287 Yes, the text/plain part really was empty.
1288 </body>
1289 </html>
1290
1291 ------=_Part_876302--
1292 EOF
1293
1294 run_prog mhfixmsg last -replacetextplain -noreplacetextplain -outfile "$actual"
1295 check "$expected" "$actual"
1296
1297
1298 # check removal of extraneous trailing semicolon from header parameter list
1299 start_test "removal of extraneous trailing semicolon from header parameter list"
1300 cat >"$expected" <<EOF
1301 To: recipient@example.com
1302 Subject: test
1303 From: sender@example.com
1304 MIME-Version: 1.0
1305 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1306
1307 ------- =_aaaaaaaaaa0
1308 Content-Type: text/plain; charset="us-ascii"
1309
1310 test
1311
1312 ------- =_aaaaaaaaaa0
1313 Content-Type: text/plain; charset="us-ascii";
1314 name="DATE"
1315 Content-Description: check folded headers, with and without trailing semicolon
1316 Content-Disposition: attachment;
1317 filename="DATE"
1318
1319 14 April 2014
1320
1321 ------- =_aaaaaaaaaa0--
1322 EOF
1323
1324 cat >`mhpath new` <<EOF
1325 To: recipient@example.com
1326 Subject: test
1327 From: sender@example.com
1328 MIME-Version: 1.0
1329 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1330
1331 ------- =_aaaaaaaaaa0
1332 Content-Type: text/plain; charset="us-ascii";
1333
1334 test
1335
1336 ------- =_aaaaaaaaaa0
1337 Content-Type: text/plain; charset="us-ascii";
1338 name="DATE"
1339 Content-Description: check folded headers, with and without trailing semicolon
1340 Content-Disposition: attachment;
1341 filename="DATE";
1342
1343 14 April 2014
1344
1345 ------- =_aaaaaaaaaa0--
1346 EOF
1347 run_test 'mhfixmsg last -outfile '"$actual" ''
1348 check "$expected" "$actual"
1349
1350
1351 # check rmmproc
1352 start_test "rmmproc"
1353 cat >"$MH_TEST_DIR/Mail/rmmproc" <<'EOF'
1354 mv "$1" "$1.backup"
1355 EOF
1356 chmod a+x "${MH_TEST_DIR}/Mail/rmmproc"
1357 echo "rmmproc: ${MH_TEST_DIR}/Mail/rmmproc" >>"$MH"
1358 cp "${MH_TEST_DIR}/Mail/inbox/16" "${MH_TEST_DIR}/Mail/inbox/16.original"
1359
1360 run_test 'mhfixmsg 16' ''
1361 check "${MH_TEST_DIR}/Mail/inbox/16.backup" \
1362 "${MH_TEST_DIR}/Mail/inbox/16.original"
1363
1364
1365 # check -normmproc
1366 start_test "-normmproc"
1367 cp "${MH_TEST_DIR}/Mail/inbox/21" "${MH_TEST_DIR}/Mail/inbox/22"
1368
1369 run_test 'mhfixmsg 21 -normmproc'
1370 check "${MH_TEST_DIR}/Mail/inbox/22" \
1371 "${MH_TEST_DIR}/Mail/inbox/,21" 'keep first'
1372
1373
1374 # check -rmmproc
1375 start_test "-rmmproc"
1376 run_test 'mhfixmsg 21 -rmmproc true'
1377 if test -f '${MH_TEST_DIR}/Mail/inbox/22.backup'; then
1378 echo check of mhfixmsg -rmmproc FAILED, should not have created backup file
1379 failed=`expr ${failed:-0} + 1`
1380 fi
1381
1382
1383 # check -fixtype
1384 start_test "-fixtype"
1385 cat >"$expected" <<EOF
1386 To: recipient@example.com
1387 From: sender@example.com
1388 Subject: mhfixmsg with incorrect Content-Type
1389 MIME-Version: 1.0
1390 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1391
1392 ------- =_aaaaaaaaaa0
1393 Content-Type: text/plain; name="plaintext.txt"
1394
1395 this is plain text
1396
1397 ------- =_aaaaaaaaaa0--
1398 EOF
1399
1400 cat >`mhpath new` <<EOF
1401 To: recipient@example.com
1402 From: sender@example.com
1403 Subject: mhfixmsg with incorrect Content-Type
1404 MIME-Version: 1.0
1405 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1406
1407 ------- =_aaaaaaaaaa0
1408 Content-Type: application/octet-stream; name="plaintext.txt"
1409
1410 this is plain text
1411
1412 ------- =_aaaaaaaaaa0--
1413 EOF
1414
1415 mhfixmsg -fixtype application/octet-stream last
1416 check "$expected" `mhpath last`
1417
1418
1419 # check default -decodetypes
1420 start_test "default -decodetypes"
1421 cat >$expected <<EOF
1422 To: recipient@example.com
1423 From: sender@example.com
1424 Subject: mhfixmsg decode test 3
1425 MIME-Version: 1.0
1426 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1427
1428 ------- =_aaaaaaaaaa0
1429 Content-Type: text/plain; charset="iso-8859-1"
1430 Content-Disposition: attachment; filename="test1.txt"
1431 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1432 Content-Transfer-Encoding: 7bit
1433
1434 This is the text/plain part.
1435
1436 ------- =_aaaaaaaaaa0
1437 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1438 Content-Disposition: attachment; filename="test2.txt"
1439 Content-Transfer-Encoding: 7bit
1440
1441 <html>
1442 <head>
1443 This was the text/html part.
1444 </head>
1445 </body>
1446 </html>
1447
1448 ------- =_aaaaaaaaaa0--
1449 EOF
1450
1451 cat >`mhpath new` <<EOF
1452 To: recipient@example.com
1453 From: sender@example.com
1454 Subject: mhfixmsg decode test 3
1455 MIME-Version: 1.0
1456 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1457
1458 ------- =_aaaaaaaaaa0
1459 Content-Type: text/plain; charset="iso-8859-1"
1460 Content-Disposition: attachment; filename="test1.txt"
1461 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1462 Content-Transfer-Encoding: quoted-printable
1463
1464 This is the text/plain part.
1465
1466 ------- =_aaaaaaaaaa0
1467 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1468 Content-Disposition: attachment; filename="test2.txt"
1469 Content-Transfer-Encoding: base64
1470
1471 PGh0bWw+CjxoZWFkPgogICAgVGhpcyB3YXMgdGhlIHRleHQvaHRtbCBwYXJ0Lgo8L2hlYWQ+Cjwv
1472 Ym9keT4KPC9odG1sPgo=
1473
1474 ------- =_aaaaaaaaaa0--
1475 EOF
1476 run_prog mhfixmsg last -outfile "$actual" -noreformat
1477 check "$expected" "$actual"
1478
1479
1480 # check -decodetypes text/plain
1481 start_test "-decodetypes text/plain"
1482 cat >$expected <<EOF
1483 To: recipient@example.com
1484 From: sender@example.com
1485 Subject: mhfixmsg decode test 4
1486 MIME-Version: 1.0
1487 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1488
1489 ------- =_aaaaaaaaaa0
1490 Content-Type: text/plain; charset="iso-8859-1"
1491 Content-Disposition: attachment; filename="test1.txt"
1492 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1493 Content-Transfer-Encoding: 7bit
1494
1495 This is the text/plain part.
1496
1497 ------- =_aaaaaaaaaa0
1498 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1499 Content-Disposition: attachment; filename="test2.txt"
1500 Content-Transfer-Encoding: base64
1501
1502 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1503 CjwvYm9keT4NCjwvaHRtbD4NCg==
1504
1505 ------- =_aaaaaaaaaa0--
1506 EOF
1507
1508 cat >`mhpath new` <<EOF
1509 To: recipient@example.com
1510 From: sender@example.com
1511 Subject: mhfixmsg decode test 4
1512 MIME-Version: 1.0
1513 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1514
1515 ------- =_aaaaaaaaaa0
1516 Content-Type: text/plain; charset="iso-8859-1"
1517 Content-Disposition: attachment; filename="test1.txt"
1518 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1519 Content-Transfer-Encoding: quoted-printable
1520
1521 This is the text/plain part.
1522
1523 ------- =_aaaaaaaaaa0
1524 Content-Type: text/html; charset="iso-8859-1"; name="test2.txt"
1525 Content-Disposition: attachment; filename="test2.txt"
1526 Content-Transfer-Encoding: base64
1527
1528 PGh0bWw+DQo8aGVhZD4NCiAgICBUaGlzIGlzIHRoZSB0ZXh0L2h0bWwgcGFydC4NCjwvaGVhZD4N
1529 CjwvYm9keT4NCjwvaHRtbD4NCg==
1530
1531 ------- =_aaaaaaaaaa0--
1532 EOF
1533 run_prog mhfixmsg last -outfile "$actual" -decodetypes text/plain -noreformat
1534 check "$expected" "$actual"
1535
1536
1537 # check -decodetypes attachment/ics
1538 start_test "-decodetypes attachment/ics"
1539 cat >$expected <<EOF
1540 To: recipient@example.com
1541 From: sender@example.com
1542 Subject: mhfixmsg decode test 5
1543 MIME-Version: 1.0
1544 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1545
1546 ------- =_aaaaaaaaaa0
1547 Content-Type: text/plain; charset="iso-8859-1"
1548 Content-Disposition: attachment; filename="test1.txt"
1549 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1550 Content-Transfer-Encoding: 7bit
1551
1552 This is the text/plain part.
1553
1554 ------- =_aaaaaaaaaa0
1555 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1556 Content-Disposition: attachment; filename="invite.ics"
1557 Content-Transfer-Encoding: 7bit
1558
1559 BEGIN:VCALENDAR
1560 VERSION:2.0
1561 PRODID:test-mhical
1562 BEGIN:VEVENT
1563 DTSTAMP:20150101T162400Z
1564 DTSTART:20150105T160000
1565 DTEND:20150105T163000
1566 SUMMARY:4 pm meeting
1567 END:VEVENT
1568 END:VCALENDAR
1569
1570 ------- =_aaaaaaaaaa0--
1571 EOF
1572
1573 cat >`mhpath new` <<EOF
1574 To: recipient@example.com
1575 From: sender@example.com
1576 Subject: mhfixmsg decode test 5
1577 MIME-Version: 1.0
1578 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1579
1580 ------- =_aaaaaaaaaa0
1581 Content-Type: text/plain; charset="iso-8859-1"
1582 Content-Disposition: attachment; filename="test1.txt"
1583 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1584 Content-Transfer-Encoding: quoted-printable
1585
1586 This is the=
1587 text/plain part.
1588
1589 ------- =_aaaaaaaaaa0
1590 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1591 Content-Disposition: attachment; filename="invite.ics"
1592 Content-Transfer-Encoding: base64
1593
1594 QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
1595 RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
1596 CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
1597 CkVORDpWQ0FMRU5EQVINCg==
1598
1599 ------- =_aaaaaaaaaa0--
1600 EOF
1601 run_prog mhfixmsg last -outfile "$actual" -noreformat
1602 check "$expected" "$actual"
1603
1604
1605 # check -decodetypes attachment/ics and -nocrlflinebreaks
1606 start_test "-decodetypes attachment/ics and -nocrlflinebreaks"
1607 cat >$expected <<EOF
1608 To: recipient@example.com
1609 From: sender@example.com
1610 Subject: mhfixmsg decode test 5
1611 MIME-Version: 1.0
1612 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1613
1614 ------- =_aaaaaaaaaa0
1615 Content-Type: text/plain; charset="iso-8859-1"
1616 Content-Disposition: attachment; filename="test1.txt"
1617 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1618 Content-Transfer-Encoding: 7bit
1619
1620 This is the text/plain part.
1621
1622 ------- =_aaaaaaaaaa0
1623 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1624 Content-Disposition: attachment; filename="invite.ics"
1625 Content-Transfer-Encoding: 7bit
1626
1627 BEGIN:VCALENDAR
1628 VERSION:2.0
1629 PRODID:test-mhical
1630 BEGIN:VEVENT
1631 DTSTAMP:20150101T162400Z
1632 DTSTART:20150105T160000
1633 DTEND:20150105T163000
1634 SUMMARY:4 pm meeting
1635 END:VEVENT
1636 END:VCALENDAR
1637
1638 ------- =_aaaaaaaaaa0--
1639 EOF
1640
1641 cat >`mhpath new` <<EOF
1642 To: recipient@example.com
1643 From: sender@example.com
1644 Subject: mhfixmsg decode test 5
1645 MIME-Version: 1.0
1646 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1647
1648 ------- =_aaaaaaaaaa0
1649 Content-Type: text/plain; charset="iso-8859-1"
1650 Content-Disposition: attachment; filename="test1.txt"
1651 Content-MD5: kq+Hnc2SD/eKwAnkFBDuEA==
1652 Content-Transfer-Encoding: quoted-printable
1653
1654 This is the=
1655 text/plain part.
1656
1657 ------- =_aaaaaaaaaa0
1658 Content-Type: application/ics; charset="iso-8859-1"; name="invite.ics"
1659 Content-Disposition: attachment; filename="invite.ics"
1660 Content-Transfer-Encoding: base64
1661
1662 QkVHSU46VkNBTEVOREFSDQpWRVJTSU9OOjIuMA0KUFJPRElEOnRlc3QtbWhpY2FsDQpCRUdJTjpW
1663 RVZFTlQNCkRUU1RBTVA6MjAxNTAxMDFUMTYyNDAwWg0KRFRTVEFSVDoyMDE1MDEwNVQxNjAwMDAN
1664 CkRURU5EOjIwMTUwMTA1VDE2MzAwMA0KU1VNTUFSWTo0IHBtIG1lZXRpbmcNCkVORDpWRVZFTlQN
1665 CkVORDpWQ0FMRU5EQVINCg==
1666
1667 ------- =_aaaaaaaaaa0--
1668 EOF
1669 run_prog mhfixmsg last -outfile "$actual" -nocrlflinebreaks -noreformat
1670 check "$expected" "$actual"
1671
1672
1673 # check that input is passed through to output when there's a parse error
1674 # (the charset string is missing its closing quote) with -outfile
1675 start_test "that input is passed through to output when there's a parse error"
1676 cat >"$expected.err" <<EOF
1677 mhfixmsg: invalid quoted-string in message 31's Content-Type: field
1678 (parameter charset)
1679 mhfixmsg: unable to parse message 31
1680 EOF
1681
1682 cat >`mhpath new` <<EOF
1683 To: recipient@example.com
1684 From: sender@example.com
1685 Subject: mhfixmsg pass through on parse error
1686 MIME-Version: 1.0
1687 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1688
1689 ------- =_aaaaaaaaaa0
1690 Content-Type: text/plain; charset="iso-8859-1
1691 Content-Disposition: attachment; filename="test1.txt"
1692 Content-Transfer-Encoding: quoted-printable
1693
1694 This is the=
1695 text/plain part.
1696
1697 ------- =_aaaaaaaaaa0--
1698 EOF
1699 set +e
1700 run_prog mhfixmsg last -outfile "$actual" 2>"$actual.err"
1701 set -e
1702 #### Expected output is identical to the input message.
1703 check `mhpath last` "$actual" 'keep first'
1704 check "$expected.err" "$actual.err"
1705
1706
1707 # check that input is passed through to output when there's a parse error
1708 # (the charset string is missing its closing quote) with -outfile, and
1709 # input from stdin. Don't check err output, because it contains the name
1710 # of a tmp file. It's similar to that of the previous check.
1711 start_test "that input is passed through to output when there's a parse error"
1712 set +e
1713 run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null
1714 set -e
1715 #### Expected output is identical to the input message.
1716 check `mhpath last` "$actual"
1717
1718
1719 start_test "fix RFC 2047 encoded header parameters"
1720 #### Also, add C-T-E:8bit to the message headers.
1721 cat >"$expected" <<EOF
1722 To: recipient@example.com
1723 From: sender@example.com
1724 Date: Wed, 28 Sep 2016 11:24:28 -0400
1725 Subject: invalid header parameter encoding
1726 MIME-Version: 1.0
1727 Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
1728 Content-Transfer-Encoding: 8bit
1729
1730 --001a114dd3e8fe9c56053d92f414
1731 Content-Type: text/plain; charset=UTF-8
1732
1733 This is a test.
1734
1735 --001a114dd3e8fe9c56053d92f414
1736 Content-Type: text/plain; charset="UTF-8"; name*=UTF-8''test%C3%B8.txt
1737 Content-Disposition: attachment; filename*=UTF-8''test%C3%B8.txt
1738 Content-Transfer-Encoding: 8bit
1739
1740 This is the first text/plain part, in a subpart. The file name
1741 is testø.txt.
1742
1743 --001a114dd3e8fe9c56053d92f414--
1744 EOF
1745
1746 cat >`mhpath new` <<EOF
1747 To: recipient@example.com
1748 From: sender@example.com
1749 Date: Wed, 28 Sep 2016 11:24:28 -0400
1750 Subject: invalid header parameter encoding
1751 MIME-Version: 1.0
1752 Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
1753
1754 --001a114dd3e8fe9c56053d92f414
1755 Content-Type: text/plain; charset=UTF-8
1756
1757 This is a test.
1758
1759 --001a114dd3e8fe9c56053d92f414
1760 Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?B?dGVzdMO4LnR4dA==?="
1761 Content-Disposition: attachment; filename="=?UTF-8?B?dGVzdMO4LnR4dA==?="
1762 Content-Transfer-Encoding: 8bit
1763
1764 This is the first text/plain part, in a subpart. The file name
1765 is testø.txt.
1766
1767 --001a114dd3e8fe9c56053d92f414--
1768 EOF
1769 run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null
1770 check "$expected" "$actual"
1771
1772
1773 # make sure there are no tmp files left over
1774 find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \
1775 >"$actual"
1776 cat >"$expected" <<EOF
1777 EOF
1778
1779 check "$expected" "$actual"
1780
1781 finish_test
1782 exit $failed