Skip to content

Commit e461bc9

Browse files
MoonCactusmasahir0y
authored andcommitted
scripts/config: allow colons in option strings for sed
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) <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent ae83d0b commit e461bc9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ myname=${0##*/}
77
# If no prefix forced, use the default CONFIG_
88
CONFIG_="${CONFIG_-CONFIG_}"
99

10+
# We use an uncommon delimiter for sed substitutions
11+
SED_DELIM=$(echo -en "\001")
12+
1013
usage() {
1114
cat >&2 <<EOL
1215
Manipulate options in a .config file from the command line.
@@ -83,7 +86,7 @@ txt_subst() {
8386
local infile="$3"
8487
local tmpfile="$infile.swp"
8588

86-
sed -e "s:$before:$after:" "$infile" >"$tmpfile"
89+
sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
8790
# replace original file with the edited one
8891
mv "$tmpfile" "$infile"
8992
}

0 commit comments

Comments
 (0)