Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 399EA6DE119D for ; Sat, 23 Jan 2016 08:33:31 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.658 X-Spam-Level: X-Spam-Status: No, score=0.658 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_NEUTRAL=0.652] 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 giHmxt9wqY0Q for ; Sat, 23 Jan 2016 08:33:28 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 9993B6DE0B27 for ; Sat, 23 Jan 2016 08:33:27 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id EC32610004A; Sat, 23 Jan 2016 18:33:36 +0200 (EET) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] test: refactor directory name sanitization In-Reply-To: <1453553366-7454-1-git-send-email-david@tethera.net> References: <1453553366-7454-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.21+32~g73439f8 (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.20 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, 23 Jan 2016 16:33:31 -0000 On Sat, Jan 23 2016, David Bremner wrote: > test_C and notmuch_search_files_sanitize were giving different output on > the same path, which is not technically wrong, but slightly > confusing. > --- > test/T560-lib-error.sh | 2 +- > test/test-lib.sh | 11 ++++++++--- > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh > index c280939..59a479c 100755 > --- a/test/T560-lib-error.sh > +++ b/test/T560-lib-error.sh > @@ -183,7 +183,7 @@ int main (int argc, char** argv) > EOF > cat <<'EOF' >EXPECTED > == stdout == > -Path already exists: CWD/mail > +Path already exists: MAIL_DIR > > == stderr == > EOF > diff --git a/test/test-lib.sh b/test/test-lib.sh > index 0c9b366..c8f14d9 100644 > --- a/test/test-lib.sh > +++ b/test/test-lib.sh > @@ -684,9 +684,14 @@ notmuch_search_sanitize () > perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' > } > > -notmuch_search_files_sanitize() > +notmuch_search_files_sanitize () > { > - sed -e "s,$MAIL_DIR,MAIL_DIR," > + notmuch_dir_sanitize > +} > + > +notmuch_dir_sanitize () > +{ > + sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@" Looks good, ^^ \ but 2 spaces there > } > > NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,' > @@ -1186,7 +1191,7 @@ test_C () { > echo "== stdout ==" > OUTPUT.stdout > echo "== stderr ==" > OUTPUT.stderr > ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr > - sed "s,${PWD},CWD,g" OUTPUT.stdout OUTPUT.stderr > OUTPUT > + notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr > OUTPUT Ditto, although this was th^^ere before, but now these 2 could be amended. BTW: I trust you tested. I did not. Tomi BTW2: MAIL_DIR is based on user's current CWD(*) -- if that contains commas (,) then things will break ;/ (*) +++(./test-lib-common.sh:148): MAIL_DIR=/home/user/vc/ext/notmuch/test/tmp.test-verbose/mail