From nobody Fri Jul 14 05:29:00 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R2Klc5mNDz4nFbn; Fri, 14 Jul 2023 05:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R2Klc55Y3z4GPK; Fri, 14 Jul 2023 05:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689312540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2y97psixSMPU3dCfqRU8j7B+1eXOkzYi2cjrsk22xi4=; b=IqQDvZ8tlx+6jkLkpHLb490SVL8fQelVYK19EosLDrBYK9F4xs+/543c2HYo61lJqpAVC3 sG9+/jkCe0ylywsV1kBFevdCaNAtDO0dYoeurMZCky6AFJmJJpZ1NdDKK7CLu2W3xQzEhU gi6VkKiSxzK6QQmBAv2tVrWZC430YGpsIz+zoEK1EsZJNGhNIojB/voApjbZRSQgLmd6Rq uOCBh+3RFLwCCzKgVTW5n9QVMllrWzjUyp7oEM35WOn7RttzdTPD+9rcI2IluElTjHVlPQ vNblrf/xYzXM7ZLjHGq32FN6Z+WCXt9kbpBTY9uhd197CRrlSjt0Z5uDXgavpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689312540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2y97psixSMPU3dCfqRU8j7B+1eXOkzYi2cjrsk22xi4=; b=NduaBo4Ex51/Fzw76EWmYPC3c9NovMjOngofhp8jTvxEHwgQCIBVolLwWmhKsORWQ/pgfF SU1pYshjN0Ex1zEjg5gHy7cQnPbyQ7mVjXsUn2VtnLT540UaBn+/sp01yt0umrx6fcSQto DPqb6XTdUZsh6KP/+L4WULDdP/8a3bmDpsIjZyAehP1Xm83Gk+7VelUUubdbjxdfn8Qy+f e4d/AMZbQQ74YX88Q3131xylFryhV50bIM5kMSiZme/ZepMU/i7qz+KBVghd4hp1ZfoWz0 YVlvTNR4hVpEKeUQGM30xXTKjJq9drZD38Lu1QVgaF9uqIKoD+kCqjS5cF8QIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689312540; a=rsa-sha256; cv=none; b=aEJXxlJqXqjFx4up3wi9NvfQN7S6bz5hvV1fJC88aTtzqogga22W3HdwiYbsgmtmF7fv7L jqympj5quwTCBAilrcJ66YWWIhc1dP3McanePe7KxEAOVNEkJkTQdzXmrYEOMWps3+qC3i tTWA+i7qCY8NJ9gpS37KAEItNx8T/+bub4BP56KIz2jR8TOne8MFRQIifIV7Z8zKDaU9ni 2o3fQ58Yqg1JgeojjI9/KO0YmReJAfCZmv1D+JVAjEBe2MD7XuMjmy4qm+7rymwaLj9xJo Xw0HrTTsEsANyigRGadJFAaGqfI7fieJwSqFKfRVMSnAfEdtZ9CV167r/3l/Pg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R2Klc45s3z1Krc; Fri, 14 Jul 2023 05:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36E5T00n002037; Fri, 14 Jul 2023 05:29:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36E5T0EM002036; Fri, 14 Jul 2023 05:29:00 GMT (envelope-from git) Date: Fri, 14 Jul 2023 05:29:00 GMT Message-Id: <202307140529.36E5T0EM002036@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 5d4f8df451aa - main - Makefile.libcompat: Make quoting for CC/CXX/CPP more future-proof List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d4f8df451aa942701ecfced80516f3584b589d9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=5d4f8df451aa942701ecfced80516f3584b589d9 commit 5d4f8df451aa942701ecfced80516f3584b589d9 Author: Jessica Clarke AuthorDate: 2023-07-14 04:34:03 +0000 Commit: Jessica Clarke CommitDate: 2023-07-14 04:34:03 +0000 Makefile.libcompat: Make quoting for CC/CXX/CPP more future-proof bmake's :Q is for quoting outside of double quotes, but here is inside double quotes, and as a result it ends up quoting characters that don't have a special meaning inside double quotes. On the surface this would seem harmless, but POSIX sh has a strange behaviour (differing from outside double quotes) that, inside double quotes, a backslash before a character that never has a special meaning inside double quotes is passed through. As a result, should LIB${_LIBCOMPAT}CFLAGS contain something like -DFOO\(x\)=x, we would form "... -DFOO\\\(x\\\)=x ...", which would be parsed as -DFOO\\(x\\)=x, since the parentheses are never special inside double quotes (but the backslash itself is), not the original -DFOO\(x\)=x as intended. Instead, construct the whole string as a bmake expression and use :Q on that, without the manual double quotes around everything. Note that the :L modifier lets you treat an expression like a variable expansion and apply modifiers to it, i.e. ${expr:L:...} is the same as tmp=expr ${tmp:...} (in essence, ignoring possible differences due to deferred substitution). Improves: 537f945fc89f ("Makefile.libcompat: Quote CFLAGS and CXXFLAGS for sub-make") --- Makefile.libcompat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.libcompat b/Makefile.libcompat index e8d33b905559..b21e27105e99 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -25,9 +25,9 @@ LIB${_LIBCOMPAT}WMAKEENV+= \ # Don't rebuild build-tools targets during normal build. LIB${_LIBCOMPAT}WMAKEENV+= BUILD_TOOLS_META=.NOMETA .endif -LIB${_LIBCOMPAT}WMAKEFLAGS+= CC="${XCC} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \ - CXX="${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS:@v@${v:Q}@} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \ - CPP="${XCPP} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \ +LIB${_LIBCOMPAT}WMAKEFLAGS+= CC=${${XCC} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \ + CXX=${${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \ + CPP=${${XCPP} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \ DESTDIR=${WORLDTMP} \ -DNO_CPU_CFLAGS \ MK_BOOT=no \