[yocto] [PATCH meta-gplv2 1/2] coreutils: don't build su

Ross Burton ross.burton at intel.com
Tue Aug 14 04:50:44 PDT 2018


Previously we built su but didn't package it because util-linux is the preferred
provider.  However with glibc 2.28 libcrypt has been removed so su doesn't
build.  Instead of depending on virtual/crypt, lets just not build su at all.

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 recipes-core/coreutils/coreutils-6.9/no-su.patch | 56 ++++++++++++++++++++++++
 recipes-core/coreutils/coreutils_6.9.bb          |  5 +--
 2 files changed, 57 insertions(+), 4 deletions(-)
 create mode 100644 recipes-core/coreutils/coreutils-6.9/no-su.patch

diff --git a/recipes-core/coreutils/coreutils-6.9/no-su.patch b/recipes-core/coreutils/coreutils-6.9/no-su.patch
new file mode 100644
index 0000000..47339e5
--- /dev/null
+++ b/recipes-core/coreutils/coreutils-6.9/no-su.patch
@@ -0,0 +1,56 @@
+Newer versions of su don't provide su as util-linux is the preferred provider,
+so don't build it.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <ross.burton at intel.com>
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 863a32b5a..28c060898 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -16,7 +16,7 @@
+ ## along with this program; if not, write to the Free Software Foundation,
+ ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ 
+-EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who
++EXTRA_PROGRAMS = chroot df hostid nice pinky stty uname uptime users who
+ 
+ bin_SCRIPTS = groups
+ bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \
+@@ -131,8 +131,6 @@ RELEASE_YEAR = \
+ 	chmod +x $@-t
+ 	mv $@-t $@
+ 
+-all-local: su$(EXEEXT)
+-
+ installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
+ 
+ setuid_root_mode = a=rx,u+s
+@@ -146,27 +144,6 @@ INSTALL_SU = \
+   echo " chmod $(setuid_root_mode) $(installed_su)"; \
+   chmod $(setuid_root_mode) $(installed_su)
+ 
+-install-root: su$(EXEEXT)
+-	@$(INSTALL_SU)
+-
+-install-exec-local: su$(EXEEXT)
+-	@TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \
+-	rm -f $$TMPFILE; \
+-	echo > $$TMPFILE; \
+-## See if we can create a setuid root executable in $(bindir).
+-## If not, then don't even try to install su.
+-	can_create_suid_root_executable=no; \
+-	chown root $$TMPFILE > /dev/null 2>&1 \
+-	  && chmod $(setuid_root_mode) $$TMPFILE > /dev/null 2>&1 \
+-	  && can_create_suid_root_executable=yes; \
+-	rm -f $$TMPFILE; \
+-	if test $$can_create_suid_root_executable = yes; then \
+-	  $(INSTALL_SU); \
+-	else \
+-	  echo "WARNING: insufficient access; not installing su"; \
+-	  echo "NOTE: to install su, run 'make install-root' as root"; \
+-	fi
+-
+ uninstall-local:
+ # Remove su only if it's one we installed.
+ 	@if grep '$(GNU_PACKAGE)' $(installed_su) > /dev/null 2>&1; then \
diff --git a/recipes-core/coreutils/coreutils_6.9.bb b/recipes-core/coreutils/coreutils_6.9.bb
index 0d236b2..ae941fd 100644
--- a/recipes-core/coreutils/coreutils_6.9.bb
+++ b/recipes-core/coreutils/coreutils_6.9.bb
@@ -28,6 +28,7 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
            file://loadavg.patch \
            file://no-man.patch \
            file://build-don-t-need-charset.alias-when-building-for-mus.patch \
+           file://no-su.patch \
            "
 
 SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
@@ -78,10 +79,6 @@ do_install() {
 	# in update-alternatives to fail, therefore use lbracket - the name used
 	# for the actual source file.
 	mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
-
-	# Newer versions of coreutils do not include su, to mimic this behavior
-	# we simply remove it.
-	rm -f ${D}${bindir}/su
 }
 
 inherit update-alternatives
-- 
2.11.0



More information about the yocto mailing list