From patchwork Tue Jul 26 15:20:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 593457 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b811:0:0:0:0 with SMTP id fc17csp3652785mab; Tue, 26 Jul 2022 08:35:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uo3mIqZN5KziOycf/En2I6z1q/A6BZpV+veoIYWWXlpUKBEkSw2KcYdEVtrX1+UDUsLrF4 X-Received: by 2002:a05:622a:346:b0:31f:c40:eac0 with SMTP id r6-20020a05622a034600b0031f0c40eac0mr14716873qtw.326.1658849754538; Tue, 26 Jul 2022 08:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658849754; cv=none; d=google.com; s=arc-20160816; b=JKtwbuu1ed3gTnNUJ26jQjwcbTR0OOypSdUHdnyRLpqNzKIOVbLqtcBtR0cHsYBhg4 teBon8jl0L0OqGzzGuSF35pQljG1TP2zlPf0MmtVL71cv71uRqOHhvPad9rk0lx/a6+u TILLLeuv7gLwNoc71vg1QuliHM9B1+FxSnar9G9+5JUHEUTpj2LejZWQDHQd8qAR5GZS +0TaBJiP0xvEex+3VgdeufahgPnwSkFVoHRQjFDmWZBV0/Rsln+6XWyUMOPaAIwthoIn Uc3vchqDNXYbPByLILboyD1r1BoRcE661b/5nVtIFZVzpF85DbC9MfAJ/OJS/ylSUCcy PWMA== 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:to:from :dkim-signature; bh=J0a1TUw/2CURKscI5PXWjufgRvMWjB7jxGP1SOJi5DA=; b=AaFmB2p70h967K/37Eqzwgx0FOmBvnxgZZWkGrfu3M4CD99QKw+pDbeX2hB0Wh58gR 7o1bCDpGrBifGw04w744Ptg8EU50yq9v/5WkRLH2oqDG5dfYm6PmPIkoCElFtJXZsGRh ACaLiDAl65kAAGsb9x/wJAbRfc4nGhHR++OauUeKWOiPFYd+HnwB/OQJUsnBI3KQB72Z SfxsCSmouq0sLs69cgsD2cnMMyi2Kq0D2n4UACNvmX+inHCTmxQJa/WT8B1FZWYvBnTP xGDMH0gpkXUgjpygR2F9VwZ7F6QPJi9tq/DHkYfP3f3D7harrWjRHFZ1rhbBO+wh30e0 GM2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kh2gwuaq; 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 ff10-20020a05622a4d8a00b0031f386cd81asi3266652qtb.328.2022.07.26.08.35.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jul 2022 08:35:54 -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=kh2gwuaq; 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]:33378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGMbC-0007zX-2U for patch@linaro.org; Tue, 26 Jul 2022 11:35:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGMMI-0006SY-47 for qemu-devel@nongnu.org; Tue, 26 Jul 2022 11:20:30 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:41482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGMMA-000638-MV for qemu-devel@nongnu.org; Tue, 26 Jul 2022 11:20:28 -0400 Received: by mail-wm1-x32a.google.com with SMTP id x23-20020a05600c179700b003a30e3e7989so8382367wmo.0 for ; Tue, 26 Jul 2022 08:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=J0a1TUw/2CURKscI5PXWjufgRvMWjB7jxGP1SOJi5DA=; b=kh2gwuaq4JLh1UtwejwEMiph+xjIKqDHxFqBox++bhgmq0MSXdEB86mQVBStVxi5cP g4XnFQfslrbLR2Hwi8i2BXBf35NvX9LcDYCdVupzv2x1pzDb4tiagdqywQsXLBBR+I60 FzClmtWAlUZpKXtBPtYxKsGMhgiy4IZlYZw2gysJYj7zDDvDMIqSBzm50U0UM+43mZBX H2Kyt5X+/DxlGnloZ0P/D06AImmdE82l0yoCNmfNRVTQyqm0GKBoK5hs3ma5EgT9jfTK AEjbFro9iiyxeNGUcLruWDniTlkHFESs/BMqlPXNudtfbiwXhWbv6lcPInh83fF6P3Jb svLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J0a1TUw/2CURKscI5PXWjufgRvMWjB7jxGP1SOJi5DA=; b=j/7MHnY/xK5FPFSLoEyitifBaR01xpzJnZUoevD3S/Kbc5uKvMu7bozB67EUi0/IHC JNmJB1vH9VQE1yWnxTvwIg4FVP0N+ofLOxNjdHURhCV9TLu0qG3QRLjuuNCNZXQ58f+i jDnXNheOff7Qj798VVzKyMYEFq/45ncAYhJC47HGSlQvavPm0o9PPisitykYSGhZGVHV sAOjHZx+gzGQC9c7DvGkVw852tIb4HycrVVvi7DgNzIN3o5hb/EYvCpGX4X2aAEmJrT8 V/blSuPT5Dx3+jo9/sER9myQ9rClAh8NTojFB6N03Pp5YTKEXQNwfLsSQTO0dkvw/MY9 g1zg== X-Gm-Message-State: AJIora+/IB/HyeeFzdhMyIS58F66ERKz8QSEY3gbloVlEU/dRNg82zrI MENPazqegFkEWUz/rqDLLsG/y8x1SBI6Hg== X-Received: by 2002:a05:600c:4e4d:b0:3a3:1fe6:6b20 with SMTP id e13-20020a05600c4e4d00b003a31fe66b20mr12679805wmq.197.1658848821268; Tue, 26 Jul 2022 08:20:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id n5-20020a1c2705000000b003a1980d55c4sm21932739wmn.47.2022.07.26.08.20.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 08:20:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 6/9] configure: Don't use bash-specific string-replacement syntax Date: Tue, 26 Jul 2022 16:20:09 +0100 Message-Id: <20220726152012.1631158-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220726152012.1631158-1-peter.maydell@linaro.org> References: <20220726152012.1631158-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 Message-id: 20220720152631.450903-4-peter.maydell@linaro.org --- 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' }