--- /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 olra.theworths.org (Postfix) with ESMTP id 0D2CA431FBD\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 13:15:14 -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 h9lMOkHOZn1F for <notmuch@notmuchmail.org>;\r
+ Mon, 10 Feb 2014 13:15:08 -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 6B9D9431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 13:15:08 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 461CB1000FB; Mon, 10 Feb 2014 23:15:02 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] support for generating decreasing dates in bash 4.0 and\r
+ 4.1\r
+Date: Mon, 10 Feb 2014 23:15:00 +0200\r
+Message-Id: <1392066900-11207-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1388593552-25920-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1388593552-25920-1-git-send-email-tomi.ollila@iki.fi>\r
+Cc: tomi.ollila@iki.fi\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: Mon, 10 Feb 2014 21:15:14 -0000\r
+\r
+The printf builtin "%(fmt)T" specifier (which allows time values\r
+to use strftime-like formatting) is introduced in bash 4.2.\r
+\r
+Trying to execute this in pre-4.2 bash will fail -- and if this\r
+happens execute the fallback piece of perl code to do the same thing.\r
+---\r
+ test/test-lib.sh | 8 ++++++--\r
+ 1 file changed, 6 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 78af170..a1c0f27 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -374,8 +374,12 @@ generate_message ()\r
+ # we use decreasing timestamps here for historical reasons;\r
+ # the existing test suite when we converted to unique timestamps just\r
+ # happened to have signicantly fewer failures with that choice.\r
+- template[date]=$(TZ=UTC printf "%(%a, %d %b %Y %T %z)T\n" \\r
+- $((978709437 - gen_msg_cnt)))\r
++ local date_secs=$((978709437 - gen_msg_cnt))\r
++ # printf %(..)T is bash 4.2+ feature. use perl fallback if needed...\r
++ TZ=UTC printf -v template[date] "%(%a, %d %b %Y %T %z)T" $date_secs 2>/dev/null ||\r
++ template[date]=`perl -le 'use POSIX "strftime";\r
++ @time = gmtime '"$date_secs"';\r
++ print strftime "%a, %d %b %Y %T +0000", @time'`\r
+ fi\r
+ \r
+ additional_headers=""\r
+-- \r
+1.8.0\r
+\r