]> diplodocus.org Git - nmh/commitdiff
Fixed mhshow part markers when displaying multiple messages.
authorDavid Levine <levinedl@acm.org>
Thu, 8 Feb 2018 01:43:59 +0000 (20:43 -0500)
committerDavid Levine <levinedl@acm.org>
Thu, 8 Feb 2018 01:43:59 +0000 (20:43 -0500)
Added test/mhshow/test-markers, it reveals the problem.

Makefile.am
test/mhshow/test-markers [new file with mode: 0755]
uip/mhshowsbr.c

index d8f9234..e7e4066 100644 (file)
@@ -107,6 +107,7 @@ TESTS = \
     test/mhshow/test-charset \
     test/mhshow/test-cte-binary \
     test/mhshow/test-exec \
     test/mhshow/test-charset \
     test/mhshow/test-cte-binary \
     test/mhshow/test-exec \
+    test/mhshow/test-markers \
     test/mhshow/test-msg-buffer-boundaries \
     test/mhshow/test-qp \
     test/mhshow/test-subpart \
     test/mhshow/test-msg-buffer-boundaries \
     test/mhshow/test-qp \
     test/mhshow/test-subpart \
diff --git a/test/mhshow/test-markers b/test/mhshow/test-markers
new file mode 100755 (executable)
index 0000000..c0e8489
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+######################################################
+#
+# Test mhshow part markers
+#
+######################################################
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+start_test
+
+# check markers when showing multiple messages
+start_test "makers when showing multiple messages"
+cat >"$expected" <<EOF
+[ part 1 - text/plain -   30B  ]
+first message, part 1 content
+[ part 2 - text/plain - first message, part 2 C-D  30B  ]
+first message, part 2 content
+[ part 1 - text/plain -   31B  ]
+second message, part 1 content
+EOF
+
+cat >"`mhpath new`" <<EOF
+Content-Type: multipart/mixed;boundary="_boundary_"
+MIME-Version: 1.0
+
+--_boundary_
+Content-Type: text/plain
+
+first message, part 1 content
+
+--_boundary_
+Content-Type: text/plain
+Content-Description: first message, part 2 C-D
+
+first message, part 2 content
+
+--_boundary_--
+EOF
+
+cat >"`mhpath new`" <<EOF
+Content-Type: multipart/mixed;boundary="_boundary_"
+MIME-Version: 1.0
+
+--_boundary_
+Content-Type: text/plain
+
+second message, part 1 content
+
+--_boundary_--
+EOF
+
+run_prog mhshow -noheader -form mhl.null -concat last:2 > "$actual"
+check "$expected" "$actual"
+
+
+finish_test
+exit $failed
index e4c93a8..7cfe049 100644 (file)
@@ -113,9 +113,8 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly)
        formsw = mh_xstrdup(etcpath("mhl.headers"));
 
     /*
        formsw = mh_xstrdup(etcpath("mhl.headers"));
 
     /*
-     * Compile the content marker and header format lines
+     * Compile the header format line
      */
      */
-    mfmt = compile_marker(markerform);
     hfmt = compile_header(headerform);
 
     /*
     hfmt = compile_header(headerform);
 
     /*
@@ -131,14 +130,18 @@ show_all_messages(CT *cts, int concat, int textonly, int inlineonly)
        if (type_ok (ct, 1)) {
            if (headersw) output_header(ct, hfmt);
 
        if (type_ok (ct, 1)) {
            if (headersw) output_header(ct, hfmt);
 
+           /*
+            * Compile the content marker format line
+            */
+           mfmt = compile_marker(markerform);
            show_single_message (ct, formsw, concat, textonly, inlineonly,
                                 mfmt);
            show_single_message (ct, formsw, concat, textonly, inlineonly,
                                 mfmt);
+           fmt_free(mfmt, 0);
        }
     }
 
     free_markercomps();
     fmt_free(hfmt, 1);
        }
     }
 
     free_markercomps();
     fmt_free(hfmt, 1);
-    fmt_free(mfmt, 1);
 }
 
 
 }
 
 
@@ -1338,7 +1341,7 @@ compile_marker(char *form)
 
     fmtstring = new_fs(form, NULL, DEFAULT_MARKER);
 
 
     fmtstring = new_fs(form, NULL, DEFAULT_MARKER);
 
-    (void) fmt_compile(fmtstring, &fmt, 1);
+    (void) fmt_compile(fmtstring, &fmt, 0);
     free_fs();
 
     /*
     free_fs();
 
     /*