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