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