run_test 'mhfixmsg first -outfile '"$actual" ''
check "`mhpath first`" "$actual" 'keep first'
# check that non-MIME messages with no bodies aren't modified
# check -outfile
run_test 'mhfixmsg first -outfile '"$actual" ''
check "`mhpath first`" "$actual" 'keep first'
# check that non-MIME messages with no bodies aren't modified
# check -outfile
From: Test <test@example.com>
To: Some User <user@example.com>
Date: Fri, 29 Sep 2006 00:00:00
From: Test <test@example.com>
To: Some User <user@example.com>
Date: Fri, 29 Sep 2006 00:00:00
#### Generated the encoded text below with:
#### $ printf '\275\262=\274\000\n' | base64
start_test "attempted (default, 8 bit) -decodetext of binary text"
#### Generated the encoded text below with:
#### $ printf '\275\262=\274\000\n' | base64
start_test "attempted (default, 8 bit) -decodetext of binary text"
To: recipient@example.com
From: sender@example.com
Subject: mhfixmsg successful decode of text/plain with failed binary decode
To: recipient@example.com
From: sender@example.com
Subject: mhfixmsg successful decode of text/plain with failed binary decode
prepare_space >"$expected" <<'EOF'
MIME-Version: 1.0
Date: Thu, 11 Apr 2013 02:47:08 -0700
prepare_space >"$expected" <<'EOF'
MIME-Version: 1.0
Date: Thu, 11 Apr 2013 02:47:08 -0700
Date: Fri, 13 May 2011 08:21:12 -0500
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
Date: Fri, 13 May 2011 08:21:12 -0500
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_1781A17_01CC1147.81E9467A"
run_test 'mhfixmsg last -nofixboundary' ''
check "$MH_TEST_DIR"/Mail/inbox/18 "$MH_TEST_DIR"/Mail/inbox/19 'keep first'
run_test 'mhfixmsg last -nofixboundary' ''
check "$MH_TEST_DIR"/Mail/inbox/18 "$MH_TEST_DIR"/Mail/inbox/19 'keep first'
-# check that message is not output when fed through stdin
-start_test "that message is not output when fed through stdin"
+# check that message is not output when fed through stdin (without -outfile)
+start_test "message is not output when fed through stdin"
run_prog mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
check "$expected" "$actual"
if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
run_prog mhfixmsg -file - -verbose <`mhpath last` >"$actual" 2>"$actual.err"
check "$expected" "$actual"
if grep "mhfixmsg: $MH_TEST_DIR/Mail/.*, fix multipart boundary" \
Date: Fri, 13 May 2011 08:21:12 -0500
Content-Type: multipart/alternative;
boundary="----=_ NextPart_000_1781A17_01CC1147.81E9467A"
Date: Fri, 13 May 2011 08:21:12 -0500
Content-Type: multipart/alternative;
boundary="----=_ NextPart_000_1781A17_01CC1147.81E9467A"
run_test "mhfixmsg last -outfile $actual" ''
check "$expected" "$actual"
# check that text/plain part is not added to text/html in multipart/related
# when it shouldn't be
run_test "mhfixmsg last -outfile $actual" ''
check "$expected" "$actual"
# check that text/plain part is not added to text/html in multipart/related
# when it shouldn't be
MIME-Version: 1.0
Date: Tue, 26 Feb 2013 18:07:20 -0600
Subject: multipart/related, not /alternative
MIME-Version: 1.0
Date: Tue, 26 Feb 2013 18:07:20 -0600
Subject: multipart/related, not /alternative
if [ $can_reformat_texthtml -eq 1 ]; then
#### lynx inserts multiple blank lines, so squeeze them.
if [ $can_reformat_texthtml -eq 1 ]; then
#### lynx inserts multiple blank lines, so squeeze them.
MIME-Version: 1.0
Date: Tue, 26 Feb 2013 18:07:20 -0600
Subject: multipart/related, not /alternative
MIME-Version: 1.0
Date: Tue, 26 Feb 2013 18:07:20 -0600
Subject: multipart/related, not /alternative
From: Test <test@example.com>
To: Some User <user@example.com>
Date: Fri, 29 Sep 2006 00:00:00
From: Test <test@example.com>
To: Some User <user@example.com>
Date: Fri, 29 Sep 2006 00:00:00
# check that input is passed through to output when there's a parse error
# (the charset string is missing its closing quote) with -outfile
# check that input is passed through to output when there's a parse error
# (the charset string is missing its closing quote) with -outfile
cat >"$expected.err" <<EOF
mhfixmsg: invalid quoted-string in message 31's Content-Type: field
(parameter charset)
mhfixmsg: unable to parse message 31
EOF
cat >"$expected.err" <<EOF
mhfixmsg: invalid quoted-string in message 31's Content-Type: field
(parameter charset)
mhfixmsg: unable to parse message 31
EOF
run_prog mhfixmsg last -outfile "$actual" 2>"$actual.err"
set -e
#### Expected output is identical to the input message.
run_prog mhfixmsg last -outfile "$actual" 2>"$actual.err"
set -e
#### Expected output is identical to the input message.
# (the charset string is missing its closing quote) with -outfile, and
# input from stdin. Don't check err output, because it contains the name
# of a tmp file. It's similar to that of the previous check.
# (the charset string is missing its closing quote) with -outfile, and
# input from stdin. Don't check err output, because it contains the name
# of a tmp file. It's similar to that of the previous check.
set +e
run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null
set -e
#### Expected output is identical to the input message.
set +e
run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null
set -e
#### Expected output is identical to the input message.
To: recipient@example.com
From: sender@example.com
Date: Wed, 28 Sep 2016 11:24:28 -0400
To: recipient@example.com
From: sender@example.com
Date: Wed, 28 Sep 2016 11:24:28 -0400