From owner-dev-commits-src-branches@freebsd.org Thu Jul 15 23:28:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF834653410; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@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 4GQrCj4JXWz4rns; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 70DAB12AE1; Thu, 15 Jul 2021 23:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FNSX7C014206; Thu, 15 Jul 2021 23:28:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FNSXGh014205; Thu, 15 Jul 2021 23:28:33 GMT (envelope-from git) Date: Thu, 15 Jul 2021 23:28:33 GMT Message-Id: <202107152328.16FNSXGh014205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 40a925385fa6 - stable/12 - awk: revert upstream's attempt to disallow hex strings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 40a925385fa6b7c1a177880e36aa0fc278043e49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 23:28:33 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=40a925385fa6b7c1a177880e36aa0fc278043e49 commit 40a925385fa6b7c1a177880e36aa0fc278043e49 Author: Warner Losh AuthorDate: 2021-07-15 22:46:06 +0000 Commit: Warner Losh CommitDate: 2021-07-15 23:27:57 +0000 awk: revert upstream's attempt to disallow hex strings Upstream one-true-awk decided to disallow hex strings as numbers. This is in line with awk's behavior prior to C99, and allowed by the POSIX standard. The standard, however, allows them to be treated as numbers because that's what the standard said in the 2001 through 2004 editions. Since 2001, the nawk in FreeBSD has treated them as numbers, so restore that behavior, allowed by the standard. A number of scripts in the FreeBSD tree depend on this interpretation, including scripts to build the kernel which had mysteriously started failing for some people and not others. By re-allowing 0x hex numbers, this fixes those scripts and restores POLA. Upstream issue: https://github.com/onetrueawk/awk/issues/126 Sponsored by: Netflix Reviewed by: kevans MFC After: asap due to regression alrady merged to stable Differential Revision: https://reviews.freebsd.org/D31199 (cherry picked from commit d4d252c49976de33d0a2926df733744d0b8d95fa) --- contrib/one-true-awk/lib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 18adbd2d1fd6..6bfe5e8eaad9 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -793,9 +793,18 @@ bool is_valid_number(const char *s, bool trailing_stuff_ok, while (isspace(*s)) s++; +/* + * This test, while allowed by newer POSIX standards, represents a regression + * where hex strings were treated as numbers in nawk the whole time it has been + * in FreeBSD (since 2001). The POSIX 2001 through 2004 standards mandated this + * behavior and the current standard allows it. Deviate from upstream by restoring + * the prior FreeBSD behavior. + */ +#if 0 // no hex floating point, sorry if (s[0] == '0' && tolower(s[1]) == 'x') return false; +#endif // allow +nan, -nan, +inf, -inf, any other letter, no if (s[0] == '+' || s[0] == '-') {