All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Jian <jian.liu@windriver.com>
To: <opkg-devel@googlegroups.com>, <yocto@yoctoproject.org>
Subject: [OE-core] [PATCH] opkg-utils: update-alternatives fails for "[" and "[[" in busybox
Date: Mon, 27 Oct 2014 17:35:11 +0800	[thread overview]
Message-ID: <544E11CF.6010701@windriver.com> (raw)

Building a small filesystem with busybox gives 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.

Signed-off-by: Jian Liu <jian.liu@windriver.com>
---
...andle-leftbracket-for-update-alternatives.patch | 25
++++++++++++++++++++++
meta/recipes-devtools/opkg-utils/opkg-utils_git.bb | 4 +++-
2 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644
meta/recipes-devtools/opkg-utils/opkg-utils/handle-leftbracket-for-update-alternatives.patch

diff --git
a/meta/recipes-devtools/opkg-utils/opkg-utils/handle-leftbracket-for-update-alternatives.patch
b/meta/recipes-devtools/opkg-utils/opkg-utils/handle-leftbracket-for-update-alternatives.patch
new file mode 100644
index 0000000..0cdc4e2
--- /dev/null
+++
b/meta/recipes-devtools/opkg-utils/opkg-utils/handle-leftbracket-for-update-alternatives.patch
@@ -0,0 +1,25 @@
+"[" should be escaped in sed expression. This patch is suitable for
opkg-0.2.2
+
+diff -Nur utils.orig/update-alternatives utils/update-alternatives
+--- utils.orig/update-alternatives 2013-08-16 04:22:29.000000000 +0800
++++ utils/update-alternatives 2014-09-19 10:55:22.238159317 +0800
+@@ -68,6 +68,10 @@
+ sed -e 's/\//\\\//g'
+ }
+
++protect_special_character() {
++ sed -e 's/\[/\\\[/g'
++}
++
+ remove_alt() {
+ [ $# -lt 2 ] && return 1
+ local name="$1"
+@@ -75,7 +79,7 @@
+
+ [ ! -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
+ }
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
b/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
index 693c216..04412d1 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_git.bb
@@ -10,7 +10,9 @@ PROVIDES += "virtual/update-alternatives"
SRCREV = "eae0d8fa44e8594aa90eadf06e5f4fbeef314509"
PV = "0.1.8+git${SRCPV}"

-SRC_URI = "git://git.yoctoproject.org/opkg-utils"
+SRC_URI = "git://git.yoctoproject.org/opkg-utils \
+ file://handle-leftbracket-for-update-alternatives.patch \
+"

S = "${WORKDIR}/git"

-- 
1.8.5.2.233.g932f7e4

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



             reply	other threads:[~2014-10-27  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  9:35 Liu Jian [this message]
2014-10-27  9:52 ` [OE-core] [PATCH] opkg-utils: update-alternatives fails for "[" and "[[" in busybox Paul Barker
2014-10-27  9:55   ` Paul Barker
2014-10-28  2:02     ` Liu Jian
2014-10-28  9:28       ` [opkg-devel] " Paul Barker
2014-10-29  1:50         ` Liu Jian

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=544E11CF.6010701@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.