--- /dev/null
+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 olra.theworths.org (Postfix) with ESMTP id 8850F431FD4\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Nov 2013 08:37:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id QWAnlPyt0ik5 for <notmuch@notmuchmail.org>;\r
+ Sat, 23 Nov 2013 08:37:01 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9EE5F431FD0\r
+ for <notmuch@notmuchmail.org>; Sat, 23 Nov 2013 08:37:00 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 45C64100030;\r
+ Sat, 23 Nov 2013 18:36:51 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: david@tethera.net, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] test: replace $PWD with YYY in emacs & emacs-show\r
+ tests\r
+In-Reply-To: <1385204476-14360-1-git-send-email-david@tethera.net>\r
+References: <m2vbzjqw5s.fsf@guru.guru-group.fi>\r
+ <1385204476-14360-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.16+175~g19e97d6 (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 Nov 2013 18:36:51 +0200\r
+Message-ID: <m2y54f9isc.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.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 23 Nov 2013 16:37:09 -0000\r
+\r
+On Sat, Nov 23 2013, david@tethera.net wrote:\r
+\r
+> From: David Bremner <david@tethera.net>\r
+>\r
+> When executed command line is written to *Notmuch errors* buffer,\r
+> shell-quote-argument will backslash-escape any char that is not in\r
+> "POSIX filename characters" (i.e. matching "[^-0-9a-zA-Z_./\n]").\r
+>\r
+> Currently in two emacs tests shell has expanded $PWD as part of\r
+> emacs variable, which will later be fed to #'shell-quote-argument\r
+> and finally written to ERROR file. If $PWD contained non-POSIX\r
+> filename characters, data in ERROR file will not match $PWD when\r
+> later comparing in shell. Therefore, in these two particular cases\r
+> the escaped $PWD is replaced with YYY in ERROR file and expected\r
+> content is adjusted accordingly.\r
+> ---\r
+>\r
+> In this second version, pass the command name to filter as a parameter\r
+\r
+LGTM.\r
+\r
+Tomi\r
+\r
+\r
+>\r
+> test/emacs | 15 ++++++++-------\r
+> test/emacs-show | 10 +++++-----\r
+> test/test-lib.sh | 11 +++++++++++\r
+> 3 files changed, 24 insertions(+), 12 deletions(-)\r
+>\r
+> diff --git a/test/emacs b/test/emacs\r
+> index 3b3b14d..456435c 100755\r
+> --- a/test/emacs\r
+> +++ b/test/emacs\r
+> @@ -881,15 +881,16 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
+> (with-current-buffer \"*Notmuch errors*\"\r
+> (test-output \"ERROR\"))\r
+> (test-output))"\r
+> -sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
+> -test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
+> +\r
+> +test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\\r
+> +=== OUTPUT ===\r
+> End of search results.\r
+> ----\r
+> -$PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)\r
+> ----\r
+> +=== MESSAGES ===\r
+> +YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)\r
+> +=== ERROR ===\r
+> [XXX]\r
+> -$PWD/notmuch_fail exited with status 1\r
+> -command: $PWD/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox\r
+> +YYY/notmuch_fail exited with status 1\r
+> +command: YYY/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox\r
+> exit status: 1"\r
+> \r
+> test_begin_subtest "Search handles subprocess warnings"\r
+> diff --git a/test/emacs-show b/test/emacs-show\r
+> index fb23db4..ec86333 100755\r
+> --- a/test/emacs-show\r
+> +++ b/test/emacs-show\r
+> @@ -181,14 +181,14 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
+> (with-current-buffer \"*Notmuch errors*\"\r
+> (test-output \"ERROR\"))\r
+> (test-output))"\r
+> -sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
+> -test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
+> ----\r
+> +test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\\r
+> +=== OUTPUT ===\r
+> +=== MESSAGES ===\r
+> This is an error (see *Notmuch errors* for more details)\r
+> ----\r
+> +=== ERROR ===\r
+> [XXX]\r
+> This is an error\r
+> -command: $PWD/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\'\r
+> +command: YYY/notmuch_fail show --format\\=sexp --format-version\\=1 --exclude\\=false \\' \\* \\'\r
+> exit status: 1\r
+> stderr:\r
+> This is an error\r
+> diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+> index 2aa4dfc..8611ba5 100644\r
+> --- a/test/test-lib.sh\r
+> +++ b/test/test-lib.sh\r
+> @@ -628,6 +628,17 @@ notmuch_json_show_sanitize ()\r
+> -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g'\r
+> }\r
+> \r
+> +notmuch_emacs_error_sanitize ()\r
+> +{\r
+> + local command=$1\r
+> + shift\r
+> + for file in "$@"; do\r
+> + echo "=== $file ==="\r
+> + cat "$file"\r
+> + done | sed \\r
+> + -e 's/^\[.*\]$/[XXX]/' \\r
+> + -e "s|^\(command: \)\{0,1\}/.*/$command|\1YYY/$command|"\r
+> +}\r
+> # End of notmuch helper functions\r
+> \r
+> # Use test_set_prereq to tell that a particular prerequisite is available.\r
+> -- \r
+> 1.8.4.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r