From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148403; b=WR3Fkn3L7JgdhdK6sQN7f6CZgKcGdKdJpWlKdNgk6HCDJ/kcBrJ99z67pDHOleKPQqAy ybBmJ+0EaIpbO8/2nmCHwimQb/+gvmANvQWAm0rAj0bmQy6gthknimBYv9BAVbcl+eR27 Meh8zgP/36AiGZtBxPG+bbka7HcjiuTB+83rClOz9u9o6gNokbxuwjdDAQ+qpHrPZRhdX 2sLKIePtJj9Negs2tFeBWBDxlF9qg3PFyoZBrSgMt4TBoVmKx8pcsybkkb2307pntjV1h CIKZwN2OAtomZqgWawf0IKxhyhX6RLYGJjqcgyjGgENNl5yvnJi1DqOXCByRY2H5Xpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796148403; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Sender:Message-ID:Date: MIME-Version:User-Agent:From:Subject:To:Cc:References: Content-Language:In-Reply-To:Content-Type; bh=TZMqX4xA5BlQ4z2F6lfpqzQo37ZA5iFLHylp9nQDIgg=; b=PSiahDZ4ufdFlwYKYsAj14xyYih1tTD0CuoLnrWYQt8A73FsHTJahIICtuY5kQpVj1Ed 6cgJmkjYWFaF54YSW8DJkYKz8MFGVD4JzK/YNB08JM0pro+U6YxDZoxU3G4P8AxRqVBa6 qub4k9war/qRFyfWSXEtp3wGA2ihY/Nt+Ab1vRGiZOkkck6icrn0g1CNOHO0FgVGb0c1k tF/Bie0tqdwouMu2XFbf9gbmb6Cy8R/B8ET3fU2G9zdmGEqf6r2hpWGODhTnZ6l+m2ggO 0+k8c6LCiOE0jObiiFzDpEfMcJHT02TMglv7bMR0mRXzVpcWdymN+HemrxLqxC3IZ+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wFCmlaIZ; arc=none smtp.remote-ip=209.85.128.51 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0DC8606A31A for ; Tue, 1 Dec 2026 18:06:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D0DC8606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=wFCmlaIZ Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4bb6adaf0f1so102487225e9.0 for ; Tue, 01 Dec 2026 10:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796148401; x=1796753201; darn=vger.kernel.org; h=content-type:in-reply-to:content-language:references:cc:to:subject :from:user-agent:mime-version:date:message-id:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=TZMqX4xA5BlQ4z2F6lfpqzQo37ZA5iFLHylp9nQDIgg=; b=wFCmlaIZoXtHVBjXRQWn255ubhdtUgiOdyVC03EpwVrXS3bNnipL8fD/kiN2XA3yjt RmMNsQoSORpfycvc6N2ZchEX2b+TNoNPgdr20LdAA5uF7RZvtjYZezez7NxCCiOhus4Q UlObkAtXgXLjILk/BztaUFA5fvNyMyTn1TotjSVpByL7b6GBb3TV41Mvfd+BpmHF/BRA QSo0GQnWjedx31hmm+eDIjPeVcWJ0nqTbk4ehNA5rF09+Er5rBu3xXZe5H021nVxu8NK RHCxiqZCL8m8lIN5XS+8oKFMATbkzBPQGLnlvkOlkjhXqDloV9yvzG2EUTTnRmzxPP49 g1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796148401; x=1796753201; h=content-type:in-reply-to:content-language:references:cc:to:subject :from:user-agent:mime-version:date:message-id:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TZMqX4xA5BlQ4z2F6lfpqzQo37ZA5iFLHylp9nQDIgg=; b=fLLap2hb39iQO3l9Yp97sEH4l9Zj6ru8XAbQrONNz3JIC2POpwL0ziZch5wDZ4KA8L k/F5KAgHUlXdVX2GHzyJDsHFh/id2Cf9AKFGF7FK9TvPC50qlt5tA4KwQU64OPEMGfel iuhRLl3tYliXuMcEPDB0OHYUd+YzmkfftHbnNhHsUa21XlezQv0c0zjMP1ulU3k8eNVw TEXizD0VuQ0Gx+43pg+yVJRlbYyhoS7D+S8mhD9gpklHtf7O1YBhmyiHeiAXCqNVCrnx RmL6pPu9Nkejo6fC0qPr4qoaxS4eJlIhED/FvRDGa6XrIT3XY7zFMbTjdEs+MDDRz+ct HOFQ== X-Gm-Message-State: APuU4Z9xsFKR1vn34kjVC/JwK6M+YQlyRBmoEIc6AMaQISuUcnvSHSmZ VaGQ3nYb8T7Pur4O3yNpyOxk61f9w0c9yCDtX+cRu3GuP/LS1zOAq0g3 X-Gm-Gg: AZFdTZcwi/5Ibf8SNCqsMUdCQ528T0EwpKoNSrTAS4jtFQjByWeh58K8WiRRo+2OyPg F1IRPMoJ+5njchSVB+WLibUHbFxyRQ4w7r05Rvtu6cPb3GAFXYhqPz+HstuZ+U+CzDDLlPBGqaH aDUE0vqywpVJv6fGcvh/RVhlVV9LhoiundiXuEovS/k1KHL4EGcTBtWCaMPBTT94V3fs6OaASh1 BtaC0563WXeVSEqplK24kv3aEBt/KDarnlXtlJ1LzkjgltxptLdSnpymAbuQ4bZsh8bshnaswuh pP5aR5BRsUdiJZzz5dgVlRo4gRT8elhp4fNIc1q8UtoW/HO6sqqWDjmKCJvwGU45/aCyfzIa5WN NuUWAkG0D6RX4bI0BvPJ3ZUOFQuxLmpeXFqlf/44LGML6egk6O5c25pcsb9UTsiv7IzjEPrfuFD FPnZccpMB3n/Msw/BxPZtHcCdIQkBAFRlv5EQ8ptyShdrDSnu7qkNavRpJKB7l0JavC0wpatjuE R5O0DexaYssPOk/qNNx5dfIBvw3+y2B2WkLpBziETnD6GB1Xdq6zGxn0huuU5wSrwG/cD6vOUn/ YM2eh3BW9k696WgIs2O2w2LFCq1flMJlUCWv4xk8ggIHqrDaX9ZM04WIInmnHUOd X-Received: by 2002:a05:600c:a086:b0:4af:c210:5b3f with SMTP id 5b1f17b1804b1-4bb88817ef1mr784925175e9.24.1796148401111; Tue, 01 Dec 2026 10:06:41 -0800 (PST) Received: from [172.15.174.73] ([62.28.7.213]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8538b3a7sm1144311635e9.3.2026.12.01.10.06.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 10:06:40 -0800 (PST) Sender: Julian Braha Message-ID: <3ccda48d-02a6-4594-92f6-b7d988cef2e4@gmail.com> Date: Tue, 1 Dec 2026 18:06:38 +0000 X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Julian Braha Subject: Re: [PATCH 1/2] scripts/config: preserve ampersands in string values To: Daniel Syauqi , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org References: Content-Language: en-US In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------VZUCyJR0xBp0NSecNhX2N40S" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------VZUCyJR0xBp0NSecNhX2N40S Content-Type: multipart/mixed; boundary="------------zroPjHvJFrz8xIgMw6Lzto1v"; protected-headers="v1"; hp="clear" Message-ID: <3ccda48d-02a6-4594-92f6-b7d988cef2e4@gmail.com> Date: Tue, 1 Dec 2026 18:06:38 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Julian Braha Subject: Re: [PATCH 1/2] scripts/config: preserve ampersands in string values To: Daniel Syauqi , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org References: Content-Language: en-US In-Reply-To: --------------zroPjHvJFrz8xIgMw6Lzto1v Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Daniel, Thanks for raising this. On 11/30/26 07:52, Daniel Syauqi wrote: > Setting CMDLINE to 'a=3D1&b=3D2' with --set-str works when the symbol i= s (This 'a=3D1&b=3D2' example looks more like the end of a URL to me than a= boot argument...) > absent. When replacing an existing assignment, sed expands the > ampersand to the entire matched line. The command succeeds but writes > a different kernel command line. Embedded quotes from the old value > can also truncate the string on the next olddefconfig. Improvements to input validation are good. But, there aren't any cases of ampersands or embedded quotes in the string constants in-tree, and I can't imagine any real-world cases where users might encounter this. >=20 > Escape backslashes and quotes when forming the Kconfig string and > escape backslashes and ampersands when forming the sed replacement. > This lets insertion and replacement write the same value, including > when a backslash precedes an ampersand. Decode the escaped backslashes > when reading the value back with --state. >=20 > Fixes: 1f990cf94559 ("kbuild: add generic --set-str option to scripts/c= onfig") > Signed-off-by: Daniel Syauqi > --- > scripts/config | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/scripts/config b/scripts/config > index 32428ea90..ba66b681d 100755 > --- a/scripts/config > +++ b/scripts/config > @@ -86,9 +86,10 @@ txt_append() { > =20 > txt_subst() { > local before=3D"$1" > - local after=3D"$2" > + local after=3D"${2//\\/\\\\}" > local infile=3D"$3" > =20 > + after=3D"${after//&/\\&}" > sed -E -i.swp -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$inf= ile" > SED_EDITED=3D1 > } > @@ -186,8 +187,9 @@ while [ "$1" !=3D "" ] ; do > ;; > =20 > --set-str) > - # sed swallows one level of escaping, so we need double-escaping > - set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=3D\"${1//\"/\\\\\"}\"" > + # Escape backslashes and double quotes in the Kconfig string. > + value=3D"${1//\\/\\\\}" > + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=3D\"${value//\"/\\\"}\"" > shift > ;; Sashiko alarmed on this hunk regarding usage with bash 5.2, but it seems to be a classic AI hallucination. > =20 > @@ -211,6 +213,7 @@ while [ "$1" !=3D "" ] ; do > V=3D"${V/#\"/}" > V=3D"${V/%\"/}" > V=3D"${V//\\\"/\"}" > + V=3D"${V//\\\\/\\}" > echo "${V}" > fi > fi >=20 These substitution changes further complicate some already tricky code (and lack a real-world example). But, the changes look technically correct to me, so: Tested-by: Julian Braha Reviewed-by: Julian Braha --------------zroPjHvJFrz8xIgMw6Lzto1v-- --------------VZUCyJR0xBp0NSecNhX2N40S Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQT6qjll++tIFxF8TUPElYPCBXNxIAUCaw8MrwUDAAAAAAAKCRDElYPCBXNxIDno AQC52wkHGDXxTFHDg0yS7Q3qdLrJ5pJBKatzOo7lrrCVJwEAjYWY1birxOcyJ+JgcCDJq2t5iVoS cR6YQ8fPZW+14A8= =YqKh -----END PGP SIGNATURE----- --------------VZUCyJR0xBp0NSecNhX2N40S--