Re: [PATCH 2/3] test: Add `test_emacs_expect_t'.
authorTomi Ollila <tomi.ollila@iki.fi>
Thu, 19 Jan 2012 10:32:21 +0000 (12:32 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:40 +0000 (09:42 -0800)
86/eb0b9721ce628fd1197060a4bdd23131faa8ed [new file with mode: 0644]

diff --git a/86/eb0b9721ce628fd1197060a4bdd23131faa8ed b/86/eb0b9721ce628fd1197060a4bdd23131faa8ed
new file mode 100644 (file)
index 0000000..b1a7696
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <tomi.ollila@nixu.com>\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 3AAFC431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 02:32:31 -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 pOTx5xtNI6xP for <notmuch@notmuchmail.org>;\r
+       Thu, 19 Jan 2012 02:32:30 -0800 (PST)\r
+Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 5EE63431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 02:32:30 -0800 (PST)\r
+Received: from pps.filterd (mail-gw3 [127.0.0.1])\r
+       by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id q0JAJDFI019186;\r
+       Thu, 19 Jan 2012 12:32:23 +0200\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+       by mail-gw3.nixu.fi with ESMTP id 114cs19sj4-1\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 19 Jan 2012 12:32:23 +0200\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+       by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
+       q0JAWLNI026732; Thu, 19 Jan 2012 12:32:23 +0200\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Edmondson <dme@dme.org>, <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH 2/3] test: Add `test_emacs_expect_t'.\r
+In-Reply-To: <cunzkdk57yj.fsf@hotblack-desiato.hh.sledj.net>\r
+References: <87pqei327k.fsf@gmail.com>\r
+       <1326809224-22673-1-git-send-email-dme@dme.org>\r
+       <1326809224-22673-2-git-send-email-dme@dme.org>\r
+       <yf6zkdlawlc.fsf@taco2.nixu.fi>\r
+       <cunzkdk57yj.fsf@hotblack-desiato.hh.sledj.net>\r
+User-Agent: Notmuch/0.11+71~gefa5d6c (http://notmuchmail.org) Emacs/23.3.1\r
+       (i686-pc-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: Thu, 19 Jan 2012 12:32:21 +0200\r
+Message-ID: <yf662g8asp6.fsf@taco2.nixu.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.6.7361,\r
+ 1.0.211,      0.0.0000        definitions=2012-01-19_05:2012-01-19, 2012-01-19,\r
+       1970-01-01 signatures=0\r
+X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0\r
+       ipscore=0 suspectscore=0\r
+       phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0\r
+       reason=mlx\r
+       scancount=1 engine=6.0.2-1012030000 definitions=main-1201190034\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: Thu, 19 Jan 2012 10:32:31 -0000\r
+\r
+On Thu, 19 Jan 2012 09:59:16 +0000, David Edmondson <dme@dme.org> wrote:\r
+> On Wed, 18 Jan 2012 16:55:59 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> > > +        # Report success/failure.\r
+> > > +        if ! test_skip "$test_subtest_name"\r
+> > > +        then\r
+> > > +                if [ "$result" == t ]\r
+> > \r
+> >            if [ "$result" = t ]\r
+> > \r
+> > to be compatible with POSIX and consistent with rest code.\r
+> \r
+> I'm happy to change this.\r
+\r
+As your older patch has been marked obsolete and this really is the\r
+only place where there is == in comparison code please do that change.\r
+\r
+> > > +                        test_failure_ "$test_subtest_name" "$(eval printf ${result})"\r
+> > \r
+> > This added 'eval' made me investigate further... running \r
+> > \r
+> > emacsclient --eval '(print (concat "a" "b" "\t" "c" "\n" "z"))'\r
+> > \r
+> > outputs "ab        c\nz" (tab between 'ab' and 'c', quotes (") around\r
+> > the whole output and newlines as "\n" (even '\r' is converted)).\r
+> > \r
+> > If emacs tests run via test_emacs_expect_t wrote their output \r
+> > to ${output} directly above code could be much cleaner in many\r
+> > places. Environment variable could be used for the file name.\r
+> \r
+> I'm reluctant to change this just to avoid calling eval.\r
+\r
+Consider the following:\r
+\r
+$ emacsclient --eval '(print "$(echo rm -rf /); echo `date +%Y`")'\r
+"$(echo rm -rf /); echo `date +%Y`"\r
+\r
+x='"$(echo rm -rf /); echo `date +%Y`"'\r
+\r
+$echo $x\r
+"$(echo rm -rf /); echo `date +%Y`"\r
+\r
+$echo $(eval printf $x)\r
+rm -rf /; echo 2012\r
+\r
+x='"$(echo rm /); echo `date +%Y`"'\r
+\r
+$(eval printf $x)\r
+rm: cannot remove `/;': No such file or directory\r
+rm: cannot remove `2012': No such file or directory\r
+\r
+one just needs to make sure there is no $:s and `: in \r
+the output... hmm, nor ';' ...NOR '&':s ...\r
+\r
+I am not absolutely sure this might actually happen\r
+but surely I'm not sure it would not...\r
+\r
+... The suggestion having environment variable would\r
+now work, but what about\r
+\r
+test_emacs "(setq test-output-file \"${output}\") $1"\r
+\r
+\r
+Tomi\r
+\r
+PS:\r
+\r
+this needs to be changed:\r
+       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"\r
+to\r
+       emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $*)"\r
+then\r
+       test_emacs   "(setq test-output-file \"${output}\")"   "$1"\r
+\r
+would be safe\r