Skip to contentSkip to conversation

fix confliction of attempted installing su binary among busybox, shadow and util-linux

PATCH New Hongxu Jia 1 participant 4 messages Jul 26, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover fix confliction of attempted installing su binary among busybox, shadow and util-linux

The following changes since commit 67864ca79da08df752487a3a4e1a975546da123d:

systemd: Remove systemd_unitdir if systemd is not in distro features (2013-07-24 11:35:39 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-su
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-su

Hongxu Jia (3):
util-linux: use u-a for su
shadow: use u-a for su
move /bin/su to /usr/bin/su to match util-linux and shadow

 .../busybox/busybox-1.21.1/su-usr-bin.patch        | 26 ++++++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.21.1.bb        |  1 +
 meta/recipes-core/util-linux/util-linux.inc        |  7 ++++++
 meta/recipes-extended/shadow/shadow_4.1.4.3.bb     |  3 ++-
 4 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/busybox/busybox-1.21.1/su-usr-bin.patch
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/3 util-linux: use u-a for su

Use alternatives mechanism to prevent confliction of attempted installing su binary among busybox, shadow and util-linux.

[YOCTO #4926]

---
 meta/recipes-core/util-linux/util-linux.inc | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-core/util-linux/util-linux.inc +7 -0
index d373cec..89bc4a8 100644
@@ -218,3 +218,10 @@ ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
 ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
 
 BBCLASSEXTEND = "native nativesdk"
+
+python do_package_prepend () {
+    if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
+        alt_name = "su"
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('bindir', True), alt_name))
+        d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
+}
Signature · 1 line
1.8.1.2
author
#2 lore raw

PATCH 2/3 shadow: use u-a for su

In reply to Hongxu Jia

Use alternatives mechanism to prevent confliction of attempted installing su binary among busybox, shadow and util-linux.

[YOCTO #4926]

---
 meta/recipes-extended/shadow/shadow_4.1.4.3.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-extended/shadow/shadow_4.1.4.3.bb +2 -1
index caf24c0..173da3b 100644
@@ -119,11 +119,12 @@ inherit update-alternatives
 
 ALTERNATIVE_PRIORITY = "200"
 
-ALTERNATIVE_${PN} = "passwd chfn newgrp chsh groups chpasswd login vipw vigr"
+ALTERNATIVE_${PN} = "passwd chfn newgrp chsh groups chpasswd login vipw vigr su"
 ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
 ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
 ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
 ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
+ALTERNATIVE_LINK_NAME[su] = "${bindir}/su"
 
 pkg_postinst_${PN} () {
 	if [ "x$D" != "x" ]; then
Signature · 1 line
1.8.1.2
author
#3 lore raw

PATCH 3/3 move /bin/su to /usr/bin/su to match util-linux and shadow

In reply to Hongxu Jia

Both of util-linux and shadow have su binary in /usr/bin, fix busybox to use the same path so they can be properly tracked by alternatives.

[YOCTO #4926]

---
 .../busybox/busybox-1.21.1/su-usr-bin.patch        | 26 ++++++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.21.1.bb        |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox-1.21.1/su-usr-bin.patch
meta/recipes-core/busybox/busybox-1.21.1/su-usr-bin.patch new file +26 -0
new file mode 100644
index 0000000..0d5b558
@@ -0,0 +1,26 @@
+busybox: move /bin/su to /usr/bin/su to match util-linux and shadow
+
+Both of util-linux and shadow have su binary in /usr/bin, fix busybox
+to use the same path so they can be properly tracked by alternatives.
+
+Upstream-Status: Inappropriate [embedded]
+Signed-off-by: Hongxu Jia <[email protected]>
+---
+ include/applets.src.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/applets.src.h b/include/applets.src.h
+--- a/include/applets.src.h
++++ b/include/applets.src.h
+@@ -349,7 +349,7 @@ IF_STAT(APPLET(stat, BB_DIR_USR_BIN, BB_SUID_DROP))
+ IF_STRINGS(APPLET(strings, BB_DIR_USR_BIN, BB_SUID_DROP))
+ IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
+ /* Needs to be run by root or be suid root - needs to change uid and gid: */
+-IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE))
++IF_SU(APPLET(su, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
+ IF_SULOGIN(APPLET(sulogin, BB_DIR_SBIN, BB_SUID_DROP))
+ IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
+ IF_SV(APPLET(sv, BB_DIR_USR_BIN, BB_SUID_DROP))
+-- 
+1.8.1.2
+
meta/recipes-core/busybox/busybox_1.21.1.bb +1 -0
index d702f7e..fdb1974 100644
@@ -22,6 +22,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://umount.busybox \
            file://defconfig \
            file://stat-usr-bin.patch \
+           file://su-usr-bin.patch \
            file://busybox-syslog.service.in \
            file://busybox-klogd.service.in \
            file://testsuite-du-du-k-works-fix-false-positive.patch \
Signature · 1 line
1.8.1.2