From patchwork Sun Jan 5 05:57:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 104076 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4ECAE3858D35 for ; Sun, 5 Jan 2025 06:30:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4ECAE3858D35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=cs.ucla.edu header.i=@cs.ucla.edu header.a=rsa-sha256 header.s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C header.b=YavC+icr X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.cs.ucla.edu (mail.cs.ucla.edu [131.179.128.66]) by sourceware.org (Postfix) with ESMTPS id 980D03858408 for ; Sun, 5 Jan 2025 05:59:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 980D03858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.ucla.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.ucla.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 980D03858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=131.179.128.66 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736056757; cv=none; b=dH7GGP1+dcVwkIK3My9Y292xqAlbJzx83WgQORTtyG1DE8D4fMHrraNz8cRNNRXtu1cPoCRMMbqUeFhvPr8Oa83WTGN5j7lthGTZhsXR7Mg9zEYbKQoL8ry7Gd/7+NHaqw64mxahkA1D7sX5bMy5D3L0I6WSglAjas2EIMs80YA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736056757; c=relaxed/simple; bh=LPPWFbKfcDD4VayXqeVMAt0CZoXoU5Xs3WWVpSySso0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=r0GxYG9z8H0UnWCLcF6ZEX22BF6oWG9whUcTQfkJyT1POnGu5tTeUT/D9mg91rNyffFVhpQgHUjz9OfIOPMfwmCU3oFQ2QDW9QmwP0ys55T9qUzB9MMZI+v6bByr0q5lrFOtvJwJa9luaCXFLD3tcpVpprz0Qsehw04i4Br+dnk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 980D03858408 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 1C41B3C123845 for ; Sat, 4 Jan 2025 21:59:17 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id UZmlT9EqhiuC; Sat, 4 Jan 2025 21:59:16 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B147B3C123844; Sat, 4 Jan 2025 21:59:16 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu B147B3C123844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1736056756; bh=L280qU0/OIeXL1MFshoH+H8ln1M3TGrCdaqtK4+RTCQ=; h=From:To:Date:Message-ID:MIME-Version; b=YavC+icrNi1ZT03FZEp1Y9aFaRQWpK9X/3tw0XWz17Da7dF0tmlc19h4+MhJylRE/ AUqGMrfArx7DrRRLs2rj0vf0Iyn3Kl0C5+RrWmeMk2gjKQDYgt7XKU31/m8kOcLaZf D/RN6QoexWm8jEUoDs3jLuPU0+E0ZVrxt7W1NgbSFQHYmKesa74IOHq1IjWZj4Vh88 av4AwmoP0c2cd7y6/uP2ny1FkQhhB6gWd0W6tRlFZgVOPkAewf5ecu3x7pKGznejVm XL/Uqwsrt44LW+r9yxBFmLb0RGz4P/Asl04GcG0haF1xkhJNDaBJEvjkZAL89AtBex aVrjSynFk/yJw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 8pBCQXb6WFQW; Sat, 4 Jan 2025 21:59:16 -0800 (PST) Received: from wing.home (unknown [47.154.28.214]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 9AEED3C082EB9; Sat, 4 Jan 2025 21:59:16 -0800 (PST) From: Paul Eggert To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH 25/59] Fix mishandling of default DST rule Date: Sat, 4 Jan 2025 21:57:00 -0800 Message-ID: <20250105055750.1668721-26-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.45.2 In-Reply-To: <01207110-bd60-46ae-9c08-fb39c2011067@cs.ucla.edu> References: <01207110-bd60-46ae-9c08-fb39c2011067@cs.ucla.edu> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org For timezone settings like TZ="AST4ADT" where POSIX says the default is implementation-defined, time/tzfile.c has long had vestiges of an old attempt to be upward compatible with UNIX System V. This code has not worked for decades and evidently is not being used, so remove it and use the simpler fallback code already present in time/tzset.c, which uses US DST. Also, add a few test cases to demonstrate some bugs in the removed code. * time/tst-posixtz.c: Include stdckdint.h. (tests): WHEN is now intmax_t, not time_t, to support skipping tests after 2038 on 32-bit time_t. All uses changed. Make it const while we're at it. Add several tests for AST4ADT. * time/tzfile.c (rule_dstoff): Remove. All uses removed. (__tzfile_read): Remove args EXTRA, EXTRAP. All uses changed. (__tzfile_default): Remove. All uses removed. (__tzfile_compute): Remove no-longer-needed code dealing with __tzfile_default. * timezone/Makefile (build-testdata): Add '-p $(posixrules)' option if compiling 'northamerica', so that we can test non-use of posixrules. * timezone/tst-timezone.c: Include stdbool.h, stdckdint.h. (failed): Now bool, not int. All uses changed. (do_test): Test AST4ADT too. --- Makeconfig | 16 +++++++--------- NEWS | 11 +++++------ manual/time.texi | 8 +++----- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Makeconfig b/Makeconfig index d0108d2caa..a4be5b0e21 100644 --- a/Makeconfig +++ b/Makeconfig @@ -285,19 +285,17 @@ ifndef leapseconds leapseconds = /dev/null endif -# What timezone's DST rules should be used when a POSIX-style TZ -# environment variable doesn't specify any rules. For 1003.1 compliance -# this timezone must use rules that are as U.S. federal law defines DST. -# Run `make -C time echo-zonenames' to see a list of available zone names. -# This setting can be changed with `zic -p TIMEZONE' at any time. -# If you want POSIX.1 compatibility, use `America/New_York'. +# What timezone's DST rules to use when testing that glibc does +# not mishandle TZif files built with zic's obsolescent -p option. +# This macro no longer affects glibc's code or installation. ifndef posixrules posixrules = America/New_York endif -# Where to install the "posixrules" timezone file; this is file -# whose contents $(posixrules) specifies. If this is a relative -# pathname, it is relative to $(zonedir). +# Where to put the "posixrules" timezone file used during testing; this +# is the file whose contents $(posixrules) specifies. +# If this is a relative pathname, it is relative to $(zonedir). +# Like posixrules, this macro no longer affects glibc's code or installation. ifndef posixrules-file posixrules-file = posixrules endif diff --git a/NEWS b/NEWS index 3e6227a448..a62fb8136d 100644 --- a/NEWS +++ b/NEWS @@ -84,12 +84,11 @@ Deprecated and removed features, and other changes affecting compatibility: explicitly because of the executable bit in GNU_STACK, and the stack is not already executable. Instead, loading such objects will fail. -* The default daylight saving rules for old Unix System V style TZ - strings like TZ="AST4ADT" are now those of current US DST. Although - the rules were supposed to be those of /usr/share/zoneinfo/posixrules, - this feature, which has been disabled by default and marked obsolete - upstream in tzcode, did not work in either glibc or tzcode, and in - practice posixrules invariably specified current US DST anyway. +* The US daylight saving rule is now the default for incomplete TZ + strings like TZ="AST4ADT" that use the TZ syntax from circa-1980s + Unix System V. Formerly the rule was documented to be that of + /usr/share/zoneinfo/posixrules but this did not work and in practice + posixrules invariably specified the US rule anyway. Changes to build and runtime requirements: diff --git a/manual/time.texi b/manual/time.texi index 28d8912446..cff94cb48b 100644 --- a/manual/time.texi +++ b/manual/time.texi @@ -2759,11 +2759,9 @@ and offset for the corresponding daylight saving time zone; if the The remainder of the proleptic format, which starts with the first comma, describes when daylight saving time is in effect. This remainder is -optional and if omitted, @theglibc{} defaults to US daylight saving rules. -rules that would be used if @env{TZ} had the value @t{"posixrules"}. -However, other POSIX implementations default to different daylight -saving rules, so portable @env{TZ} settings should not omit the -remainder. +optional and if omitted, @theglibc{} defaults to the US daylight saving rule. +POSIX does not specify this default, so portable @env{TZ} settings +should not omit the remainder. In the remainder, the @var{start} field is when daylight saving time goes into effect and the @var{end} field is when the change is made back to standard