From patchwork Thu Jun 21 08:45:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Dawson X-Patchwork-Id: 166256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 4193CB6FAC for ; Thu, 21 Jun 2012 18:45:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5B5D789991; Thu, 21 Jun 2012 08:45:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ySoz5B6MVUII; Thu, 21 Jun 2012 08:45:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id D9CA88C7EA; Thu, 21 Jun 2012 08:45:18 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 36DD58F791 for ; Thu, 21 Jun 2012 08:45:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 261408C89C for ; Thu, 21 Jun 2012 08:45:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HxwWOF6fNVlJ for ; Thu, 21 Jun 2012 08:45:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id DFE6689991 for ; Thu, 21 Jun 2012 08:45:11 +0000 (UTC) Received: by eeke50 with SMTP id e50so157808eek.16 for ; Thu, 21 Jun 2012 01:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=ScWnFa92R3+S3nHrAfbBcwqdCaUOEgKlf5pDFwDam7U=; b=YN0Z94J4scUoy317SCl9cf1QyS9VjSRdjGin3ENY0xnkRPTKsfdJ/nMitoeTuhBi2a BXYdNXfuZyTSHjUBSdoH7wDohCKdpZn38z/t/tCwt5/91YwmKB1mspxbQM8YTlTFzxrP w/3cEh2SJm0aimeTrF5J7gM0xy+s7N2zX6t35TphPj7C3LtSTLlQ/OhzMCQhZOBMKwce WW/0/ux6AtxOW6hGOcr7PH6/owS4ztHjVBfitnyCy3h2arOs95smUMSlZquamrV8pnoK Yq6hQx5PAx4R/WaPUqIP7lriOJw2IEMumvbqDSSNfHBlPTSedIiXpAA8lsuTm1/Zkt9c +HgA== Received: by 10.14.29.11 with SMTP id h11mr5847210eea.170.1340268308840; Thu, 21 Jun 2012 01:45:08 -0700 (PDT) Received: from percy.train.local ([213.170.149.177]) by mx.google.com with ESMTPS id o16sm100397298eeb.13.2012.06.21.01.45.06 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 01:45:07 -0700 (PDT) From: spdawson@gmail.com To: buildroot@busybox.net Date: Thu, 21 Jun 2012 09:45:04 +0100 Message-Id: <1340268304-26103-1-git-send-email-spdawson@gmail.com> X-Mailer: git-send-email 1.7.9.5 Subject: [Buildroot] [PATCH] sudo: fix install X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Simon Dawson Running sudo on the target fails with the following errors. sudo: /usr/libexec/sudoers.so: No such file or directory sudo: fatal error, unable to load plugins The problem is that the installation of the sudo package is broken. This patch replaces the hand-crafted install rule with the default AUTOTARGETS install. Unfortunately, the default install fails because it includes a step that invokes the cross-compiled visudo binary. A patch is provided here to disable this visudo invocation, which is for sanity checking only. This local patch is a backport of upstream commit 8209:0c4e3f68b2f5; the real fix will be in the 1.8.6 release of sudo. Signed-off-by: Simon Dawson Acked-by: Arnout Vandecappelle (Essensium/Mind) --- ...rt-commit-8209:0c4e3f68b2f5-from-upstream.patch | 263 ++++++++++++++++++++ package/sudo/sudo.mk | 8 - 2 files changed, 263 insertions(+), 8 deletions(-) create mode 100644 package/sudo/sudo-1.8.5p1-backport-commit-8209:0c4e3f68b2f5-from-upstream.patch diff --git a/package/sudo/sudo-1.8.5p1-backport-commit-8209:0c4e3f68b2f5-from-upstream.patch b/package/sudo/sudo-1.8.5p1-backport-commit-8209:0c4e3f68b2f5-from-upstream.patch new file mode 100644 index 0000000..69512b0 --- /dev/null +++ b/package/sudo/sudo-1.8.5p1-backport-commit-8209:0c4e3f68b2f5-from-upstream.patch @@ -0,0 +1,263 @@ +The installation of the sudoers plugin fails when cross compiling, because it +tries to run the cross-compiled visudo, rather than that of the host. + +The visudo invocation is only required in order to sanity check any existing +sudoers file in the target directory; this can safely be dispensed with. + +This is a backport of commit 8209:0c4e3f68b2f5 from upstream. + +N.B. The upstream fix will appear in sudo 1.8.6; when the Buildroot package +is bumped to version 1.8.6 (or higher), then this patch will no longer be +required. + +Signed-off-by: Simon Dawson +diff -Nurp a/common/Makefile.in b/common/Makefile.in +--- a/common/Makefile.in 2012-05-15 17:22:01.000000000 +0100 ++++ b/common/Makefile.in 2012-06-21 08:55:57.345169676 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Where to install things... + prefix = @prefix@ +diff -Nurp a/compat/Makefile.in b/compat/Makefile.in +--- a/compat/Makefile.in 2012-05-15 17:22:01.000000000 +0100 ++++ b/compat/Makefile.in 2012-06-21 08:57:09.097166477 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Where to install things... + prefix = @prefix@ +@@ -111,19 +112,21 @@ install-plugin: + uninstall: + + check: $(TEST_PROGS) +- @if [ -f fnm_test ]; then \ +- ./fnm_test $(srcdir)/regress/fnmatch/fnm_test.in; \ +- fi +- @if [ -f globtest ]; then \ +- mkdir -p `sed 's@/[^/]*$$@@' $(srcdir)/regress/glob/files | sort -u`; \ +- touch `cat $(srcdir)/regress/glob/files`; \ +- chmod 0755 `grep '/r[^/]*$$' $(srcdir)/regress/glob/files`; \ +- chmod 0444 `grep '/s[^/]*$$' $(srcdir)/regress/glob/files`; \ +- chmod 0711 `grep '/t[^/]*$$' $(srcdir)/regress/glob/files`; \ +- ./globtest $(srcdir)/regress/glob/globtest.in; \ +- rval=$$?; \ +- rm -rf fake; \ +- exit $$rval; \ ++ @if test X"$(cross_compiling)" != X"yes"; then \ ++ if test -f fnm_test; then \ ++ ./fnm_test $(srcdir)/regress/fnmatch/fnm_test.in; \ ++ fi; \ ++ if test -f globtest; then \ ++ mkdir -p `sed 's@/[^/]*$$@@' $(srcdir)/regress/glob/files | sort -u`; \ ++ touch `cat $(srcdir)/regress/glob/files`; \ ++ chmod 0755 `grep '/r[^/]*$$' $(srcdir)/regress/glob/files`; \ ++ chmod 0444 `grep '/s[^/]*$$' $(srcdir)/regress/glob/files`; \ ++ chmod 0711 `grep '/t[^/]*$$' $(srcdir)/regress/glob/files`; \ ++ ./globtest $(srcdir)/regress/glob/globtest.in; \ ++ rval=$$?; \ ++ rm -rf fake; \ ++ exit $$rval; \ ++ fi; \ + fi + + clean: +diff -Nurp a/configure b/configure +--- a/configure 2012-05-17 20:53:53.000000000 +0100 ++++ b/configure 2012-06-21 08:58:08.769163817 +0100 +@@ -691,6 +691,7 @@ password_timeout + timeout + timedir + iolog_dir ++CROSS_COMPILING + COMPAT_TEST_PROGS + SUDO_NLS + LIBINTL +@@ -2874,6 +2875,7 @@ $as_echo "$as_me: Configuring Sudo versi + + + ++ + # + # Begin initial values for man page substitution + # +@@ -20094,6 +20096,8 @@ if test -n "$GCC"; then + fi + fi + ++CROSS_COMPILING="$cross_compiling" ++ + test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' + + if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then +diff -Nurp a/configure.in b/configure.in +--- a/configure.in 2012-05-17 20:53:54.000000000 +0100 ++++ b/configure.in 2012-06-21 08:58:51.017161934 +0100 +@@ -67,6 +67,7 @@ AC_SUBST([LT_STATIC]) + AC_SUBST([LIBINTL]) + AC_SUBST([SUDO_NLS]) + AC_SUBST([COMPAT_TEST_PROGS]) ++AC_SUBST([CROSS_COMPILING]) + dnl + dnl Variables that get substituted in docs (not overridden by environment) + dnl +@@ -3198,6 +3199,11 @@ if test -n "$GCC"; then + fi + + dnl ++dnl Skip regress tests and sudoers sanity check if cross compiling. ++dnl ++CROSS_COMPILING="$cross_compiling" ++ ++dnl + dnl Set exec_prefix + dnl + test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)' +diff -Nurp a/doc/Makefile.in b/doc/Makefile.in +--- a/doc/Makefile.in 2012-03-12 18:02:07.000000000 +0000 ++++ b/doc/Makefile.in 2012-06-21 08:59:06.537161242 +0100 +@@ -23,6 +23,7 @@ srcdir = @srcdir@ + docdir = @docdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ ++cross_compiling = @CROSS_COMPILING@ + + # Tools to use + NROFF = @NROFFPROG@ +diff -Nurp a/plugins/sample/Makefile.in b/plugins/sample/Makefile.in +--- a/plugins/sample/Makefile.in 2012-03-12 18:02:09.000000000 +0000 ++++ b/plugins/sample/Makefile.in 2012-06-21 08:59:24.397160445 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ +diff -Nurp a/plugins/sample_group/Makefile.in b/plugins/sample_group/Makefile.in +--- a/plugins/sample_group/Makefile.in 2012-05-15 17:22:02.000000000 +0100 ++++ b/plugins/sample_group/Makefile.in 2012-06-21 08:59:38.641159810 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ +diff -Nurp a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in +--- a/plugins/sudoers/Makefile.in 2012-05-15 17:22:02.000000000 +0100 ++++ b/plugins/sudoers/Makefile.in 2012-06-21 09:32:26.165072089 +0100 +@@ -32,6 +32,7 @@ top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include + docdir = @docdir@ + timedir = @timedir@ ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ +@@ -237,7 +238,7 @@ sudoers: $(srcdir)/sudoers.in + (cd $(top_builddir) && $(SHELL) config.status --file=plugins/sudoers/$@) + + pre-install: +- @if test -r $(DESTDIR)$(sudoersdir)/sudoers; then \ ++ @if test X"$(cross_compiling)" != X"yes" -a -r $(DESTDIR)$(sudoersdir)/sudoers; then \ + echo "Checking existing sudoers file for syntax errors."; \ + ./visudo -c -f $(DESTDIR)$(sudoersdir)/sudoers; \ + fi +@@ -280,17 +281,23 @@ uninstall: + rm -f $(DESTDIR)$(sudoersdir)/sudoers + + check: $(TEST_PROGS) visudo testsudoers +- @-rval=0; \ +- ./check_addr $(srcdir)/regress/parser/check_addr.in; \ ++ @-if test X"$(cross_compiling)" != X"yes"; then \ ++ rval=0; \ ++ PWD=`pwd`; \ ++ ./check_addr $(srcdir)/regress/parser/check_addr.in; \ + rval=`expr $$rval + $$?`; \ +- ./check_fill; \ +- rval=`expr $$rval + $$?`; \ +- ./check_iolog_path $(srcdir)/regress/iolog_path/data; \ +- rval=`expr $$rval + $$?`; \ +- ./check_wrap $(srcdir)/regress/logging/check_wrap.in > check_wrap.out; \ +- diff check_wrap.out $(srcdir)/regress/logging/check_wrap.out.ok; \ +- rval=`expr $$rval + $$?`; \ +- passed=0; failed=0; total=0; \ ++ ./check_fill; \ ++ rval=`expr $$rval + $$?`; \ ++ ./check_iolog_path $(srcdir)/regress/iolog_path/data; \ ++ rval=`expr $$rval + $$?`; \ ++ if [ X"$(soext)" != X"" ]; then \ ++ ./check_symbols .libs/sudoers$(soext) $(shlib_exp); \ ++ rval=`expr $$rval + $$?`; \ ++ fi; \ ++ ./check_wrap $(srcdir)/regress/logging/check_wrap.in > check_wrap.out; \ ++ diff check_wrap.out $(srcdir)/regress/logging/check_wrap.out.ok; \ ++ rval=`expr $$rval + $$?`; \ ++ passed=0; failed=0; total=0; \ + for t in $(srcdir)/regress/sudoers/*.in; do \ + dir=`dirname $$t`; \ + dirbase=`basename $$dir`; \ +@@ -318,8 +325,8 @@ check: $(TEST_PROGS) visudo testsudoers + total=`expr $$total + 1`; \ + done; \ + echo "$$dirbase: $$passed/$$total tests passed; $$failed/$$total tests failed"; \ +- rval=`expr $$rval + $$failed`; \ +- passed=0; failed=0; total=0; \ ++ rval=`expr $$rval + $$failed`; \ ++ passed=0; failed=0; total=0; \ + for t in $(srcdir)/regress/*/*.sh; do \ + dir=`dirname $$t`; \ + dirbase=`basename $$dir`; \ +@@ -351,7 +358,9 @@ check: $(TEST_PROGS) visudo testsudoers + fi; \ + done; \ + echo "$$dirbase: $$passed/$$total tests passed; $$failed/$$total tests failed"; \ +- rval=`expr $$rval + $$failed`; exit $$rval ++ rval=`expr $$rval + $$failed`; \ ++ exit $$rval; \ ++ fi + + clean: + -$(LIBTOOL) --mode=clean rm -f $(PROGS) $(TEST_PROGS) *.lo *.o *.la *.a stamp-* core *.core core.* *.out *.toke *.err +diff -Nurp a/plugins/system_group/Makefile.in b/plugins/system_group/Makefile.in +--- a/plugins/system_group/Makefile.in 2012-05-15 17:22:03.000000000 +0100 ++++ b/plugins/system_group/Makefile.in 2012-06-21 09:32:38.361071545 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ +diff -Nurp a/src/Makefile.in b/src/Makefile.in +--- a/src/Makefile.in 2012-05-08 21:56:43.000000000 +0100 ++++ b/src/Makefile.in 2012-06-21 09:32:53.233070882 +0100 +@@ -24,6 +24,7 @@ devdir = @devdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + incdir = $(top_srcdir)/include ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ +diff -Nurp a/zlib/Makefile.in b/zlib/Makefile.in +--- a/zlib/Makefile.in 2012-03-12 18:02:17.000000000 +0000 ++++ b/zlib/Makefile.in 2012-06-21 09:33:03.417070428 +0100 +@@ -22,6 +22,7 @@ + srcdir = @srcdir@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ ++cross_compiling = @CROSS_COMPILING@ + + # Compiler & tools to use + CC = @CC@ diff --git a/package/sudo/sudo.mk b/package/sudo/sudo.mk index 3629ad1..f1efc54 100644 --- a/package/sudo/sudo.mk +++ b/package/sudo/sudo.mk @@ -14,12 +14,4 @@ SUDO_CONF_OPT = \ --without-interfaces \ --without-pam -define SUDO_INSTALL_TARGET_CMDS - install -m 4555 -D $(@D)/src/sudo $(TARGET_DIR)/usr/bin/sudo - install -m 0555 -D $(@D)/plugins/sudoers/visudo \ - $(TARGET_DIR)/usr/sbin/visudo - install -m 0440 -D $(@D)/plugins/sudoers/sudoers \ - $(TARGET_DIR)/etc/sudoers -endef - $(eval $(call AUTOTARGETS))