From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 951736DE098B for ; Fri, 1 Sep 2017 17:11:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a5ZFp3vDOB32 for ; Fri, 1 Sep 2017 17:11:28 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id A7F366DE009B for ; Fri, 1 Sep 2017 17:11:28 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dnvyU-0005LI-V3; Fri, 01 Sep 2017 20:07:46 -0400 Received: (nullmailer pid 15363 invoked by uid 1000); Sat, 02 Sep 2017 00:11:23 -0000 From: David Bremner To: Vladimir Panteleev , notmuch@notmuchmail.org Subject: [PATCH] test/crypto: remove headers more robustly Date: Fri, 1 Sep 2017 21:11:19 -0300 Message-Id: <20170902001119.15318-1-david@tethera.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170817175145.3204-7-notmuch@thecybershadow.net> References: <20170817175145.3204-7-notmuch@thecybershadow.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Sep 2017 00:11:33 -0000 In [1], Vladimir Panteleev observed that the In-Reply-To and References headers could be wrapped in the 'default' output format of notmuch-reply, depending on the version of Emacs creating the message. In my own experiments notmuch-reply sometimes wraps headers with only one message-id if that message-id is long enough. However it happens, this causes the previous approach using grep to fail. Since I found the proposed unwrapping shell fragment in [1] a bit hard to follow, I decided to write a little python script instead. [1] id:20170817175145.3204-7-notmuch@thecybershadow.net --- test/T350-crypto.sh | 2 +- test/test-lib.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh index 7dab39a2..fd950952 100755 --- a/test/T350-crypto.sh +++ b/test/T350-crypto.sh @@ -394,7 +394,7 @@ test_expect_equal_json \ test_begin_subtest "reply to encrypted message" output=$(notmuch reply --decrypt subject:"test encrypted message 002" \ - | grep -v -e '^In-Reply-To:' -e '^References:') + | notmuch_reply_sanitize_refs) expected='From: Notmuch Test Suite Subject: Re: test encrypted message 002 diff --git a/test/test-lib.sh b/test/test-lib.sh index d2b2a47f..4716f649 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -507,6 +507,17 @@ NOTMUCH_DUMP_TAGS () notmuch dump --include=tags "${@}" | sed '/^#/d' | sort } +notmuch_reply_sanitize_refs () +{ + $NOTMUCH_PYTHON -c " +import email,sys +msg=email.message_from_file(sys.stdin) +del msg['in-reply-to'] +del msg['references'] +print(msg.as_string(False)) +" +} + notmuch_search_sanitize () { perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' -- 2.14.1