From owner-dev-commits-src-main@freebsd.org Thu Jul 22 02:04:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AD12A650A66; Thu, 22 Jul 2021 02:04:23 +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 4GVbNl4BKzz4rts; Thu, 22 Jul 2021 02:04:23 +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 78005128B; Thu, 22 Jul 2021 02:04:23 +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 16M24NbO072871; Thu, 22 Jul 2021 02:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16M24NS1072870; Thu, 22 Jul 2021 02:04:23 GMT (envelope-from git) Date: Thu, 22 Jul 2021 02:04:23 GMT Message-Id: <202107220204.16M24NS1072870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: acf9cf323f8d - main - awk: Issue a warning for old hex behavior. 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/main X-Git-Reftype: branch X-Git-Commit: acf9cf323f8d0c844ea4a0fedeb596871794a078 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2021 02:04:23 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=acf9cf323f8d0c844ea4a0fedeb596871794a078 commit acf9cf323f8d0c844ea4a0fedeb596871794a078 Author: Warner Losh AuthorDate: 2021-07-20 04:39:26 +0000 Commit: Warner Losh CommitDate: 2021-07-22 02:03:35 +0000 awk: Issue a warning for old hex behavior. Since FreeBSD has allowed "0x" hex strings to be converted to integers for a long time, and since upstream has killed that behavior, warn about this issue. This will allow us to deprecate this behavior for 14.0 while giving our users of 12.x and 13.x fair warning. Sponsored by: Netflix --- contrib/one-true-awk/lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 6bfe5e8eaad9..c2da07a7ba62 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -798,11 +798,16 @@ bool is_valid_number(const char *s, bool trailing_stuff_ok, * 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. + * the prior FreeBSD behavior, but warning that it differs. */ -#if 0 // no hex floating point, sorry if (s[0] == '0' && tolower(s[1]) == 'x') +#ifdef __FreeBSD__ + { static int warned = 0; /* Only warn the first time */ + if (warned++ == 0) + WARNING("Script depends on old '0x' hex conversion behavior"); + } +#else return false; #endif