From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148323; b=A3t3wNrYTfDAgIYqBjQ9sUW7vnTjh22HTJ16ke6odYF9YMlLVJbc+eZ9iiusSTs04P4X AhPs2+VOoDjt2AvWzj1C/zFh38Ra2hHsFLjf0JMMW9g6D5NFdsRsSLxfqfkWdOgeUa9+I xrnH318cmXU8MpCezY2pIQopbm+gzxk2u0LoOz+j6yRHW3aJzpJul1NtoqpbHndeiv22/ hYqttPqO7iYpy6V++ID9fEf847usdBQVR0sXb1DvCMbTbO5XqSgXu5mbwRC9EkIjDjvXl 0hPZ0KB08okrd+Sz/3bw2A3KBJ/4iVUY59P4HtfhWn0M5YaLRqMlk1MhfKmKS167yUg== 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-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=K3nuHlCo+y0El2foN5ObE4NiHGRwz/i6SPyRXzcBSAgDdUMHz36wK0Q6No6mljItJaeK t6Yvf6AOcE2oLMjPSLmBi/0bNkodwQX6McdFX7pnbnMe75Wo6gp4952qlvvs+xFVx4cXa Ehaxj3AqS5d53rEPaiHT5QhyU1wwsx3203hAlA+ItaBYE9pX/cS3ooprjn+k3ZNYSEl6Q 55mrb/FmUX/0HGn5c1lpQ3+kgz83oERFIiNdjLNh8ILSKv2SWj9kSXgXT1tKs6gaf/o1m b6QpSJqQTLZAredfs8SQbv6eDVSHjY4ygKICXM+sUn6jyRQJ0+HQmpBWOVavUKn4uCw== 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.128.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 9B95E606A320 for ; Tue, 1 Dec 2026 18:05:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9B95E606A320 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-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4bb606491faso62861885e9.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=Wxoeb+7lnbRiMOHwMFj/1HVFY1nd3oQlZcdEW52P1NmTn5rBfRC1UAZs2bVQls00K0 x38wZjkmgzMrGUUtcYXOJ665NfOpkkeEzFeX/zj+Skh0cedo72aG4qtSicUjSt94yvH7 2U/tPexq5kdqhBPoZtqIal2U6YcCRdEqPev6UtaS5XkZQDoy6hQUCIedAcij0k2XznEG yi4KOvPXNqsLy/GHlBp/woioputHNJ98lXp4BRxVdD1kVbE2Xy5RQiKkBPW0MEcHLv4J yG4WKjSv3Yfy60CsHuHdowZdW6FfJfubgGqVkmAjxlwpwaxmDAgPA0pqh0pV3kCKzbln 8cOw== X-Gm-Message-State: APuU4Z8cW8uaS6rlFnh/RK6mqt2gS6UR6UpjLtLpj/F+MYN0gFxrhmwz 4APAMlDDa4jP4Q7VEMg1q0MRWo3ufdS6WwtxC/XUodONZNWyWyOOL+Jk X-Gm-Gg: AZFdTZfUOp4TGDvKdaqOyRFvOCciUwtbfX+iKan7P+UpojCV58otk5vl32LKe0brxrZ H68/dhhXU+YmnA2sDzpXp0LM7ZqZTXHkckJk6fgkDuJ3sZQSq+GOtp9CuueCRLYIdch0RZvg5l4 JUNwpi9jU8jGKFMz4WNuhzqVHotHbxLJ7J7s+SmeYhRjeP2yMHDRm7bUXlzvHKJke1Fc0gcYpj5 VrWfTKNqFgwE4XwImF5MtrWJlSws2rx+ScanmIduVfTLSFzeug5uG3/hAqaJMJ3Cmd7otpAslhg TeBe71YF52vzPh3L5t9OlMnYvnoOlTjZUNVPB9mefKhRitF0w6VOOW00py4KUpRkaTxlKqL5OvC Tdicpu490hBGy7obep7mqEjtA9esVn7uFVKHFMaW6juJgyKvpyOGI3ggCLUf5Osy9X2NeMUVftN gNaRl4Rw/tCC/yFiYFry4BCUWEkkIg5Vg8tG9+6twyhFS3V07Ji7H4v6pKf8gkovGdx8/tD2yJa HNIkuv8uYTtZL5JWWUPvcVUnPx2Gd4WRrmqPw+o0Fzsgyu3SkPbi/9ZErJX2jMagwjUhjEVR5Il wjQSQicM/6+t7GADQtgGQvUF0+gMs+WWBllw5P8HWz8Mltt1LR4LGExn3OFLxMv4 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-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="------------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--