Skip to contentSkip to conversation

update-alternatives: fix the sed pattern in remove_alt

PATCH In review [email protected] 1 participant 2 messages Jan 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update-alternatives: fix the sed pattern in remove_alt

From: Jackie Huang <[email protected]>

'\>' is to matches the end of a word, but the executable is not always a 'word', e.g. /usr/lib64/busybox/usr/bin/[

then such alternatives can not be removed.

So change to use '\s' in the pattern since the following character of the $path is whitespace.

---
 update-alternatives | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
update-alternatives +1 -1
index ffad853..ce7d66c 100644
@@ -80,7 +80,7 @@ remove_alt() {
 	[ ! -f $ad/$name ] && return 0
 
 	path=`echo $path | protect_slashes | protect_special_character`
-	sed -ne "/^$path\>.*/!p" $ad/$name > $ad/$name.new
+	sed -ne "/^$path\s.*/!p" $ad/$name > $ad/$name.new
 	mv $ad/$name.new $ad/$name
 }
 
Signature · 1 line
2.7.4
#1 lore raw

Sorry I forgot adding opkg-devel, so I just re-sent with opkg-devel added in.

Thanks,
Jackie

Quoted 44 lines

-----Original Message-----
From: [email protected] [mailto:yocto- [email protected]] On Behalf Of [email protected]
Sent: Friday, January 19, 2018 10:54
To: [email protected]
Subject: [yocto] [opkg-utils PATCH] update-alternatives: fix the sed pattern in remove_alt

From: Jackie Huang <[email protected]>

'\>' is to matches the end of a word, but the executable is not always a 'word', e.g. /usr/lib64/busybox/usr/bin/[

then such alternatives can not be removed.

So change to use '\s' in the pattern since the following character of the $path is whitespace.

---
 update-alternatives | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
update-alternatives +1 -2
index ffad853..ce7d66c 100644
@@ -80,7 +80,7 @@ remove_alt() {
 	[ ! -f $ad/$name ] && return 0
 
 	path=`echo $path | protect_slashes | protect_special_character`
-	sed -ne "/^$path\>.*/!p" $ad/$name > $ad/$name.new
+	sed -ne "/^$path\s.*/!p" $ad/$name > $ad/$name.new
 	mv $ad/$name.new $ad/$name
 }
 
--

2.7.4

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto