From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 40F7015807A for ; Thu, 05 Jun 2025 11:22:20 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 22EBA34316A for ; Thu, 05 Jun 2025 11:22:20 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 604241103DD; Thu, 05 Jun 2025 11:22:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 bobolink.gentoo.org (Postfix) with ESMTPS id 590101103DD for ; Thu, 05 Jun 2025 11:22:15 +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 1ACE0343118 for ; Thu, 05 Jun 2025 11:22:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5E07228EC for ; Thu, 05 Jun 2025 11:22:13 +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: <1749122523.1bcf4cd40f5e4d40b3bb91e85f95e77c236412eb.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/isolated-functions.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 1bcf4cd40f5e4d40b3bb91e85f95e77c236412eb X-VCS-Branch: master Date: Thu, 05 Jun 2025 11:22:13 +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: a078189e-d6f7-415b-ad6d-dbc8dec5308d X-Archives-Hash: 82aaa7145516094379510240e5d7dac4 commit: 1bcf4cd40f5e4d40b3bb91e85f95e77c236412eb Author: Kerin Millar plushkava net> AuthorDate: Thu Aug 11 04:03:21 2022 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jun 5 11:22:03 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1bcf4cd4 isolated-functions.sh: don't pass comments to sed(1) in die() Presently, the die() function incrementally assembles a sed program by way of -e option-arguments that incorporate comments. Instead, have bash process the comments so that the sed arguments convey only the code. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/isolated-functions.sh | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 2cec30edfe..644795f811 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -180,21 +180,24 @@ die() { # This tends to be the most common usage though, so let's do it. # Due to the usage of appending to the hold space (even when empty), # we always end up with the first line being a blank (thus the 2nd sed). - sed -n \ - -e "# When we get to the line that failed, append it to the - # hold space, move the hold space to the pattern space, - # then print out the pattern space and quit immediately - ${BASH_LINENO[0]}{H;g;p;q}" \ - -e '# If this line ends with a line continuation, append it - # to the hold space - /\\$/H' \ - -e '# If this line does not end with a line continuation, - # erase the line and set the hold buffer to it (thus - # erasing the hold buffer in the process) - /[^\]$/{s:^.*$::;h}' \ - "${BASH_SOURCE[1]}" \ - | sed -e '1d' -e 's:^:RETAIN-LEADING-SPACE:' \ - | while read -r n ; do eerror " ${n#RETAIN-LEADING-SPACE}" ; done + local -a sed_args=( + # When we get to the line that failed, append it to the hold + # space, move the hold space to the pattern space, then print + # out the pattern space and quit immediately. + -n -e "${BASH_LINENO[0]}{H;g;p;q}" + # If this line ends with a line continuation, append it to the + # hold space. + -e '/\\$/H' + # If this line does not end with a line continuation, erase the + # line and set the hold buffer to it (thus erasing the hold + # buffer in the process). + -e '/[^\]$/{s:^.*$::;h}' + ) + sed "${sed_args[@]}" "${BASH_SOURCE[1]}" \ + | sed -e '1d' -e 's:^:RETAIN-LEADING-SPACE:' \ + | while read -r n; do + eerror " ${n#RETAIN-LEADING-SPACE}" + done eerror fi eerror "If you need support, post the output of \`emerge --info '=${CATEGORY}/${PF}::${PORTAGE_REPO_NAME}'\`,"