Re: [PATCH] test: refactor directory name sanitization
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 23 Jan 2016 16:33:36 +0000 (18:33 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:55 +0000 (16:20 -0700)
96/8d3c8d1b5242e850ba142b08e23dc6913ac1a8 [new file with mode: 0644]

diff --git a/96/8d3c8d1b5242e850ba142b08e23dc6913ac1a8 b/96/8d3c8d1b5242e850ba142b08e23dc6913ac1a8
new file mode 100644 (file)
index 0000000..9a98d14
--- /dev/null
@@ -0,0 +1,118 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 399EA6DE119D\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Jan 2016 08:33:31 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.658\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.658 tagged_above=-999 required=5 tests=[AWL=0.006, \r
+ SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id giHmxt9wqY0Q for <notmuch@notmuchmail.org>;\r
+ Sat, 23 Jan 2016 08:33:28 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 9993B6DE0B27\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Jan 2016 08:33:27 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id EC32610004A;\r
+ Sat, 23 Jan 2016 18:33:36 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] test: refactor directory name sanitization\r
+In-Reply-To: <1453553366-7454-1-git-send-email-david@tethera.net>\r
+References: <1453553366-7454-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.21+32~g73439f8 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sat, 23 Jan 2016 18:33:36 +0200\r
+Message-ID: <m2mvrws1b3.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 23 Jan 2016 16:33:31 -0000\r
+\r
+On Sat, Jan 23 2016, David Bremner <david@tethera.net> wrote:\r
+\r
+> test_C and notmuch_search_files_sanitize were giving different output on\r
+> the same path, which is not technically wrong, but slightly\r
+> confusing.\r
+> ---\r
+>  test/T560-lib-error.sh |  2 +-\r
+>  test/test-lib.sh       | 11 ++++++++---\r
+>  2 files changed, 9 insertions(+), 4 deletions(-)\r
+>\r
+> diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+> index c280939..59a479c 100755\r
+> --- a/test/T560-lib-error.sh\r
+> +++ b/test/T560-lib-error.sh\r
+> @@ -183,7 +183,7 @@ int main (int argc, char** argv)\r
+>  EOF\r
+>  cat <<'EOF' >EXPECTED\r
+>  == stdout ==\r
+> -Path already exists: CWD/mail\r
+> +Path already exists: MAIL_DIR\r
+>  \r
+>  == stderr ==\r
+>  EOF\r
+> diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+> index 0c9b366..c8f14d9 100644\r
+> --- a/test/test-lib.sh\r
+> +++ b/test/test-lib.sh\r
+> @@ -684,9 +684,14 @@ notmuch_search_sanitize ()\r
+>      perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'\r
+>  }\r
+>  \r
+> -notmuch_search_files_sanitize()\r
+> +notmuch_search_files_sanitize ()\r
+>  {\r
+> -    sed -e "s,$MAIL_DIR,MAIL_DIR,"\r
+> +    notmuch_dir_sanitize\r
+> +}\r
+> +\r
+> +notmuch_dir_sanitize ()\r
+> +{\r
+> +    sed -e  "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"\r
+\r
+Looks good,  ^^ \ but 2 spaces there\r
+\r
+>  }\r
+>  \r
+>  NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'\r
+> @@ -1186,7 +1191,7 @@ test_C () {\r
+>      echo "== stdout ==" > OUTPUT.stdout\r
+>      echo "== stderr ==" > OUTPUT.stderr\r
+>      ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr\r
+> -    sed "s,${PWD},CWD,g"  OUTPUT.stdout OUTPUT.stderr > OUTPUT\r
+> +    notmuch_dir_sanitize  OUTPUT.stdout OUTPUT.stderr > OUTPUT\r
+\r
+Ditto, although this was th^^ere before, but now these 2 could be amended.\r
+\r
+BTW: I trust you tested. I did not.\r
+\r
+Tomi\r
+\r
+\r
+BTW2: MAIL_DIR is based on user's current CWD(*) -- if that contains commas\r
+(,) then things will break ;/\r
+\r
+(*) +++(./test-lib-common.sh:148): MAIL_DIR=/home/user/vc/ext/notmuch/test/tmp.test-verbose/mail\r
+\r
+\r
+\r