public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* host : make install fail if not root
@ 2009-09-25 18:28 Paul Chavent
  2009-09-28 20:00 ` Bart Veer
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Chavent @ 2009-09-25 18:28 UTC (permalink / raw)
  To: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

Hi.

If i do the sequence "./configure make make install" for host side tools, and if i'am not root, the install fail.

I think we should not need to be root for succedd the install.

So i suggest this patch.

I'am not sure it is the good solution.

Regards.

[-- Attachment #2: ecos-host_root_uid.patch --]
[-- Type: text/plain, Size: 4126 bytes --]

Index: packages/devs/eth/synth/ecosynth/current/host/Makefile.am
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/synth/ecosynth/current/host/Makefile.am,v
retrieving revision 1.4
diff -u -5 -r1.4 Makefile.am
--- packages/devs/eth/synth/ecosynth/current/host/Makefile.am	29 Jan 2009 17:48:16 -0000	1.4
+++ packages/devs/eth/synth/ecosynth/current/host/Makefile.am	25 Sep 2009 18:10:53 -0000
@@ -80,12 +80,12 @@
 rawether.$(OBJEXT)	: Makefile ../src/protocol.h
 
 ## The rawether program needs to run with root privileges, or it will
 ## be unable to access the ethernet hardware.
 install-data-hook:
-	chown root $(etherdir)/rawether
-	chmod u+s $(etherdir)/rawether
+	if [ `id -u` = 0 ] ; then chown root $(etherdir)/rawether ; fi
+	if [ `id -u` = 0 ] ; then chmod u+s $(etherdir)/rawether  ; fi
 
 else
 ## When automake scans for hooks it does not take conditionals fully
 ## into account. If the conditional is not satisfied the generated
 ## makefile will still try to invoke the hook, so dummy hooks are needed.
Index: packages/devs/eth/synth/ecosynth/current/host/Makefile.in
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/eth/synth/ecosynth/current/host/Makefile.in,v
retrieving revision 1.6
diff -u -5 -r1.6 Makefile.in
--- packages/devs/eth/synth/ecosynth/current/host/Makefile.in	23 Aug 2009 13:07:45 -0000	1.6
+++ packages/devs/eth/synth/ecosynth/current/host/Makefile.in	25 Sep 2009 18:10:53 -0000
@@ -708,12 +708,12 @@
 
 
 @SUPPORTED_TRUE@rawether.$(OBJEXT)	: Makefile ../src/protocol.h
 
 @SUPPORTED_TRUE@install-data-hook:
-@SUPPORTED_TRUE@	chown root $(etherdir)/rawether
-@SUPPORTED_TRUE@	chmod u+s $(etherdir)/rawether
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chown root $(etherdir)/rawether ; fi
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chmod u+s $(etherdir)/rawether  ; fi
 
 @SUPPORTED_FALSE@install-data-hook:
 @SUPPORTED_FALSE@	echo Nothing to be done for this platform
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
Index: packages/io/usb/slave/current/host/Makefile.am
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/usb/slave/current/host/Makefile.am,v
retrieving revision 1.5
diff -u -5 -r1.5 Makefile.am
--- packages/io/usb/slave/current/host/Makefile.am	29 Jan 2009 17:49:49 -0000	1.5
+++ packages/io/usb/slave/current/host/Makefile.am	25 Sep 2009 18:11:03 -0000
@@ -95,12 +95,12 @@
 	$(INSTALL_PROGRAM) usbhost $(bindir)/usbhost_@PACKAGE_VERSION@
 	rm -f $(bindir)/usbhost
 	$(LN_S) $(bindir)/usbhost_@PACKAGE_VERSION@ $(bindir)/usbhost
 
 install-data-hook:
-	chown root $(usbauxdir)/usbchmod
-	chmod u+s $(usbauxdir)/usbchmod
+	if [ `id -u` = 0 ] ; then chown root $(usbauxdir)/usbchmod ; fi
+	if [ `id -u` = 0 ] ; then chmod u+s $(usbauxdir)/usbchmod  ; fi
 
 else
 
 ## When automake scans for hooks it does not take conditionals fully
 ## into account. If the conditional is not satisfied the generated
Index: packages/io/usb/slave/current/host/Makefile.in
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/usb/slave/current/host/Makefile.in,v
retrieving revision 1.6
diff -u -5 -r1.6 Makefile.in
--- packages/io/usb/slave/current/host/Makefile.in	18 Aug 2008 13:34:29 -0000	1.6
+++ packages/io/usb/slave/current/host/Makefile.in	25 Sep 2009 18:11:03 -0000
@@ -658,12 +658,12 @@
 @SUPPORTED_TRUE@	$(INSTALL_PROGRAM) usbhost $(bindir)/usbhost_@PACKAGE_VERSION@
 @SUPPORTED_TRUE@	rm -f $(bindir)/usbhost
 @SUPPORTED_TRUE@	$(LN_S) $(bindir)/usbhost_@PACKAGE_VERSION@ $(bindir)/usbhost
 
 @SUPPORTED_TRUE@install-data-hook:
-@SUPPORTED_TRUE@	chown root $(usbauxdir)/usbchmod
-@SUPPORTED_TRUE@	chmod u+s $(usbauxdir)/usbchmod
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chown root $(usbauxdir)/usbchmod ; fi
+@SUPPORTED_TRUE@	if [ `id -u` = 0 ] ; then chmod u+s $(usbauxdir)/usbchmod  ; fi
 
 @SUPPORTED_FALSE@install-exec-hook:
 @SUPPORTED_FALSE@	echo Nothing to be done for this platform
 
 @SUPPORTED_FALSE@install-data-hook:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: host : make install fail if not root
  2009-09-25 18:28 host : make install fail if not root Paul Chavent
@ 2009-09-28 20:00 ` Bart Veer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Veer @ 2009-09-28 20:00 UTC (permalink / raw)
  To: Paul Chavent; +Cc: ecos-patches

>>>>> "Paul" == Paul Chavent <paul.chavent@fnac.net> writes:

    Paul> If i do the sequence "./configure make make install" for
    Paul> host side tools, and if i'am not root, the install fail.

    Paul> I think we should not need to be root for succedd the
    Paul> install.

    Paul> So i suggest this patch.

    Paul> I'am not sure it is the good solution.

There is no good solution. Install failures when not running as root
may confuse some users. However if e.g. rawether is not installed suid
root then the synthetic target's ethernet driver will fail to work,
and that will also confuse some users.

Possibly the most appropriate solution would involve something like:

1) if installing as root, just do the chmod's as per the current
   Makefile.am rules.

2) if installing without root privileges, skip the chmod's but output
   a message warning that the install is incomplete. That is better
   than silently producing an install that won't work. However many
   users will ignore any such warnings, so we also need:

3) both rawether and usbchmod should detect whether or not they are
   running with appropriate privileges and, if not, output very clear
   messages about the problem and what should be done to fix it. They
   may already do so, I don't remember.

A patch along those lines should be acceptable. However it would also
likely be big enough to require a copyright assignment, see
http://ecos.sourceware.org/contrib.html

Bart
    
-- 
Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
       >>>> Visit us at ESC-UK  http://www.embedded.co.uk <<<<
       >>>> Oct 7-8 on Stand 433 at FIVE ISC, Farnborough <<<<

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-28 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-25 18:28 host : make install fail if not root Paul Chavent
2009-09-28 20:00 ` Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).