Bug 5789

Summary: IPK Postinstalls spit out sed failures.
Product: [Build System, Metadata & Runtime] OE-Core Reporter: David Nyström <david.nystrom>
Component: coreAssignee: Saul Wold <sgw>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Medium CC: jessica.zhang, laurentiu.palcu, meta.mr.watcher, meta.watcher
Version: 1.6   
Target Milestone: 1.6   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description David Nyström 2014-02-05 11:41:15 UTC
| sed: -e expression #1, char 41: unterminated address regex
| sed: -e expression #1, char 42: unterminated address regex
| sed: -e expression #1, char 41: unterminated address regex
| sed: -e expression #1, char 42: unterminated address regex

During do_rootfs, when running postinstalls(IPK) for core-image-minimal, these error reports from sed can be seen.
Comment 1 David Nyström 2014-02-05 11:42:21 UTC
These are seen when installing packagegroup-core-boot, I suspect its related to update-alternatives.
Comment 2 Saul Wold 2014-02-21 00:49:04 UTC
David, could you give some more details, and possibly double check if this is 
fixed, we recently refactored the packaging/rootfs generation, I just tried to 
build core-image-minimal with IPK, but did not see these errors, so I would 
like better information about a reproducer.
Comment 3 David Nyström 2014-02-28 08:35:02 UTC
Saul asked on IRC yesturday, and yes, I still see this on master.

NOTE: Installing the following packages: opkg-collateral run-postinsts tcf-agent packagegroup-core-eclipse-debug dhcp-client packagegroup-core-boot opkg poky-feed-config-opkg
NOTE: /media/sdb5/oel/build/tmp/sysroots/x86_64-linux/usr/bin/opkg-cl -f /media/sdb5/oel/build/tmp/work/p1025twr-oel-linux-gnuspe/core-image-minimal/1.0-r0/opkg.conf -o /media/sdb5/oel/build/tmp
/work/p1025twr-oel-linux-gnuspe/core-image-minimal/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version   install opkg-collateral run-postinsts tcf-agent packagegroup-core-eclipse-debug dh
cp-client packagegroup-core-boot opkg poky-feed-config-opkg
sed: -e expression #1, char 41: unterminated address regex
sed: -e expression #1, char 42: unterminated address regex
sed: -e expression #1, char 41: unterminated address regex
sed: -e expression #1, char 42: unterminated address regex

Isolated the issue with rootfs-sandbox to busybox, when running update alternatives on mdev.

update-alternatives: Linking /tmp/rootfs//bin/sh to /usr/lib/busybox/bin/sh
update-alternatives: Linking /tmp/rootfs//sbin/fstrim to /usr/lib/busybox/sbin/fstrim
update-alternatives: Linking /tmp/rootfs//sbin/mdev to /usr/lib/busybox/sbin/mdev
sed: -e expression #1, char 41: unterminated address regex
sed: -e expression #1, char 42: unterminated address regex
<snip>
update-alternatives: Linking /tmp/rootfs//sbin/fstrim to /usr/lib/busybox/sbin/fstrim
update-alternatives: Linking /tmp/rootfs//sbin/mdev to /usr/lib/busybox/sbin/mdev
sed: -e expression #1, char 41: unterminated address regex
sed: -e expression #1, char 42: unterminated address regex

Update alternatives seems to be run twice for all symlinks, 
Thus yeilding 4 sed errors where two are generated each run.
Comment 4 David Nyström 2014-02-28 10:14:42 UTC
Looking at the busybox postinstall it indeed runs update-alternatives twice for each binary. This calls for another bug.
Comment 5 David Nyström 2014-02-28 10:22:17 UTC
Found the issue:

Garbage in the generated busybox postinstall

$ cat var/lib/opkg/info/busybox.postinst  | grep -C 3 mdev
	update-alternatives --install /bin/ash ash /usr/lib/busybox/bin/ash 50
	update-alternatives --install /bin/sh sh /usr/lib/busybox/bin/sh 50
	update-alternatives --install /sbin/fstrim fstrim /usr/lib/busybox/sbin/fstrim 50
	update-alternatives --install /sbin/mdev mdev /usr/lib/busybox/sbin/mdev 50
	update-alternatives --install /usr/bin/[ lbracket /usr/lib/busybox/usr/bin/[ 50
	update-alternatives --install /usr/bin/[[ [[ /usr/lib/busybox/usr/bin/[[ 50
	update-alternatives --install /usr/sbin/addgroup addgroup /usr/lib/busybox/usr/sbin/addgroup 50
--
	update-alternatives --install /bin/ash ash /usr/lib/busybox/bin/ash 50
	update-alternatives --install /bin/sh sh /usr/lib/busybox/bin/sh 50
	update-alternatives --install /sbin/fstrim fstrim /usr/lib/busybox/sbin/fstrim 50
	update-alternatives --install /sbin/mdev mdev /usr/lib/busybox/sbin/mdev 50
	update-alternatives --install /usr/bin/[ lbracket /usr/lib/busybox/usr/bin/[ 50
	update-alternatives --install /usr/bin/[[ [[ /usr/lib/busybox/usr/bin/[[ 50
	update-alternatives --install /usr/sbin/addgroup addgroup /usr/lib/busybox/usr/sbin/addgroup 50
Comment 6 David Nyström 2014-02-28 10:28:08 UTC
$ cat etc/busybox.links.nosuid | grep -C 4 mdev
/sbin/rmmod
/bin/ash
/bin/sh
/sbin/fstrim
/sbin/mdev
/usr/bin/[
/usr/bin/[[
/usr/sbin/addgroup
/usr/sbin/adduser

links.nosuid is tainted.
Comment 7 David Nyström 2014-03-03 08:40:50 UTC
Stems from meta-selinux busybox bbappend it seems.
The bug on oe-core can be closed.
Comment 8 Saul Wold 2014-03-03 22:49:08 UTC
David, thanks for following up on this, this is very helpful to know the the 
additional information that you were using mdev and meta-selinux. Your intitial 
description did not include that and I would have been chasing this issue.  I 
am glad you could track it down, I will close this.