From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 1A4CA3858031 for ; Wed, 9 Mar 2022 09:10:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A4CA3858031 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 65C6F342FE3; Wed, 9 Mar 2022 09:10:11 +0000 (UTC) Date: Wed, 9 Mar 2022 04:10:17 -0500 From: Mike Frysinger To: Sebastian Huber , newlib@sourceware.org Subject: Re: [PATCH] build: Avoid length() GNU awk extension Message-ID: Mail-Followup-To: Sebastian Huber , newlib@sourceware.org References: <20220309073105.129187-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0aNjOrfI72k9re9T" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2022 09:10:13 -0000 --0aNjOrfI72k9re9T Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 09 Mar 2022 03:54, Mike Frysinger wrote: > On 09 Mar 2022 08:31, Sebastian Huber wrote: > > Other awk implementations such as mawk do not support the length() func= tion. >=20 > those awk implementations are not POSIX compliant. length() is > *not* a GNU extension. you can see it clearly defined in POSIX: > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_2= 0_06_13_13 sorry, i quoted length() as used to count bytes in a string, not elements in an array. POSIX doesn't support that. i would still argue that, while gawk supports it, it isn't a GNU extension. bwk supported it back in 2002, and gawk didn't implement it until ~2005. > that said, mawk does support length(), and has since at least 2008 in > the 1.3.3 release. i stopped looking back further in the history. the original mawk has been dead for over a decade. i hope you're not trying to use such vintage tools. Thomas E. Dickey picked up maintenance and has produced a series of fixes & improvements, and every distro i'm aware of is using his fork. https://invisible-island.net/mawk/ i mention this because he implemented length() to count array elements back in 2012. so if you still haven't updated to a version that supports that, you should really get on top of that. all that said, the patch you propose is a simple alternative that is POSIX compliant, so i'm fine with it too. -mike --0aNjOrfI72k9re9T Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmIobvkACgkQQWM7n+g3 9YFlEA//YmfhdBTrEDafMiFviEKUAXZ6Q9K5EWesSUSUGR3n4jLoKXTXcQbTcSZG IJp7Pbq/JY7G/hG9PrUUHh7oue440zKK2M+P6Lbsq383z/p32kTht8COuM/OLFha B0p3/ZRdaLJSBQPuxuSb19+pNju/J/GmnL/63hhKKzttocm5FBBsaEtX9PMxvF+8 7D7oCD0ooz9tuTaESdWbyD0oDg57ywpikKa+tGgN0P9GIolIZBfgjlINUDTze2hA +FuLQjzbdzaXF9EAZYLhdvYvBcgjZ5S+xqOATGEki3Ot7MYMZ0CK4b9NgNazNrOw oUzdp3/TPeBXGTmh0Bw0qmaVKKiUzX0olwcCiEerDsm+0dHCrVlV4HtmyxmdCsyY pRRp/jWjM1bvD9R3J26Yj25RS3VqOYSY9BnnewfVURmjL3XCfIkLO8UQlB7h8uSh rnPrDpLNgYRRHDPBr1V2APrlXqnqst9GzAOfAz49BrgkP6JOamvBAuuI/G6VpYdv 9OhiGQcdWIqhxWOw1yu54VEui5sPVV2z5vWNkM+cUZZGn+7sH5u9c75Mz8jz7AAT xajex9uYT7LSy9WxGzU0f/UGUe7uQruvx6pOLSmnAkvm8zE1+i8mPnTMInvOQnv/ KIMyjDS/E6DLNa7qmYo8yEpy2mvukoVXtT09T7GHhEfa2mJN7J8= =XF4L -----END PGP SIGNATURE----- --0aNjOrfI72k9re9T--