summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJian Liu <jian.liu@windriver.com>2014-10-29 09:58:14 +0800
committerPaul Barker <paul@paulbarker.me.uk>2014-10-30 20:59:08 +0000
commit762d9dadce548108d4204c2113461a7dd6f57e60 (patch)
treed670a29b3141f0a82fdfcfede48ab005d9535c36
parenteae0d8fa44e8594aa90eadf06e5f4fbeef314509 (diff)
downloadopkg-utils-762d9dadce548108d4204c2113461a7dd6f57e60.tar.gz
opkg-utils-762d9dadce548108d4204c2113461a7dd6f57e60.tar.bz2
opkg-utils-762d9dadce548108d4204c2113461a7dd6f57e60.zip
update-alternatives: Installing fails for "["
Installing packages using update-alternatives will give the following error lines: sed: -e expression #1, char 41: unterminated address regex sed: -e expression #1, char 42: unterminated address regex This is caused by the script update-alternatives. "[" can not be used directly in sed expression, which should be escaped in sed expression. Signed-off-by: Jian Liu <jian.liu@windriver.com> Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
-rw-r--r--update-alternatives6
1 files changed, 5 insertions, 1 deletions
diff --git a/update-alternatives b/update-alternatives
index c332309..8916cbd 100644
--- a/update-alternatives
+++ b/update-alternatives
@@ -68,6 +68,10 @@ protect_slashes() {
sed -e 's/\//\\\//g'
}
+protect_special_character() {
+ sed -e 's/\[/\\\[/g'
+}
+
remove_alt() {
[ $# -lt 2 ] && return 1
local name="$1"
@@ -75,7 +79,7 @@ remove_alt() {
[ ! -f $ad/$name ] && return 0
- path=`echo $path | protect_slashes`
+ path=`echo $path | protect_slashes | protect_special_character`
sed -ne "/^$path\>.*/!p" $ad/$name > $ad/$name.new
mv $ad/$name.new $ad/$name
}