1 Return-Path: <tomi.ollila@iki.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 09E6D431FDF
\r
6 for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 08:43:04 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 dpsQUGyQC-+m for <notmuch@notmuchmail.org>;
\r
16 Sun, 24 Nov 2013 08:42:56 -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 66466431FDD
\r
19 for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 08:42:56 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id CB64A10005E;
\r
22 Sun, 24 Nov 2013 18:42:46 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
25 Subject: Re: notmuch sha1 implementation broken on (some) big-endian
\r
27 In-Reply-To: <87eh666mhp.fsf@zancas.localnet>
\r
28 References: <87eh666mhp.fsf@zancas.localnet>
\r
29 User-Agent: Notmuch/0.16+175~g19e97d6 (http://notmuchmail.org) Emacs/24.3.1
\r
30 (x86_64-unknown-linux-gnu)
\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
32 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
33 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
34 Date: Sun, 24 Nov 2013 18:42:46 +0200
\r
35 Message-ID: <m2ob593g55.fsf@guru.guru-group.fi>
\r
37 Content-Type: text/plain
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Sun, 24 Nov 2013 16:43:04 -0000
\r
52 On Sun, Nov 24 2013, David Bremner <david@tethera.net> wrote:
\r
54 > The following code, when linked with libnotmuch.a and libutil.a does a
\r
55 > passable imitation of sha1sum on amd64 (and I guess also i386) but
\r
56 > computes a different digest on powerpc and probably sparc and s390x.
\r
58 > In the long run we should maybe outsource hash computations to
\r
59 > e.g. librhash, but I'd like a simpler fix for 0.17, if possible
\r
61 > P.S. I blame Austin for adding the "missing-headers" test which found
\r
64 This is interesting problem, I would have guessed that this would
\r
65 fails on LITTLE_ENDIAN machines easier, if ever...
\r
67 ... especially as there is line
\r
69 lib/libsha1.c:52:#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
\r
73 I could not find any (other) matches for PLATFORM_BYTE_ORDER nor
\r
74 IS_LITTLE_ENDIAN in source code or in /usr/include/**/*.h or
\r
75 in /usr/lib/gcc/**/*.h
\r
77 I did some testing and it seems that
\r
78 #if (FOOOO == BBBAAARRR)
\r
82 will have <code> in output file in case neither of the above are
\r
85 So, this could work:
\r
87 #if <endian.h> // for BYTE_ORDER && LITTLE_ENDIAN
\r
91 #if (BYTE_ORDER == LITTLE_ENDIAN)
\r
94 to replace lib/libsha1.c:53 (53 now after endian.h added)
\r
97 Please test on BIG_ENDIAN machine...
\r
100 In case this works, then we'd need to inform users that their
\r
101 long/missing Message ID:s are now coded differently in their
\r