From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 124863844047 for ; Tue, 17 Nov 2020 01:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 124863844047 Received: by mail-ej1-x62b.google.com with SMTP id y17so21531301ejh.11 for ; Mon, 16 Nov 2020 17:43:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=R48krZMQBCdgu/jIhwx8APH5t5eodo3mX9CzhGVv0iA=; b=GkRxukDHQ6prnt9L0LW3qSWVj7VYkBDA8r022qYLJeBXK04cc46fMMsoyfC7iy3mqq SyyWTSA86D6vTZGENc16ifaxV62JBR1fsZ7A5V246OlkQSGQVWzYea6SducQPqKuINkl RLAe48WsjHj5EQHKZdUal14K0xDesf+dMHtYyaOJfupKseXhgTj2/cLBEWNClsiM+C1z eDeNY7s9rSVyjRMNP4/XPc6gwXjSjiLm3Ou57rKsV8hPGnrBqVVfXXx/bnL+LvVwVEjb WYlhxxKJdSdRzOI+dzMY1K/FbHigbUbYTdWKRCrVJBZbS8oGvvjLdK6AGqTsnbBV+D+m 3OAA== X-Gm-Message-State: AOAM532CSDxWvc9BQUVUFj1/qmXF7kzlqIMU8TsUX0WDizq2hVbKcruY LEBER6hevFi91eNa87OoBMZrI2RpACPjVVMgihR9AdzK4w== X-Google-Smtp-Source: ABdhPJzC9q8eby8jK4wPJDeH7l+EaQDHb1Krp9GHAkSxMPKooQBrzqRtctx0jfGhiAicWrdjkOzU0bIyHCTdY3nCox4= X-Received: by 2002:a17:906:3813:: with SMTP id v19mr17612094ejc.462.1605577396904; Mon, 16 Nov 2020 17:43:16 -0800 (PST) MIME-Version: 1.0 References: <080401d6bada$6c52f060$44f8d120$.ref@yahoo.com> <080401d6bada$6c52f060$44f8d120$@yahoo.com> <20201116151359.GD41926@calimero.vinschen.de> <3a5f706a-f1c0-595f-ff96-e674cb72e233@SystematicSw.ab.ca> In-Reply-To: From: C Howland Date: Mon, 16 Nov 2020 20:43:06 -0500 Message-ID: Subject: Re: Fw: [PATCH] Add support for TZ names with <> in tzset To: newlib@sourceware.org X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2020 01:43:21 -0000 ------------------------------ > *From:* Newlib on behalf of Brian Inglis < > Brian.Inglis@SystematicSw.ab.ca> > *Sent:* Monday, November 16, 2020 5:30 PM > *To:* newlib@sourceware.org > *Subject:* Re: [PATCH] Add support for TZ names with <> in tzset > > On 2020-11-16 08:13, Corinna Vinschen via Newlib wrote: > > Hi Earle, > > > > On Nov 14 15:03, Earle F. Philhower, III via Newlib wrote: > >> Howdy all, > >> > >> Attached is a patch which extends the tzset() function to support a > format > >> for "unnamed" TZ environment timezones which use "<+/-nn>" as the > timezone > >> name instead of an alphabetic name. These are supported in glibc and > are > >> present in several major TZ databases that we use on the ESP8266 Arduino > >> core. For example, > >> > >>> #define TZ_Africa_Casablanca "<+01>-1" > >> > >> The existing tzset sscanf format string breaks at the first "+", > assuming > >> it's the > >> beginning of the offset. This patch special-cases names beginning with > "<" > >> to > >> circumvent the issue. > >> > >> Signed-off-by: Earle F. Philhower, III > > > > Basically this looks ok. I have two nits, though. > > > > - Now that the scanning got more complicated than a single sscanf call, > > this crys out for a helper function doing the actual scanning for > > both, std and dst strings. This could be an inline function which is > > only inlined > > #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) > > > > - The strcat call seems a bit heavy. What about sth like this instead: > > > > __tzname_ptr[n - 1] = '>'; > > __tzname_ptr[n] = '\0'; > > Should consider modifying the PD TZ project tzcode reference src > localtime.c > tzparse() > > https://github.com/eggert/tz/blob/master/localtime.c#L1069 > > (contributed to the public domain by Guy Harris): handles all the POSIX > rules > string edge cases to Paul Eggert's satisfaction, and gets patched if any > upstream org (every distro) or vendor (all OSes) reports a problem. > > -- > Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada > The proposal is missing the documentation update (in tzset.c) for the new feature. (This of course is needed regardless of the eventual method by which it is achieved.) Also, one question: since at present the TZ string is matching POSIX (at least, it is according to the documentation--I did not check the present source code against the statement), shouldn't there be a gate to control whether the extension is included or not? (In my tzset(3) man page in RHEL7, GLIBC does not mention this particular extension, so I don't know what gate they might use.) Strictly there should be; the question is how strict we want to be. Craig