From 740e258c5622dfe9a98a474647d8ddc164109b2f Mon Sep 17 00:00:00 2001 From: Ken Hornstein Date: Sun, 18 Mar 2012 21:29:39 -0400 Subject: [PATCH] Fix a bug where a message header ending right on the stdio boundary would cause the body output in scan to be truncated. Also include a test for the aforementioned bug. --- Makefile.am | 1 + test/inc/test-inc-scanout | 195 +++++++++++++++++++++++++++++++++++++++++++++ uip/scansbr.c | 9 +++ 3 files changed, 205 insertions(+) create mode 100755 test/inc/test-inc-scanout diff --git a/Makefile.am b/Makefile.am index c781eb2..0727fea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,6 +50,7 @@ TESTS = test/bad-input/test-header \ test/forw/test-forw-digest \ test/forw/test-forw-format \ test/inc/test-deb359167 test/inc/test-eom-align \ + test/inc/test-inc-scanout \ test/manpages/test-manpages test/mhbuild/test-forw \ test/mhlist/test-mhlist test/mhparam/test-mhparam \ test/mhpath/test-mhpath \ diff --git a/test/inc/test-inc-scanout b/test/inc/test-inc-scanout new file mode 100755 index 0000000..75be7dc --- /dev/null +++ b/test/inc/test-inc-scanout @@ -0,0 +1,195 @@ +#!/bin/sh +# +# Check to see if the scan output is correct if we have a message +# right on the stdio buffer boundary +# + +set -e + +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 + +cat > "${MH_TEST_DIR}/test.mbox" < +To: Another Nobody +Date: Thu, 1 Mar 2012 01:02:03 -0500 +Subject: Who is on first? + +Abbott: Every dollar of it. And why not, the man's entitled to it. +Costello: Who is? +Abbott: Yes. +Costello: So who gets it? +Abbott: Why shouldn't he? Sometimes his wife comes down and collects it. +Costello: Who's wife? +Abbott: Yes. After all, the man earns it. +Costello: Who does? +Abbott: Absolutely. +Costello: Well, all I'm trying to find out is what's the guy's name on first base? +Abbott: Oh, no, no. What is on second base. +Costello: I'm not asking you who's on second. +Abbott: Who's on first! +EOF + +cat > "${MH_TEST_DIR}/test.mbox.2" < +To: Another Nobody +Date: Thu, 1 Mar 2012 01:02:03 -0500 +Subject: Who is on first? + +Abbott: Every dollar of it. And why not, the man's entitled to it. +Costello: Who is? +Abbott: Yes. +Costello: So who gets it? +Abbott: Why shouldn't he? Sometimes his wife comes down and collects it. +Costello: Who's wife? +Abbott: Yes. After all, the man earns it. +Costello: Who does? +Abbott: Absolutely. +Costello: Well, all I'm trying to find out is what's the guy's name on first base? +Abbott: Oh, no, no. What is on second base. +Costello: I'm not asking you who's on second. +Abbott: Who's on first! +EOF + +run_test "inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \ + "Incorporating new mail into inbox... + + 11+ 03/01 Mr Nobody Who is on first?<