From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D39631581C1 for ; Mon, 8 Jul 2024 03:00:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 108412BC015; Mon, 8 Jul 2024 03:00:28 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DF58C2BC015 for ; Mon, 8 Jul 2024 03:00:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7511A340C7B for ; Mon, 8 Jul 2024 03:00:26 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 86F2C1DBA for ; Mon, 8 Jul 2024 03:00:24 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1720407379.51fbbf3b0b8dcb7435cfedf91a3d5ef0e94f7912.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 51fbbf3b0b8dcb7435cfedf91a3d5ef0e94f7912 X-VCS-Branch: master Date: Mon, 8 Jul 2024 03:00:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e7700a51-b4b4-4161-8670-a6bcf856fff9 X-Archives-Hash: e495301d5a8294ba83dd9a9db8cec67e commit: 51fbbf3b0b8dcb7435cfedf91a3d5ef0e94f7912 Author: Kerin Millar plushkava net> AuthorDate: Mon Jul 8 02:56:19 2024 +0000 Commit: Sam James gentoo org> CommitDate: Mon Jul 8 02:56:19 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=51fbbf3b Render _contains_all() compatible with mawk The mawk implementation does not react well to FS containing an invalid ERE at any juncture. Address the issue by composing the pattern in full before assigning it to FS. Signed-off-by: Kerin Millar plushkava.net> functions.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/functions.sh b/functions.sh index 1295a2b..82f59a3 100644 --- a/functions.sh +++ b/functions.sh @@ -77,21 +77,20 @@ contains_all() if (length(ifs) == 0) { FS = "^" } else { - whitespace = "" - FS = "(" + fs = "(" for (i = 1; i <= length(ifs); i++) { char = substr(ifs, i, 1) if (seen[char]++) { continue } else if (char ~ /[ \t\n]/) { whitespace = whitespace char - FS = FS "[" char "]+|" + fs = fs "[" char "]+|" } else { - FS = FS "[" char "]|" + fs = fs "[" char "]|" } } - sub(/\|$/, "", FS) - FS = FS ")" + sub(/\|$/, "", fs) + FS = fs = fs ")" } # Leading whitespace characters must be removed. if (length(whitespace) > 0) {