From patchwork Wed Jul 20 15:26:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 591871 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5817:0:0:0:0 with SMTP id j23csp5062476max; Wed, 20 Jul 2022 08:31:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1slzxcJnoJO9VMq2ljtXfhJ135nFIX1+GvRAgYBtoA3MllRPFGobpg2TJt75xyVjNlnN6nF X-Received: by 2002:ac8:5fca:0:b0:31e:b661:7ae4 with SMTP id k10-20020ac85fca000000b0031eb6617ae4mr30091057qta.585.1658331085363; Wed, 20 Jul 2022 08:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658331085; cv=none; d=google.com; s=arc-20160816; b=kk8WdWC6pTSc50Unxuj5FVJuhGCmzjbNpIBI1QWDbg6Ruv3+cQPomkJEJZRUA/CMRT HMrAHNeyHb3OLNpEO+X+d3QbZhV4iIkw8YVzgw/LSoURRdY/Q3X9/pKgfFHhbDT/8Vgv GWMq8mIB+6Q/dsMAH31ocmpNLEiy7bg85gDbqCMgld8A7/HyxfNwwz/kL/q8wJReTBNV 4aJqcxcNcigqR4QuaYjDG7qs+HcetoirnZP5MGFi3OX3D26wzpQFWME3tbqC5Boy0/vS 1xj75V2qQmWdrD43ehkDkOX6hzRdILSq5+FQoFoS9pg+p8e4Zusb3ukGZxizw3HgzhC/ l/Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RnUi10H2zETr3PzFE8ItmqNkeEXhjlZHbA93aIrcRAo=; b=qwnXxQSZ39uMWoeRMxc9A0spfBJytZbdfVoKKZMRs4i8h9cuk74g5UUmLXyIm+rRtK s23nPcYagSVbSOXPO89YKw2ayqTvHrmacjiY2qMgZD/M27EvACpXqQ32sGI4+7ihlzwa XOrpIc6zkJTXV+cpV6R5Jy1NhcmrJi76FlQ5WlP6DEAtmCJAM/LcW2X18uSVqh5mvtdB 4YpyrvIqgasSo/TCB2wsodTPsD7k0Vbv3ik2Ked0wYgLyM7nH8dsNzWKfCh8PDMLlvWq znORxJr93sgUM38gNxnnvErUiJmjQGQuxQ/DAujLet6D1Q31jeTDaD90pp+0Gt38m7xM brhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=buCbvTCA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bq30-20020a05620a469e00b006b14fa18a1bsi3149077qkb.540.2022.07.20.08.31.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jul 2022 08:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=buCbvTCA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEBfY-0007Bz-Uq for patch@linaro.org; Wed, 20 Jul 2022 11:31:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEBax-0002Op-Bx for qemu-devel@nongnu.org; Wed, 20 Jul 2022 11:26:39 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oEBav-0005C4-MF for qemu-devel@nongnu.org; Wed, 20 Jul 2022 11:26:38 -0400 Received: by mail-wr1-x434.google.com with SMTP id e15so21376370wro.5 for ; Wed, 20 Jul 2022 08:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RnUi10H2zETr3PzFE8ItmqNkeEXhjlZHbA93aIrcRAo=; b=buCbvTCAAaAlaZ9ed247zTejvVgpevlNDasn+Hl3z+XqLYQ2abTu7Yq76RdPACiuW3 Ctoq4fgDZ51uJIXRaT2uXqr3jMdAPzDNKh1uTldCEY41ptgJKw0g2PPgMQRcSXEb/3WG 9nqStl/pJxa9LpGkzAbecS9vZGBCBnIuVylGxZxKwy6p/h2Nmd1x/Ky4klBZOq0YI8Bt LA/j2osVOrN8MaeQ6Q3vE09iRjV81NJab1Hdf9Yi0ifVFpdJhojuDuZFApPg2rpg8Ob8 /VX39HfzVZxfVv+LBALD1wDS25oYs77bQ7lbvfFiIwv1bWLryyyBL5WHx76JmDsgyoZV C/Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RnUi10H2zETr3PzFE8ItmqNkeEXhjlZHbA93aIrcRAo=; b=2WaG3vybOafsETxLkMD6XL4+mNnUREAeB1VZqBcCMPVx1mm1WBQdZwrYbk7hW1xjzP DLwoBA52jY0cioMLdJwJ+WhenWcvBoEJ1R7BvHGk8EZfqlCbgoX8ZJdBB+w/7RJegF7O Wu1k2HIdnN79QCHiqXnsoYwjAYwGAOO8d6ZryORWCJ0ddsnYncnSgMTO50hamNN8nG+G gWah1jDUhQHwEouur9DC/Xe5nEsjWVm3ZGMq1EWxh5FsjYYlCi/ltAGLG7oZJLRtJueZ cQeWrCl1+cPtmgvGisFqMjcSGCWzSXbLepyc/Sf8auaxjWPaeBowc6/ymcUy32or6xAo o3IQ== X-Gm-Message-State: AJIora9JOiFgHcHdKJhTlmsC+IDtH2dZEzHp7y29yaq2pe9BE4Rv9Oxb 41EhM4F7IRDM/86Jw6llx4AYaDrcATyuHw== X-Received: by 2002:a05:6000:2ab:b0:21e:2e68:52f4 with SMTP id l11-20020a05600002ab00b0021e2e6852f4mr7262267wry.236.1658330796445; Wed, 20 Jul 2022 08:26:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id r10-20020a056000014a00b0021d68a504cbsm16395987wrx.94.2022.07.20.08.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:26:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Paolo Bonzini , "Dr. David Alan Gilbert" , Thomas Huth , Richard Henderson Subject: [PATCH 3/5] configure: Don't use bash-specific string-replacement syntax Date: Wed, 20 Jul 2022 16:26:29 +0100 Message-Id: <20220720152631.450903-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720152631.450903-1-peter.maydell@linaro.org> References: <20220720152631.450903-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The variable string-replacement syntax ${var/old/new} is a bashism (though it is also supported by some other shells), and for instance does not work with the NetBSD /bin/sh, which complains: ../src/configure: 687: Syntax error: Bad substitution Replace it with a more portable sed-based approach, similar to what we already do in quote_sh(). Note that shellcheck also diagnoses this: In ./configure line 687: e=${e/'\'/'\\'} ^-----------^ SC2039: In POSIX sh, string replacement is undefined. ^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'. ^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'. In ./configure line 688: e=${e/\"/'\"'} ^----------^ SC2039: In POSIX sh, string replacement is undefined. Fixes: 8154f5e64b0cf ("meson: Prefix each element of firmware path") Signed-off-by: Peter Maydell Tested-by: Thomas Huth --- configure | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index a56c3d921be..c05205b6085 100755 --- a/configure +++ b/configure @@ -684,9 +684,10 @@ meson_option_build_array() { IFS=: fi for e in $1; do - e=${e/'\'/'\\'} - e=${e/\"/'\"'} - printf '"""%s""",' "$e" + printf '"""' + # backslash escape any '\' and '"' characters + printf "%s" "$e" | sed -e 's/\([\"]\)/\\\1/g' + printf '""",' done) printf ']\n' }