From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148323; b=l+kvuLn535veHoW/cz+4Nacn9db8TYYqohXNkww14tI1Jqz64xJfdd4p26MVYvlb6PRH HSMMDB1gUOU+/Ll3J/RpC2XoBwTTEZJG9tmhKmRzzmqEoHgqQTOsLHp4ZQDAGwactXoBf egLp9/blmHLW+Rqh+J5O+Av+d0R7yDvxPD0qj+HHxSxzr3S1JKVrvxp7ZlcC8qRlaiCPb X/PKumeD2Xwz3pZCNlhabqTNSLxkksxmE8S1Pi6naiH/QOYarHLrxG10z3eAR79Jnm3Dg 8q4uXmAt62x/uYQUw7OoLv80gqOMXZ2FkhdZtaMasyWvA039GU5coSaWdaVlJ8Jl2gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796148323; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted: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=a3qCCfUUpcSI0NptyqRyPPl/wL1so6qZNGlfeghC14g=; b=Hl4LmP7Zynh12kA3IOrvlbIluNfWBOqRHptRTudDPiuo0xUpcgGPeG0lIfyR4GTDikfr JaW5zQ0ybzdCxg1WLDeWm2C2xJ5pkFZosGWR5iMEWpAwwU03HyN3QZEJA6P5e+pVta4KM 0U3Eq/rhwetQABtLcmbo5paHrZW5CyXoobW2AoSzCHbIf6sm7I2gbZoz9/5jHFxBYJazy fXTgq/Noa4u3pndInLkYyspgw97dWDUIbv/6LSgxDBf3W+Bda8ppp9dsYoVkGRZFgHUAC +dYdfJoMrwV1nBUPhKEznfV2PWFsojXHPuFcf4rKesHY/HgYYRZIH7Al2IFdgT/2M0g== 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="Zdoq/OIu"; arc=none smtp.remote-ip=209.85.221.43 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 AFDE2606A322 for ; Tue, 1 Dec 2026 18:05:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AFDE2606A322 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=Zdoq/OIu Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-49412eb1474so8152601f8f.3 for ; Tue, 01 Dec 2026 10:05:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796148321; x=1796753121; 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=a3qCCfUUpcSI0NptyqRyPPl/wL1so6qZNGlfeghC14g=; b=Zdoq/OIuwKDppO/4a2FIUoUEPtrr4sKrJ/bsbO+i94QxKFeuss6ywpVce/M9/pPYwP zrlDV7p4KF0flCNPVRoZEK6FR+T1uI6iNpwNIADqHOLbq0XWXdoqUii2oDsrHD7zTYdA CwmiW1vc9D+COmpt5Y8sONRL6kx54R5XUDq97hox8J4eFGBzKo2HY+7RbEcGVDIBeYFa dD3GMUORXt54AbozESJw8JaLfafGMIysvBeI0FYj0ytFFK1UoLAMQcaEmw5bwVBiPKqK 8rQWvWMqibkN5AyITZ+a7gkz/9E5UhaXWL5zFyJDcqRIL3NhDjmVNtNo9Zg8OlYP22Go U+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796148321; x=1796753121; 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=a3qCCfUUpcSI0NptyqRyPPl/wL1so6qZNGlfeghC14g=; b=Yli1okFvhX7kuNUnqM6VSaRLP9gNuyHnI8MS7Nw5vgIb2IDnC2vvzw+ku2EjO9Z7tr f5zvnuQZI/aJftIm5nExCoEr/XFpQP71r+OR/8lgDFQL6wszeX3EaR/gPZW00KbY6uSw I4+hYUk9c8lw3L04Py4fVN8Uko0Yte55RIpAi02iQ7xRn+tit9CwWfe3ZsgTJAueNZnH eh17YTZAXeQPqHlvelLnkl8EnRrtmIxplVWyBAdlvlw70hHInduq0yHRpeifcDzTYDtS +mT88dteOHOLy017qpLMhw3bhNII1nq2/Vs/p6MAHEixOXX6t6721lYiRWXAw7zw2h71 VFNA== X-Forwarded-Encrypted: i=1; AL+hErFXzQfmVMw1C/gIcqfznj1MXHSGWc++IF2iZCK06Mx7Tp0RKly7ueZepdKazVxQIIX0hLAnSQaSeV3SpKw=@vger.kernel.org X-Gm-Message-State: APuU4Z/RpKccIyQ7Mdu8wos4fTpfcuSX4npeuLmQkT3NLposmgJSUnPx toStCc8s0EJn7Nx1OStuNRR79IR0bBTdeEqax0E++MxkCKn/YwFUImf2 X-Gm-Gg: AZFdTZfAAK8z0K+AvvVeQUFcGoj8Y2uKNivDrOMAJhLmCCqvlJ7Ck4dqbbKtAP2rCxr ecQ2Of41mH50o+SAoGsZOM9W095hwV5664UZw5GyEdQLRuS5XW/XyZQTn4qvwpqYq26QdS3AmHO +HSgz+nSOlVGGL3qLgW65kv/GuTk9xIFmLYjGYMR1gz+8n2f+JB4PYCzsYkl+gl6aBF7oKdn/dE PWYJCPi5Es9zegahGCOIm5TUMfAqIMj6FuToM+FdISWjj9D7cK/WnvR9vc09dFtSg6By9T4vIau Z0jfvGXusKNE97FdbmeefutXstk7pDygpRqocfYKMtenHPZcNQtTxRl7Y//caNID7WLK9X+ht3U oAkmUWV5fWkkSt63DJ14t2y5fQQaUvJ57ENf51ouimcJmqYgT1xAisEeErvCURIXYaNlwySF8qB DdVS8o+ixPTn2YEr4v2Vq5TOiQ9vEBKPma0CfncsrtZUspACx/OXGcR+rYeJrDr/EQYyGeG1+h9 ykqky92X4Ta23oVPcfznFdiMWeyeZ44A3+Wpb9Q+BJtIIOPSi/7t9+X2rf6q99UFPnQUpT1GG5z 8FItY4Z6PKgAkwE9wNDbXj5pffPe1w21+XziMvkeHfV8/Tkp6O0E1HaRJBEq/YQm X-Received: by 2002:a05:600c:a088:b0:4bb:6473:cde9 with SMTP id 5b1f17b1804b1-4bb8880f2d8mr657476415e9.6.1796148320761; Tue, 01 Dec 2026 10:05:20 -0800 (PST) Received: from [172.15.174.73] ([62.28.7.213]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a9687sm1153269265e9.10.2026.12.01.10.05.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 10:05:19 -0800 (PST) Sender: Julian Braha Message-ID: Date: Tue, 1 Dec 2026 18:05:18 +0000 X-Mailing-List: linux-kernel@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="------------heyF40Qa941ZMP0YXSyjlpIW" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------heyF40Qa941ZMP0YXSyjlpIW Content-Type: multipart/mixed; boundary="------------fmtU77PjpRMJi2UkhgJ6dlZo"; protected-headers="v1"; hp="clear" Message-ID: Date: Tue, 1 Dec 2026 18:05:18 +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: --------------fmtU77PjpRMJi2UkhgJ6dlZo 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 --------------fmtU77PjpRMJi2UkhgJ6dlZo-- --------------heyF40Qa941ZMP0YXSyjlpIW 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++tIFxF8TUPElYPCBXNxIAUCaw8MXgUDAAAAAAAKCRDElYPCBXNxIPHA AQD0Jr3Az/sVoXA+Lck4YPNUKgSTRrBU3/0tEVTpFWo/cAEA4pQYGgrSZyLSgpfjzTIl0ym1Fygd zzQ+c1XPTgcgzQw= =XpvY -----END PGP SIGNATURE----- --------------heyF40Qa941ZMP0YXSyjlpIW--