From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from deimos.uberspace.de (deimos.uberspace.de [185.26.156.152]) by sourceware.org (Postfix) with ESMTPS id 4AB9F385701F for ; Thu, 12 May 2022 18:36:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4AB9F385701F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jdoubleu.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jdoubleu.de Received: (qmail 15884 invoked by uid 989); 12 May 2022 18:36:09 -0000 Authentication-Results: deimos.uberspace.de; auth=pass (plain) Message-ID: <361f9d4b-38ae-894d-e7a4-65a5ae3afb18@jdoubleu.de> Date: Thu, 12 May 2022 20:35:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] add tests for tzset(3) Content-Language: de-DE To: Jeff Johnston References: Cc: newlib@sourceware.org From: jdoubleu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Bar: / X-Rspamd-Report: BAYES_HAM(-0.124365) MIME_GOOD(-0.1) X-Rspamd-Score: -0.224365 Received: from unknown (HELO unkown) (::1) by deimos.uberspace.de (Haraka/2.8.28) with ESMTPSA; Thu, 12 May 2022 20:36:09 +0200 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: Thu, 12 May 2022 18:36:13 -0000 Hi Jeff, I finally found some time to have a look at your patch. > if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0 > || n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n]) > + else if (n < TZNAME_MIN || TZNAME_MAX < n) I think the sub-expression "TZNAME_MAX < n" can never be true, can it? sscanf will always stop after 10 characters. What do you think about including the TZNAME_MAX macro inside the format string? > #define STR(s) #s > #define STR_LIT(s) STR(s) > ... > sscanf(tzenv, "%" STR_LIT(TZNAME_MAX) "[-+0-9A-Za-z]%n", __tzname_dst, &n) I'll try to update the tests in the coming days, so I can verify your changes work as expected. Cheers --- 🙎🏻‍♂️ jdoubleu On 4/29/2022 5:46 PM, Jeff Johnston wrote: > I have revised my tzset_r.c patch so that the tzrules are initialized so we > don't inherit the previous settings if not specified for a particular TZ. > As well, I defaulted them if TZ is not specified. > > -- Jeff J.