All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Jian <jian.liu@windriver.com>
To: opkg-devel <opkg-devel@googlegroups.com>,
	Yocto discussion list <yocto@yoctoproject.org>
Subject: [opkg-utils PATCH] update-alternatives: Installing fails for "["
Date: Thu, 30 Oct 2014 13:40:32 +0800	[thread overview]
Message-ID: <5451CF50.9060501@windriver.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #2: opkg-utils-update-alternatives-fails-for-lbracket.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]

From 6431466b7c3f5fe76720372593fc785b572db84c Mon Sep 17 00:00:00 2001
From: Jian Liu <jian.liu@windriver.com>
Date: Wed, 29 Oct 2014 09:58:14 +0800
Subject: [opkg-utils PATCH] update-alternatives: Installing fails for "["

Insalling 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>
---
 update-alternatives |    6 +++++-
 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
 }
-- 
1.7.0.5


             reply	other threads:[~2014-10-30  5:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  5:40 Liu Jian [this message]
2014-10-31  1:23 ` [opkg-utils PATCH] update-alternatives: Installing fails for "[" Liu Jian
2014-10-31 10:27   ` [opkg-devel] " Paul Barker

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=5451CF50.9060501@windriver.com \
    --to=jian.liu@windriver.com \
    --cc=opkg-devel@googlegroups.com \
    --cc=yocto@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.