From owner-dev-commits-src-main@freebsd.org Sat Jul 31 05:43:19 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 CA3EE65648B; Sat, 31 Jul 2021 05:43:19 +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 4GcCqC549wz3DRH; Sat, 31 Jul 2021 05:43:19 +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 8FDF013379; Sat, 31 Jul 2021 05:43:19 +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 16V5hJdt079286; Sat, 31 Jul 2021 05:43:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16V5hJki079285; Sat, 31 Jul 2021 05:43:19 GMT (envelope-from git) Date: Sat, 31 Jul 2021 05:43:19 GMT Message-Id: <202107310543.16V5hJki079285@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: f7f76c200a8c - main - awk: Document deprecated behavior of hex constants and locales. 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: f7f76c200a8c33822a25ae36e4399c9896efa951 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: Sat, 31 Jul 2021 05:43:19 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f7f76c200a8c33822a25ae36e4399c9896efa951 commit f7f76c200a8c33822a25ae36e4399c9896efa951 Author: Warner Losh AuthorDate: 2021-07-31 05:31:00 +0000 Commit: Warner Losh CommitDate: 2021-07-31 05:41:39 +0000 awk: Document deprecated behavior of hex constants and locales. FreeBSD will convert "0x12" from hex and print it as 18. Other awks will convert it to 0. This extension has been removed upstream, and will be removed in FreeBSD 14.0. FreeBSD used to set the locale on startup, and make the ranges use that locale. This lead to weird results like "[A-Z]" matching lower case characters in some locales. This bug has been fixed. MFC After: 3 days Sponsored by: Netflix --- usr.bin/awk/awk.1 | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/usr.bin/awk/awk.1 b/usr.bin/awk/awk.1 index 20bb510a1516..35d5e8d9d29b 100644 --- a/usr.bin/awk/awk.1 +++ b/usr.bin/awk/awk.1 @@ -814,9 +814,44 @@ The scope rules for variables in functions are a botch; the syntax is worse. .Sh DEPRECATED BEHAVIOR One True Awk has accpeted -.Fl Ft +.Fl F Ar t to mean the same as -.Fl F\t +.Fl F Ar to make it easier to specify tabs as the separator character. Upstream One True Awk has deprecated this wart in the name of better compatibility with other awk implementations like gawk and mawk. +.Pp +Historically, +.Nm +did not accept +.Dq 0x +as a hex string. +However, since One True Awk used strtod to convert strings to floats, and since +.Dq 0x12 +is a valid hexadecimal representation of a floating point number, +On +.Fx , +.Nm +has accepted this notation as an extension since One True Awk was imported in +.Fx 5.0 . +Upstream One True Awk has restored the historical behavior for better +compatibility between the different awk implementations. +Both gawk and mawk already behave similarly. +Starting with +.Fx 14.0 +.Nm +will no longer accept this extension. +.Pp +The +.Fx +.Nm +sets the locale for many years to match the environment it was running in. +This lead to pattern ranges, like +.Dq "[A-Z]" +sometimes matching lower case characters in some locales. +This misbehavior was never in upstream One True Awk and has been removed as a +bug in +.Fx 12.3 , +.Fx 13.1 , +and +.Fx 14.0 .