Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D0834431FAF for ; Sun, 4 Nov 2012 12:58:33 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iGcxivQl3Izo for ; Sun, 4 Nov 2012 12:58:33 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id ECD6B431FAE for ; Sun, 4 Nov 2012 12:58:32 -0800 (PST) Received: by mail-la0-f53.google.com with SMTP id l5so4020644lah.26 for ; Sun, 04 Nov 2012 12:58:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:x-gm-message-state; bh=hHXnhcLoBLT5KIN5NG6/x/fKbZv8RnFa9VR4qPsXto0=; b=nUoCS8s8bc97b1nZf6c1DwFtzPHfFlAqJ5hgG1E6ubR1ldaDuaV880qI1toSL54Tet 8CpdCG8mbA65WhUO4ktgqrCWYu++bZv5BYRpnjcYgAwyaDkjbEFKUNcTk3d9BajIi10n KRV+7BDoGZpR0SQgwDskeJ1y0cLGvzZARPp2pf4DqhcLSJPmipbiki3WNWh+CewR8ZtM wxs1RzUSWMCs5dlTheGbYd0wZgc8dH1bXnkWTSTV2UKslakChHOyDcQBwMX6W/g0ROY+ VsbDOwZfR0vgLatWfvA8D0h8E1jBIZbQYjS2szw810FNr/G4fahTmrEYzGrvVVcJP0np RIvw== Received: by 10.112.14.9 with SMTP id l9mr3280837lbc.78.1352062710189; Sun, 04 Nov 2012 12:58:30 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id j9sm5070191lbk.17.2012.11.04.12.58.28 (version=SSLv3 cipher=OTHER); Sun, 04 Nov 2012 12:58:29 -0800 (PST) From: Jani Nikula To: Blake Jones Subject: Re: [PATCH 10/10] timegm: add portable implementation (Solaris support) In-Reply-To: <12349.1352043650@foo.net> References: <12349.1352043650@foo.net> User-Agent: Notmuch/0.14+81~g1924356 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Sun, 04 Nov 2012 22:58:26 +0200 Message-ID: <87ip9lf5l9.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQl/q1s8W6WYzw+VI6ifA1o0KiwDlXcFxSxH0rOcFfC86uotU8orr/BUcVRPtXfr0xxRqUeF Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2012 20:58:34 -0000 On Sun, 04 Nov 2012, Blake Jones wrote: > Hi Jani, > >> I'd prefer to use timegm() where available, and the suggested >> alternative [1] elsewhere. >> >> [1] http://www.kernel.org/doc/man-pages/online/pages/man3/timegm.3.html > > I considered this alternative, but decided against it because it's > completely MT-unsafe. I don't know whether libnotmuch itself is > MT-safe, but a process which called this routine in one thread would > temporarily throw off any timezone-related work that any other threads > were doing, even if they weren't using libnotmuch. That is a valid point. Yet it doesn't change the fact that I'd prefer to use timegm() where available. Internally, glibc uses the same code to implement both timegm() and mktime(), and I'd hate it if the results were subtly different depending on whether the time zone was specified in the input or not. That said, I'm not opposed to using your simple timegm() alternative in the compat code if you think it's good enough to get you going on Solaris. As to solving the compat linking problem, I think the patch at the end of this message should fix it. Please try that with the regular notmuch approach to portability. The general idea is to keep parse-time-string as independent as possible from the rest of notmuch (possibly turning it into a dynamic library and a package of its own eventually), but I think including compat.h is an acceptable exception to make. HTH, Jani. diff --git a/parse-time-string/Makefile.local b/parse-time-string/Makefile.local index 53534f3..b3e5385 100644 --- a/parse-time-string/Makefile.local +++ b/parse-time-string/Makefile.local @@ -1,7 +1,9 @@ dir := parse-time-string extra_cflags += -I$(srcdir)/$(dir) -libparse-time-string_c_srcs := $(dir)/parse-time-string.c +libparse-time-string_c_srcs = \ + $(notmuch_compat_srcs) \ + $(dir)/parse-time-string.c libparse-time-string_modules := $(libparse-time-string_c_srcs:.c=.o) diff --git a/parse-time-string/parse-time-string.c b/parse-time-string/parse-time-string.c index 584067d3..ccad422 100644 --- a/parse-time-string/parse-time-string.c +++ b/parse-time-string/parse-time-string.c @@ -32,6 +32,7 @@ #include #include +#include "compat.h" #include "parse-time-string.h" /*