From nobody Sun Feb 11 21:11:50 2024 X-Original-To: python@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TY0df2jP8z5BQp7 for ; Sun, 11 Feb 2024 21:11:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TY0df1S2lz4Rfb for ; Sun, 11 Feb 2024 21:11:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707685910; a=rsa-sha256; cv=none; b=hdW+h8pTwTNc+0fmHfbkOrc22gSxBDT5HQTZdLowyWC5IgsKaDreZHofIQKO/QmNfh9th0 zlGbQCnPnJR3W3Mc2Mqv0L9cWeHQDeQdg5VQQCQPMFPTezW7KLiDxgKvOt8CoEwH67wh1k rnltGYhu1hLz4emRQJxfNkZdRkTokYNJZUna5SBkOsJg8jc89bvzhOHa7R2WuRpfUh78dt t0Ec6WkXLPXQh7YeRVCtBbN4oWj+FleBTmfkOMz58YhQJFvWsV7CIqpT0dNHvND0S76ZDu eIIeIXetzKVVqXavwdgFaUJR2wJgf17Ewswn90lFaA+bSctfBKbkFAkfHUgm1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707685910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lbs7Jw215g7zTUhUj20bAiAtdFlASBMx5n1vnYdfFjw=; b=dwWUMftftO96ea+4zozjJIRec5OpuB5sKawD5mUkga8HyjAW7ozI5keGAJnYCNro3R6bEw ZaHZMrpPp0Fng42Fi9VlTx6xTnzu3Rc8rnOPkCof6Mt9Yf7PfUIGf6fAuibZQryLmsAlHj s9Jk7ZBJ6P3CGCApdZ2P5gbgGnZX58nca3s3871zRONY4mFOZ9dv1KrGZvKe9GnO1Xyyml gNEhXm3ZZmLtHpbcMUcCrEkYFaeANzfOb6XXp70vgTSVQGbJPT5vUc88fOgPhVy4Fup/wP Y5ltQixt1xkAIYalA2NUDd4nvMiX3qtDavxOoWe2foyKBObLjW0hTUNMzTf6fw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TY0df0WJJz1FL2 for ; Sun, 11 Feb 2024 21:11:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 41BLBosd044118 for ; Sun, 11 Feb 2024 21:11:50 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 41BLBoDa044116 for python@FreeBSD.org; Sun, 11 Feb 2024 21:11:50 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: python@FreeBSD.org Subject: [Bug 276281] lang/python39 fails to include tzset in time module Date: Sun, 11 Feb 2024 21:11:50 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: mdounin@mdounin.ru X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: python@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: FreeBSD-specific Python issues List-Archive: https://lists.freebsd.org/archives/freebsd-python List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-python@freebsd.org X-BeenThere: freebsd-python@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276281 Maxim Dounin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mdounin@mdounin.ru --- Comment #11 from Maxim Dounin --- This seems to be a bug in tzcode, as recently updated from tzcode2010m to tzcode2023c. The bug is still present upstream, checked most recent tzcode2= 024a and github. More specifically, the tzparse() function in localtime.c uses the increment_overflow_time() function, assuming that the resulting variable ("janfirst" variable) is not changed when the overflow is detected: https://github.com/eggert/tz/blob/e48c5b532a26e094db24a7de44c33786860c7ae1/= localtime.c#L1187 This assumption, however, is not true if increment_overflow_time() is implemented using C23 ckd_add() or __builtin_add_overflow(): the overflowed result is stored to the variable instead. This manifests itself on systems = with 32-bit time_t, where the loop in question reaches the overflow. The most trival workaround I can see would be to compile localtime.c with HAVE_STDCKDINT_H defined to 0, so that C implementation of increment_overflow_time() is used instead of __builtin_add_overflow(). The C implementation does not change the resulting variable on overflow, so the assumption of the code holds true. Here is a simple test with the most recent tzcode sources, tzcode2024a, on FreeBSD 13.2-RELEASE-p8 i386: $ make date cc -O2 -pipe -c date.c -o date.o printf '%s\n' >tzdir.h.out '#ifndef TZDEFAULT' '# define TZDEFAULT "/etc/localtime" /* default zone */' '#endif' '#ifndef TZDIR' '# define TZDIR "/usr/share/zoneinfo" /* TZif directory */' '#endif' mv tzdir.h.out tzdir.h cc -O2 -pipe -c localtime.c -o localtime.o cc -O2 -pipe -c strftime.c -o strftime.o cc -O2 -pipe -c asctime.c -o asctime.o cc -o date -O2 -pipe date.o localtime.o strftime.o asctime.o=20 $ TZ=3DAEST-10AEDT-11,M10.5.0,M3.5.0 ./date -r 1044144000 Sun Feb 2 10:00:00 AEST 2003 As can be seen from "10:00:00 AEST", the result is broken. The same code, recompiled with HAVE_STDCKDINT_H set to 0: $ touch localtime.c $ make date CFLAGS=3D-DHAVE_STDCKDINT_H=3D0 cc -DHAVE_STDCKDINT_H=3D0 -c localtime.c -o localtime.o cc -o date -DHAVE_STDCKDINT_H=3D0 date.o localtime.o strftime.o asctime.o= =20 $ TZ=3DAEST-10AEDT-11,M10.5.0,M3.5.0 ./date -r 1044144000 Sun Feb 2 11:00:00 AEDT 2003 Now the result is correct, "11:00:00 AEDT". It would be great if someone can take a look and implement a workaround. --=20 You are receiving this mail because: You are the assignee for the bug.=