From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148403; b=xLp23haidoXCqPPl8bfn4cybHAkk3rZrwQzYpigScqL8LWoP1HnYIkCA7I+qKFByDcMI fkr/QV4+Sy00N/8p0jzwCcMcpkXzGWURtX7qM1wmJccm1kjSfmL9M7eolOMp0z+zCZMAg y9EkbrKSihtqVhsdTeDABhUWcjpCWpyQL5YxeRYrFebCYlTLoUYhz621B8Ca0cASp3cEL NPaR8CSZTBEmov9Y9TBwTXHF4DV+OzLziaFTezMcE8KqHewvtNnVCRDVdjvQWKO4LoVYC aB6cDZWe8MPpZikXodfbE+Wv3GkkxdyajQ3uXjaNz/c02ny1WqoraLCs8DU8uRoSS0w== 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-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=TZMqX4xA5BlQ4z2F6lfpqzQo37ZA5iFLHylp9nQDIgg=; b=NQRD4+ByPW/oO2mgsn37DQyHJZlQIkvR7mkXJ+RDi6mX2/E0FkYMLiRy7zI0yZgtqNvZ gI7UAFE3YPXcX0ywtkiK+foIKVLdsoWnjdDLvphYNWG2/EuSza6ItmS5Rfs3sXWElmOoE nRgjWqHqrzlmnITbxfGZorpUXfoIMwSpzTJt+XazQq3HZJ7MCTeRz1A7Vq4fHrw11K6kV 9MRB0VXX2RCv62I1nQwk/+lgnYdlrhUXWKPvA5TcA50VaWl0M6VWuWv8r4++IicTiR59J DaKmytWEZial+ZPBr/a14MTQwEG+TEKOsOJ7tYJkecct3v/UoYaT38kdNTxUwhdN2iw== 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.54 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 DC15F606A320 for ; Tue, 1 Dec 2026 18:06:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DC15F606A320 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-f54.google.com with SMTP id 5b1f17b1804b1-4bb5b8ef642so100451405e9.1 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=a1X+X3RwjxldCCnytCk0WAGRV9rlswj2zfetfEpBNj+txo8RhZYF1ZkVrNBBXEWqj/ Cj7SH1NEg6qWUaQoMQfbQ0GW+N08xnnwpMCbCS7iD6H/KNLU8GUtvG3v/RfjaCwqHSEu 1D+E5p5Bmydoid6//eK6kVgCk9HRFb8lmlApppSYNThdsO9D2sy3+vUrLHQp/OO+MVCz 5a5hLl7bLK5lQ4PRr50ErZN4QIc1sjApastPRZ+/Z3PEuh8/JgJmSmRiYu2HniWZj86G Lycx2jlJcxVpldsski9ja5LNTsTxB6+qyvqnXKPpCE1psSXqN9ajTVnl9zl7gvFW7AEc I43Q== X-Forwarded-Encrypted: i=1; AL+hErElFRx+M4bQGC/13rcBE8brrMZadiOtC6zddVJVl6glsOp3dysNbKRnzrcpYUc8bddfrix53Rub/1p1UUc=@vger.kernel.org X-Gm-Message-State: APuU4Z9QvXJ+O+xLdZCjZj4hzxCvCuXrM2kHelYmXW/81oMA5YFX2aUI 68QYElV9HZWrVTcrtH/65pQkHIzb+2+cqy9kOw6jFgBNawJPp0YPWBtR X-Gm-Gg: AZFdTZcvrvWW3KdcDhlDS9lFYlpS+yihSr4aqkAJHXzry+0fl2jkzbq06m/imESBBDn CC2hYtCxFBA57dTitazo9a86cbzCGETnHGnn6NNYjE42bN6sQ5zuKeok04FdcAbYbQ43Glnagoj bNjaWbk3vjcUWB+sQbxM6DZl5Rbn3fllLloVk01qi/7CCWRCcDfr7jWwVvEUKIoMe/wjBVfRMH6 7D270eQ1Xxs9b4eBD4HfXEOLJn5bQJc7foM9R0sCQ6SZsGUaI7/1JE6hOpAphk2PwTdv/aNov0p LgqacKDT3eUkeAKEL3qveajUhxofjD28INBAM8KHGj+LFFjB1p4eMqMVjGiPvQrUsFKqUAWE9sp FsFgW2i7TFBjG1U8ywIhjCoCIdA8vIJbzrjU+7BqGF+G1E0vNgWKE+rKa6fJrVVNP6kTvI72pRm /0zV3hUnRtRxLsJy8Uzm+5PJ7Yu2uuXXN9/YfrTv+OcmlyP0LD9z64rkpiJUhBEX0QAPwZ9Rkr8 npOjh7ewWLQVXRfRC0hucFFjl6BqTBgGA4aNWs8aaWwDQuCiGTk1Q6N8Iv1uhUL/1XfgR2Uiq3b Xn3zZhmpJZXIURFkCvHxpYsc2HUsI2wrFApl2FODqQM3BTkO9+jJx+BdkdbOtYck 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-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="------------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--