diff options
author | Jeremie Francois (on alpha) <jeremie.francois@gmail.com> | 2020-04-10 18:57:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-10 10:30:09 +0200 |
commit | e98ea62e94f5c2097b9f5c9d247d7d28678c1f2d (patch) | |
tree | 0aa8d2dac8f11b7ca2c9d7350cf36feedb1d5d35 | |
parent | bbe15f16e5c5cb24c855efd6102c1074740da514 (diff) | |
download | linux-stable-e98ea62e94f5c2097b9f5c9d247d7d28678c1f2d.tar.gz linux-stable-e98ea62e94f5c2097b9f5c9d247d7d28678c1f2d.tar.bz2 linux-stable-e98ea62e94f5c2097b9f5c9d247d7d28678c1f2d.zip |
scripts/config: allow colons in option strings for sed
[ Upstream commit e461bc9f9ab105637b86065d24b0b83f182d477c ]
Sed broke on some strings as it used colon as a separator.
I made it more robust by using \001, which is legit POSIX AFAIK.
E.g. ./config --set-str CONFIG_USBNET_DEVADDR "de:ad:be:ef:00:01"
failed with: sed: -e expression #1, char 55: unknown option to `s'
Signed-off-by: Jeremie Francois (on alpha) <jeremie.francois@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rwxr-xr-x | scripts/config | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/config b/scripts/config index e0e39826dae9..eee5b7f3a092 100755 --- a/scripts/config +++ b/scripts/config @@ -7,6 +7,9 @@ myname=${0##*/} # If no prefix forced, use the default CONFIG_ CONFIG_="${CONFIG_-CONFIG_}" +# We use an uncommon delimiter for sed substitutions +SED_DELIM=$(echo -en "\001") + usage() { cat >&2 <<EOL Manipulate options in a .config file from the command line. @@ -83,7 +86,7 @@ txt_subst() { local infile="$3" local tmpfile="$infile.swp" - sed -e "s:$before:$after:" "$infile" >"$tmpfile" + sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile" # replace original file with the edited one mv "$tmpfile" "$infile" } |