From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796111597; b=BBh5tCUKuaP2QrmLilzgb6ABmoXVyzx9hloze0xUhG6KPWx1SSwDiU4MO06Fh5HfQaMY aqh3Rs+huiue7VuvDxRcenHT5VzdYj6qecDMvzw/dWdWwuElzEHHb35/X6N+ptwXX9CsC Rxi7OjOnYOb5/XkWea+x5VZjn1gfUr7d156Y0i/guZz0Y5LNJyIZvWOV0k9yeYG/UzQ8e Wyo1Qgk3d7+5w9QbrVHDyjTMwwAErVd2/CYL9E5W1zWY8LEtN5czQsGXeDiohaeK6nNG/ n6rURhiIc9F7hUuDBwYwcSFtItDxg8HX8amO1xsELMmO+N3YJveYCPznCXzENjPmhQg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796111597; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ZVfIzeMnV8S9vnYSIdnwxMEkVEAUgQT8MpDCd/EfQRA=; b=E6FrxVULImx9MoSCNk8X2sKh1xosJgyaVfzGed+tBsZu4J+7cKbZpn9N1HUfniTaOwkj Zipzk3X9KjOnHchYFYfBDGw+EeSeCrFLxiMNsBHvtghdcAIzh4co+SZIeaUsQUNNTDAve bpIEWKngqX2Fuqubp2nwuUO7GmtqJGBP7xPaDwgLGOdR8+BTDsk+YRgk5Wvn1vJepRdbD a2JSzixeYQHEA973QjDnKEmINFy5Fki/11sYA0BsbPxqs3kT0f5SstHuN+h9LkJOuS/1G qNxorR79PT5oJu5LcYrbptz0QMBdYC/cLYAqTxi8w+wpBlDsT66CSH/dQBljm0NV/iA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EPBLAaxc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97F80606A327 for ; Tue, 1 Dec 2026 07:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EPBLAaxc Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5D161F00897; Tue, 1 Dec 2026 07:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796111597; bh=ZVfIzeMnV8S9vnYSIdnwxMEkVEAUgQT8MpDCd/EfQRA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=EPBLAaxcRwTPjErh2qO8ql4LDMCTtUE102asK+CKmfSWaZMBFwv1+8GO0Kh3bubhi dHvxXSmqcPSQOObz+ktQOmieZ2Xp3YuJrmczqzc6VgTFwOkwFBFOQkp3+SX/xbe1km zcu5oy2AO52dMcOQCl9yI7JsAHKumKnjsRfjw4TAMv7x4ih9m4RDDlIUkN/swA2o85 M/YDy8G2eoAjisbV454CtuiHPcLPENgGNIdllVtxSYX9lpTj3/4FEWuu/Dh9i4Tvmk 3lPyrqhhAvoyiemfsK3OsFFEctpYPfmr9t55HcCZRCIK+gFHmOczwlclrzn/ZsMvqL 6cLE7lwgdK9vQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] scripts/config: preserve ampersands in string values Reply-To: sashiko-reviews@lists.linux.dev To: "Daniel Syauqi" , "Nathan Chancellor" , "Nicolas Schier" Cc: linux-kbuild@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 07:53:16 +0000 X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] scripts/config: broken backslash and ampersand escaping on Bash 5.2+ -- commit b78b433a507d0a53d91d8991945248e47628caf3 Author: Daniel Syauqi scripts/config: preserve ampersands in string values This commit escapes backslashes, double quotes, and ampersands when setting Kconfig string values and running sed replacements in scripts/config, and unescapes backslashes when reading string values with --state. > diff --git a/scripts/config b/scripts/config > index 32428ea909c2c..ba66b681d7429 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" "$infil= e" > 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 > ;; [Severity: Low] Does the double-quoted ${...//.../...} replacement in txt_subst() and --set-str lose one level of backslash escaping on bash 5.2 and newer? Bash 5.2 enables the patsub_replacement shell option by default, where & in the replacement string expands to the match and \ escapes & and \. Outer double quotes around ${parameter//pattern/replacement} do not disable patsub_replacement; instead, the outer double quotes halve the backslashes first and patsub_replacement consumes the remaining escape. As a result, "${after//&/\\&}" leaves & unescaped for sed, and "${2//\\/\\\\}" and "${1//\\/\\\\}" collapse four backslashes to a single literal backslash, causing sed to expand & to the matched line or strip backslashes from escaped double quotes when updating an existing symbol. Quoting the replacement string itself (for example, ${after//&/"\\&"} and ${1//\\/"\\\\"}) or removing the outer double quotes prevents double-quote backslash reduction before patsub_replacement runs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796024119.gi= t.syauqicode@gmail.com?part=3D1