From 706236baa4c4670b5a074092dec5dec63ff50663 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sat, 24 Nov 2012 09:08:31 -0600 Subject: [PATCH] Fixed pick(1) to properly unfold multiple-line header fields by removing newlines instead of replacing them with spaces [Bug #15215]. --- docs/pending-release-notes | 2 ++ test/pick/test-pick | 73 ++++++++++++++++++++++++++++---------------- uip/picksbr.c | 3 +- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 2f5efdb..bbdcedc 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -82,3 +82,5 @@ BUG FIXES be terminated with, or contain, a trailing semicolon [Bug #15604]. - Fixed sendfiles(1) to always provide a From: address. Also, updated its switches. +- Fixed pick(1) to properly unfold multiple-line header fields by + removing newlines instead of replacing them with spaces [Bug #15215]. diff --git a/test/pick/test-pick b/test/pick/test-pick index 9b737ce..84eb18c 100755 --- a/test/pick/test-pick +++ b/test/pick/test-pick @@ -78,25 +78,26 @@ run_test 'pick -not -lbrace -subject NoMatch -and -subject message.3 -rbrace' \ # Test MHPDEBUG. MHPDEBUG=1 pick -not -lbrace -subject NoMatch -and -subject message.3 -rbrace \ - >/dev/null 2>$actual -cat >$expected </dev/null 2>"$actual" +cat >"$expected" <$actual 2>/dev/null` >/dev/null -cat >$expected <"$actual" 2>/dev/null` \ + >/dev/null +cat >"$expected" </dev/tty; then # Produce no standard output if no messages match and standard @@ -136,56 +137,56 @@ run_test 'pick -to some -nolist' '11 hits' run_test 'pick -to user@example.com -nolist' '11 hits' # Test -after. -pick -after '28 Sep 2008 00:00:00' >$actual 2>&1 -cat >$expected <"$actual" 2>&1 +cat >"$expected" <$actual 2>/dev/null +pick -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null set -e -cat >$expected <"$expected" <$actual 2>&1 -cat >$expected <"$actual" 2>&1 +cat >"$expected" <$actual 2>&1 -cat >$expected <"$actual" 2>&1 +cat >"$expected" <$actual 2>/dev/null +pick -before '28 Sep 2006 00:00:00' last:3 >"$actual" 2>/dev/null set -e -cat >$expected <"$expected" <$actual 2>/dev/null +pick -datefield date -after '29 Sep 2008 00:00:00' >"$actual" 2>/dev/null set -e -cat >$expected <"$expected" <$actual 2>&1 -cat >$expected <"$actual" 2>&1 +cat >"$expected" <"$MH_TEST_DIR/Mail/inbox/12" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 12@test.nmh +Subject: multi-line + header field + +This is message number 12 +EOF + +echo 12 >"$expected" + +pick -subject 'multi-line header field' 12 >"$actual" 2>&1 +check "$expected" "$actual" + exit $failed diff --git a/uip/picksbr.c b/uip/picksbr.c index 4073919..4895b23 100644 --- a/uip/picksbr.c +++ b/uip/picksbr.c @@ -701,7 +701,8 @@ plist break; } lf++; - c = ' '; + /* Unfold by skipping the newline. */ + c = 0; } } if (c && p1 < &linebuf[LBSIZE - 1]) -- 1.7.10.4