From: "Jeremie Francois (on alpha)" <jeremie.francois@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: "Jeremie Francois (on alpha)" <jeremie.francois@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] scripts/config: allow colons in option strings for sed
Date: Fri, 10 Apr 2020 18:57:40 +0200 [thread overview]
Message-ID: <20200410165741.27078-1-jeremie.francois@gmail.com> (raw)
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>
---
scripts/config | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/config b/scripts/config
index e0e39826dae9..d365081b60b2 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"
}
--
2.17.1
next reply other threads:[~2020-04-10 16:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 16:57 Jeremie Francois (on alpha) [this message]
2020-04-10 17:36 ` Randy Dunlap
2020-04-12 19:23 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200410165741.27078-1-jeremie.francois@gmail.com \
--to=jeremie.francois@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®