From 1403bf766f932da743a4c955990341c1fdf2359a Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sun, 18 Aug 2013 21:05:45 +0300 Subject: [PATCH] Re: [PATCH] test: Canonicalize RFC 2047 encoding and charset --- e4/be82bd17ff7d643c852b4c152db607b06d0bd2 | 107 ++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 e4/be82bd17ff7d643c852b4c152db607b06d0bd2 diff --git a/e4/be82bd17ff7d643c852b4c152db607b06d0bd2 b/e4/be82bd17ff7d643c852b4c152db607b06d0bd2 new file mode 100644 index 000000000..d171358ec --- /dev/null +++ b/e4/be82bd17ff7d643c852b4c152db607b06d0bd2 @@ -0,0 +1,107 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 56DC8431FDD + for ; Sun, 18 Aug 2013 11:06:00 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 6wlJn2OD1Dlu for ; + Sun, 18 Aug 2013 11:05:54 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 04E2F431FDB + for ; Sun, 18 Aug 2013 11:05:54 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 91A1F100086; + Sun, 18 Aug 2013 21:05:45 +0300 (EEST) +From: Tomi Ollila +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] test: Canonicalize RFC 2047 encoding and charset +In-Reply-To: <1376833926-6024-1-git-send-email-amdragon@mit.edu> +References: <1376833926-6024-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.16+3~g340c058 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Sun, 18 Aug 2013 18:06:00 -0000 + +On Sun, Aug 18 2013, Austin Clements wrote: + +> RFC 2047 states that the encoding and charset in an encoded word are +> case-insensitive, so force them to lower case in the reply test. This +> fixes an issue caused by GMime versions (somewhere between 2.6.10 and +> 2.6.16), which changed the capitalization of the encoding. +> --- +> test/reply | 8 +++++--- +> 1 file changed, 5 insertions(+), 3 deletions(-) +> +> diff --git a/test/reply b/test/reply +> index d4389cf..a078927 100755 +> --- a/test/reply +> +++ b/test/reply +> @@ -201,12 +201,14 @@ add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \ +> '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \ +> '[body]="Encoding"' +> +> -output=$(notmuch reply id:${gen_msg_id}) +> -# Note that GMime changes from Q- to B-encoding +> +# GMime happens to change from Q- to B-encoding. We canonicalize the +> +# case of the encoding and charset because different versions of GMime +> +# capitalize the encoding differently. +> +output=$(notmuch reply id:${gen_msg_id} | sed 's/=?[^?]*?[bB]?/\L&/g') + +The sed expression looks fancy enough to be GNU sed extension (\L& doing +tolower to the matching part?). A more portable alternative could be: + +output=$(notmuch reply id:${gen_msg_id} | sed -e 's/?UTF-8?/?utf-8?/g' \ + -e 's/?ISO-88591-1?/?iso-88591-1?/g' -e 's/?B?/?b?/g') + +or alternatively (some bashism): + +output=$(notmuch reply id:${gen_msg_id}) +output=${output//\?UTF-8\?/?utf-8?} +output=${output//\?ISO-8859-1\?/?iso-8859-1?} +output=${output//\?B\?/?b?} + + +Tomi + + +> test_expect_equal "$output" "\ +> From: Notmuch Test Suite +> Subject: Re: =?iso-8859-1?b?4N/n?= +> -To: =?UTF-8?b?4piD?= +> +To: =?utf-8?b?4piD?= +> In-Reply-To: <${gen_msg_id}> +> References: <${gen_msg_id}> +> +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2