All of lore.kernel.org
 help / color / mirror / Atom feed
* [opkg-utils PATCH] update-alternatives: Installing fails for "["
@ 2014-10-30  5:40 Liu Jian
  2014-10-31  1:23 ` Liu Jian
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Jian @ 2014-10-30  5:40 UTC (permalink / raw)
  To: opkg-devel, Yocto discussion list

[-- 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [opkg-utils PATCH] update-alternatives: Installing fails for "["
  2014-10-30  5:40 [opkg-utils PATCH] update-alternatives: Installing fails for "[" Liu Jian
@ 2014-10-31  1:23 ` Liu Jian
  2014-10-31 10:27   ` [opkg-devel] " Paul Barker
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Jian @ 2014-10-31  1:23 UTC (permalink / raw)
  To: opkg-devel, Yocto discussion list

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(-)


----- I add the head of this patch -----




于 2014年10月30日 13:40, Liu Jian 写道:

-- 
Jian Liu
Email: jian.liu@windriver.com
Office Phone: 86-10-84778539



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [opkg-devel] Re: [opkg-utils PATCH] update-alternatives: Installing fails for "["
  2014-10-31  1:23 ` Liu Jian
@ 2014-10-31 10:27   ` Paul Barker
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Barker @ 2014-10-31 10:27 UTC (permalink / raw)
  To: opkg-devel; +Cc: Yocto discussion list

On 31 October 2014 01:23, Liu Jian <jian.liu@windriver.com> wrote:
> 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(-)

I've merged this to opkg-utils, many thanks!

I'm about to send a patch for openembedded-core which updates the
opkg-utils SRCREV to use this new commit.

-- 
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-31 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30  5:40 [opkg-utils PATCH] update-alternatives: Installing fails for "[" Liu Jian
2014-10-31  1:23 ` Liu Jian
2014-10-31 10:27   ` [opkg-devel] " Paul Barker

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.