--- /dev/null
+Return-Path: <too@guru-group.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 415936DE0222\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 05:17:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.283\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.283 tagged_above=-999 required=5 tests=[AWL=0.292, \r
+ HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ 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 x1LLv-vd4cLq for <notmuch@notmuchmail.org>;\r
+ Fri, 15 Apr 2016 05:17:41 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id ADBAB6DE00F5\r
+ for <notmuch@notmuchmail.org>; Fri, 15 Apr 2016 05:17:40 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 852D010019D; Fri, 15 Apr 2016 15:17:35 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Cc: tomi.ollila@iki.fi\r
+Subject: [PATCH] test: fix die() in test-lib.sh and test-lib-common.sh\r
+Date: Fri, 15 Apr 2016 15:17:33 +0300\r
+Message-Id: <1460722653-19363-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.6.4\r
+In-Reply-To: <1460525704-15145-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1460525704-15145-1-git-send-email-tomi.ollila@iki.fi>\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: Fri, 15 Apr 2016 12:17:49 -0000\r
+\r
+Restoring fd was forgotten in die() implemented in test-lib.sh\r
+(so far it did not matter as the only place die was called the\r
+standard fd redirections were not in effect).\r
+\r
+In scripts that include test-lib-common.sh but not test-lib.sh\r
+the die() implementation needs to be a bit different due to\r
+fd redirection differences. test-lib-common.sh implements die()\r
+only if it was not implemented already.\r
+---\r
+ test/test-lib-common.sh | 6 ++++++\r
+ test/test-lib.sh | 1 +\r
+ 2 files changed, 7 insertions(+)\r
+\r
+diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh\r
+index 4e17b78..f3b00d8 100644\r
+--- a/test/test-lib-common.sh\r
++++ b/test/test-lib-common.sh\r
+@@ -17,6 +17,12 @@\r
+ # This file contains common code to be used by both the regular\r
+ # (correctness) tests and the performance tests.\r
+ \r
++# test-lib.sh defines die() which echoes to nonstandard fd where\r
++# output was redirected earlier in that file. If test-lib.sh is not\r
++# loaded, neither this redirection nor die() function were defined.\r
++#\r
++type die >/dev/null 2>&1 || die () { echo "$@" >&2; exit 1; }\r
++\r
+ find_notmuch_path ()\r
+ {\r
+ dir="$1"\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 2951a8f..b000232 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -252,6 +252,7 @@ die_signal () {\r
+ \r
+ die () {\r
+ _die_common\r
++ exec >&6\r
+ say_color error '%-6s' FATAL\r
+ echo " $*"\r
+ echo\r
+-- \r
+2.5.5\r
+\r