From nobody Mon Aug 19 11:28:51 2024 X-Original-To: bugs@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 4WnVjJ2KGkz5SrMG for ; Mon, 19 Aug 2024 11:28:52 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WnVjH5Wtcz4YbR for ; Mon, 19 Aug 2024 11:28:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724066931; a=rsa-sha256; cv=none; b=fZBYvYNswM9y6Uvo4l8Omp5W+AWW5wUd6/zhzXl2cOJ3FC0AeHUbol6d2mAy9BprZwZOaB AERqlMz6RMTyRtWRYniheQoqiDdDABr/WlQaeohc7EWUW/8X1it2z+eS+nsjFy9AmWQG1G niJYysKjdWhZyj/WoYVA09uo29bS21G3HLdeu0Fy5Ni8EPqwbXoKFNoZ7ZkxzEjn/aZexJ eR8RPKEDVOSEJFLY3mtRxzpQzffEl4ry9PUHDxd4hCEZ5gKLbwSDddHZBrkjTzwKl1TMwO UeVlD+pGA1SuWpCoi6qHQIUwsHbBSvCAu9vI/Wfme7xsDhUzpjkeLRpoYNzHrA== 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=1724066931; 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; bh=7nYeG49YjsN8+9SbRlnoBuKXIKcDbwZPIMuwgO1h7fs=; b=nQpGNOH6+17YN9aOCmwmPXxuv+aLMgnrJXMrhrvwH/RkQ0eJmZ6hoBbvC0sgTf5AruXjIy RyPkjmQ7RiY5ql9gJurCkFET7U+rhyqpSVlyuUvEQk98S1FH8jhDgT7ccA8frR12ZFHXHU a/Y3FBNpH8Iuvrz9CeOVrZ8TH8E7Rxy89QZr8NGzlKbGPjV8OSS3f3f6CO/KPMqrtVWCRe wOFgbM22Jg1BDP1SM9JV27002UzCk/DIFkKV8vxDmmP3D0rs6FRdBz6IELk4eSi25N4Vtd o6hmls8hoKWzuufy9uClk4klHp/wgHnh8FBhknyFgjAdgyNbC0IU2RyNGtrQyg== 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 4WnVjH50m3zFJC for ; Mon, 19 Aug 2024 11:28:51 +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 47JBSpEt050981 for ; Mon, 19 Aug 2024 11:28:51 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 47JBSpHs050980 for bugs@FreeBSD.org; Mon, 19 Aug 2024 11:28:51 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: bugs@FreeBSD.org Subject: [Bug 280922] Change 46c599340f187db577b9212ab18022f3c7380c68 fixes one case (localtime / gmtime -> strftime('%s'), but breaks another Date: Mon, 19 Aug 2024 11:28:51 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: vlad.shabanov@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: 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: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D280922 Bug ID: 280922 Summary: Change 46c599340f187db577b9212ab18022f3c7380c68 fixes one case (localtime / gmtime -> strftime('%s'), but breaks another Product: Base System Version: 14.1-STABLE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: vlad.shabanov@gmail.com Attachment #252911 text/plain mime type: Created attachment 252911 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D252911&action= =3Dedit example code Change 46c599340f187db577b9212ab18022f3c7380c68 fixes one case (localtime / gmtime -> strftime('%s'), but breaks another: Classic POSIX specification says nothing about tm_zone and tm_gmtoff. A lot= of code assumes, than only described in the specification fields of struct tm affect to the result of strftime.=20 For example, Python has timetuple described in package "time", containing t= hese fields. The datetime module constructs timetuple to convert the datetime ob= ject to string (see https://github.com/python/cpython/blob/v3.12.5/Modules/_datetimemodule.c date_strftime then datetime_timetuple, then https://github.com/python/cpython/blob/v3.12.5/Modules/timemodule.c ) Change https://cgit.freebsd.org/src/commit/lib/libc/stdtime?id=3D46c599340f187db57= 7b9212ab18022f3c7380c68 fixes case discovered by Dag-Erling Sm=C3=B8rgrav but changes the behaviou= r when struct tm is constructed manually in assumption, than the structure contains only standard fields. IMHO, there is another solution: both localtime and gmtime fill not only tm->tm_gmtoff, but also tm->tm_zone. Hence, it's possible to distinguish two cases:=20 struct tm filled by library code and struct tm filled manually.=20 Yes, I know that strftime('%s') is undocumented feature in Python, but I su= re that this is only one case. I sure that a lot of code assumes than struct t= m is based in local timezone, not UTC. The example code ant proposed patch solving the issue are attached. --=20 You are receiving this mail because: You are the assignee for the bug.=