Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / c7 / 338369ffda568d25bd3f88478acc2537f812e7
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 0D2CA431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 13:15:14 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id h9lMOkHOZn1F for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Feb 2014 13:15:08 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 6B9D9431FAF\r
19         for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 13:15:08 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 461CB1000FB; Mon, 10 Feb 2014 23:15:02 +0200 (EET)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH v2] support for generating decreasing dates in bash 4.0 and\r
25  4.1\r
26 Date: Mon, 10 Feb 2014 23:15:00 +0200\r
27 Message-Id: <1392066900-11207-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.8.0\r
29 In-Reply-To: <1388593552-25920-1-git-send-email-tomi.ollila@iki.fi>\r
30 References: <1388593552-25920-1-git-send-email-tomi.ollila@iki.fi>\r
31 Cc: tomi.ollila@iki.fi\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Mon, 10 Feb 2014 21:15:14 -0000\r
45 \r
46 The printf builtin "%(fmt)T" specifier (which allows time values\r
47 to use strftime-like formatting) is introduced in bash 4.2.\r
48 \r
49 Trying to execute this in pre-4.2 bash will fail -- and if this\r
50 happens execute the fallback piece of perl code to do the same thing.\r
51 ---\r
52  test/test-lib.sh | 8 ++++++--\r
53  1 file changed, 6 insertions(+), 2 deletions(-)\r
54 \r
55 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
56 index 78af170..a1c0f27 100644\r
57 --- a/test/test-lib.sh\r
58 +++ b/test/test-lib.sh\r
59 @@ -374,8 +374,12 @@ generate_message ()\r
60         # we use decreasing timestamps here for historical reasons;\r
61         # the existing test suite when we converted to unique timestamps just\r
62         # happened to have signicantly fewer failures with that choice.\r
63 -       template[date]=$(TZ=UTC printf "%(%a, %d %b %Y %T %z)T\n" \\r
64 -                       $((978709437 - gen_msg_cnt)))\r
65 +       local date_secs=$((978709437 - gen_msg_cnt))\r
66 +       # printf %(..)T is bash 4.2+ feature. use perl fallback if needed...\r
67 +       TZ=UTC printf -v template[date] "%(%a, %d %b %Y %T %z)T" $date_secs 2>/dev/null ||\r
68 +           template[date]=`perl -le 'use POSIX "strftime";\r
69 +                               @time = gmtime '"$date_secs"';\r
70 +                               print strftime "%a, %d %b %Y %T +0000", @time'`\r
71      fi\r
72  \r
73      additional_headers=""\r
74 -- \r
75 1.8.0\r
76 \r