From nobody Tue Jul 04 03:17:23 2023 X-Original-To: dev-commits-src-main@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 4Qw7LD2cmzz4lVZW for ; Tue, 4 Jul 2023 03:19:00 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qw7Jc6Z4fz41Gf for ; Tue, 4 Jul 2023 03:17:36 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso76320475e9.0 for ; Mon, 03 Jul 2023 20:17:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688440655; x=1691032655; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+a+jpg6oHKSPEJ/k4SPIFgqa28OxfWipfdEeVHRo3bE=; b=cNxPrUam5mGZO4IksGnHXrWJzbDBeCb488YeOn/Cp++nJkMp4dIeWBF3yOko106ZcF 6hSg4k8e81NNOvvqOWZd6l8HwoIIxCxz4N2dnMnNspOOmR8OSdhDruk42M9EXwxC38V+ NYob4G/HMS50HO0Mp7EWqdAYGJG45Ww3ArRQgpx6us1vJiPvmsXXoOJ+lFD/al36gNa8 pwD2makojekbxfYpEpV3AV3gRIn5pyeQ7jmtqvIVPCciXaY7BAUlBtztMtuY3qHc5FzJ p4JOI/cDZkn7bsAMd2VeVdMBl2yeguznZqch7VMb0f+PTcNG/ZlIp6xwUZ+wZFnw/f3x psMw== X-Gm-Message-State: AC+VfDxdlZmiPfkZrQmSs0+6Z1yeLqTpOkxWfLouGKNeyIYFqHiVe84y ANC4nEvBvuHu3b0MgSIbhESX7Q== X-Google-Smtp-Source: ACHHUZ7r2HPz3V6SunVv2X5Przp4vPcs7pq7O1c/nEWyvPpNHV6ZZoe3/h9GJOy05AJyW1JlKEfzGg== X-Received: by 2002:a1c:7914:0:b0:3fa:984d:7e94 with SMTP id l20-20020a1c7914000000b003fa984d7e94mr15997798wme.18.1688440655007; Mon, 03 Jul 2023 20:17:35 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id v4-20020a05600c214400b003fa95890484sm24049080wml.20.2023.07.03.20.17.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jul 2023 20:17:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: git: 4456846a1a0d - main - bin/date: Upgrade calculations From: Jessica Clarke In-Reply-To: Date: Tue, 4 Jul 2023 04:17:23 +0100 Cc: "Pedro F. Giffuni" , src-committers , "" , "" Content-Transfer-Encoding: quoted-printable Message-Id: <203AA4D5-CA21-4716-BF11-09DD20101538@freebsd.org> References: <202307040308.36438MTA093771@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3731.600.7) X-Rspamd-Queue-Id: 4Qw7Jc6Z4fz41Gf X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On 4 Jul 2023, at 04:11, Warner Losh wrote: >=20 > This is a nope on armv7 and i386. So it has no effect there. DF got it = wrong. These should likely be int64_t to avoid the overflow. No? Quite. Obviously DragonFly can ignore the issue because it=E2=80=99s amd64-only... but still a bit unnecessarily non-portable. Jess > On Mon, Jul 3, 2023, 9:08 PM Pedro F. Giffuni wrote: > The branch main has been updated by pfg: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D4456846a1a0d8cb6d0e6bae89f1134fa= 0a1af5cf >=20 > commit 4456846a1a0d8cb6d0e6bae89f1134fa0a1af5cf > Author: Pedro F. Giffuni > AuthorDate: 2023-07-03 02:32:10 +0000 > Commit: Pedro F. Giffuni > CommitDate: 2023-07-04 03:08:01 +0000 >=20 > bin/date: Upgrade calculations >=20 > Use long instead of int for numerous calculations, fixing a number = of > date calculation overflow issues. >=20 > Obtained from: DragonflyBSD > Git log: 4238ce6f0c6df33ce677ae298b245c62cd60fb43 (only = partial) > --- > bin/date/vary.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git a/bin/date/vary.c b/bin/date/vary.c > index 5f0123110ee3..6f3c59950ecf 100644 > --- a/bin/date/vary.c > +++ b/bin/date/vary.c > @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); > #include "vary.h" >=20 > struct trans { > - int val; > + long val; > const char *str; > }; >=20 > @@ -52,7 +52,7 @@ static struct trans trans_wday[] =3D { > }; >=20 > static char digits[] =3D "0123456789"; > -static int adjhour(struct tm *, char, int, int); > +static int adjhour(struct tm *, char, long, int); >=20 > static int > domktime(struct tm *t, char type) > @@ -125,7 +125,7 @@ daysinmonth(const struct tm *t) >=20 >=20 > static int > -adjyear(struct tm *t, char type, int val, int mk) > +adjyear(struct tm *t, char type, long val, int mk) > { > switch (type) { > case '+': > @@ -146,7 +146,7 @@ adjyear(struct tm *t, char type, int val, int mk) > } >=20 > static int > -adjmon(struct tm *t, char type, int val, int istext, int mk) > +adjmon(struct tm *t, char type, long val, int istext, int mk) > { > int lmdays; >=20 > @@ -206,7 +206,7 @@ adjmon(struct tm *t, char type, int val, int = istext, int mk) > } >=20 > static int > -adjday(struct tm *t, char type, int val, int mk) > +adjday(struct tm *t, char type, long val, int mk) > { > int lmdays; >=20 > @@ -250,7 +250,7 @@ adjday(struct tm *t, char type, int val, int mk) > } >=20 > static int > -adjwday(struct tm *t, char type, int val, int istext, int mk) > +adjwday(struct tm *t, char type, long val, int istext, int mk) > { > if (val < 0) > return 0; > @@ -286,7 +286,7 @@ adjwday(struct tm *t, char type, int val, int = istext, int mk) > } >=20 > static int > -adjhour(struct tm *t, char type, int val, int mk) > +adjhour(struct tm *t, char type, long val, int mk) > { > if (val < 0) > return 0; > @@ -331,7 +331,7 @@ adjhour(struct tm *t, char type, int val, int mk) > } >=20 > static int > -adjmin(struct tm *t, char type, int val, int mk) > +adjmin(struct tm *t, char type, long val, int mk) > { > if (val < 0) > return 0; > @@ -372,7 +372,7 @@ adjmin(struct tm *t, char type, int val, int mk) > } >=20 > static int > -adjsec(struct tm *t, char type, int val, int mk) > +adjsec(struct tm *t, char type, long val, int mk) > { > if (val < 0) > return 0; > @@ -419,7 +419,7 @@ vary_apply(const struct vary *v, struct tm *t) > char which; > char *arg; > size_t len; > - int val; > + long val; >=20 > for (; v; v =3D v->next) { > type =3D *v->arg;