Skip to contentSkip to conversation

sudo: fix install

PATCH New spdawson at gmail.com 2 participants 4 messages Jun 19, 2012 – Jun 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sudo: fix install

From: Simon Dawson <[email protected]>

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.

---
 package/sudo/sudo-fix-sudoers-plugin-install.patch |   19 +++++++++++++++++++
 package/sudo/sudo.mk                               |    8 --------
 2 files changed, 19 insertions(+), 8 deletions(-)
 create mode 100644 package/sudo/sudo-fix-sudoers-plugin-install.patch
package/sudo/sudo-fix-sudoers-plugin-install.patch new file +19 -0
new file mode 100644
index 0000000..e85e5d8
@@ -0,0 +1,19 @@
+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.
+
+Signed-off-by: Simon Dawson <[email protected]>
+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-19 11:24:00.322449438 +0100
+@@ -239,7 +239,7 @@ sudoers: $(srcdir)/sudoers.in
+ pre-install:
+ 	@if test -r $(DESTDIR)$(sudoersdir)/sudoers; then \
+ 	    echo "Checking existing sudoers file for syntax errors."; \
+-	    ./visudo -c -f $(DESTDIR)$(sudoersdir)/sudoers; \
++	    (echo "SKIPPED" || ./visudo -c -f $(DESTDIR)$(sudoersdir)/sudoers); \
+ 	fi
+ 
+ install: install-plugin install-binaries install-sudoers install-doc
package/sudo/sudo.mk +0 -8
index 3629ad1..f1efc54 100644
@@ -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))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 sudo: fix install

Hello,

Le Tue, 19 Jun 2012 11:35:53 +0100,
spdawson at gmail.com a ?crit :

Quoted 15 lines
package/sudo/sudo-fix-sudoers-plugin-install.patch new file +9 -0
new file mode 100644
index 0000000..e85e5d8
@@ -0,0 +1,19 @@
+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.
+
+Signed-off-by: Simon Dawson <[email protected]>
+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

package/sudo/sudo-fix-sudoers-plugin-install.patch line 19

Quoted 10 lines
package/sudo/sudo-fix-sudoers-plugin-install.patch new file +10 -0
++++ b/plugins/sudoers/Makefile.in	2012-06-19 11:24:00.322449438 +0100
+@@ -239,7 +239,7 @@ sudoers: $(srcdir)/sudoers.in
+ pre-install:
+ 	@if test -r $(DESTDIR)$(sudoersdir)/sudoers; then \
+ 	    echo "Checking existing sudoers file for syntax errors."; \
+-	    ./visudo -c -f $(DESTDIR)$(sudoersdir)/sudoers; \
++	    (echo "SKIPPED" || ./visudo -c -f $(DESTDIR)$(sudoersdir)/sudoers); \
+ 	fi
+ 
+ install: install-plugin install-binaries install-sudoers install-doc

Do you think you can turn this into a patch that can be submitted upstream? I.e, if autoconf has detected that we're cross-compiling, skip this install check?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 sudo: fix install

Quoted 3 lines

Do you think you can turn this into a patch that can be submitted upstream? I.e, if autoconf has detected that we're cross-compiling, skip this install check?

I've submitted a bug report to the sudo Bugzilla:

http://www.gratisoft.us/bugzilla/show_bug.cgi?id=560

To be honest, my knowledge of autoconf/automake is not sufficient to be able to fix this properly; specifically, I don't know how or if the cross-compile can be detected in the Makefiles. If someone can point me in the right direction I'm quite happy to send a patch upstream...

#3 lore raw

PATCH 1/1 sudo: fix install

Quoted 3 lines

I've submitted a bug report to the sudo Bugzilla:

?http://www.gratisoft.us/bugzilla/show_bug.cgi?id=560

The bug has now been fixed upstream (not by me) in commit 8209:0c4e3f68b2f5

Unfortunately, the fix will not appear until sudo 1.8.6 is released, so we've still got a broken sudo package in Buildroot. I'm going to submit an updated patch that backports the upstream fix, as an interim solution until the release of sudo 1.8.6.