[Bug 310474] add a 'root' sanity check to gar.conf.mk



If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=310474

  GARNOME | general | Ver: unspecified




------- Comment #3 from Karsten Br�elmann  2007-10-12 21:12 UTC -------
OK, finally tried implementing this. Turns out it isn't as easy as one would
think... Couple notes and discussion:


It's actually irrelevant which one is used, gar.mk or gar.gnome.mk. I do agree
however, that we do not need another variable. If, for some really strange
reason, a users needs to build as root, he can comment out a single line just
as wekk as set a variable. :)

Some code like this would do. Since it is not a target, it will be evaluated
when reading in the file, and crap out immediately. Regardless, if a target has
been completed before (running as user).

  UID ?= $(shell id -u )

  ifeq (${UID}, 0)
    $(error Cowardly refusing to run with superuser privileges)
  endif

'make' doesn't make it easy to confront the user with a meaningful, unambiguous
and eye-cathing error message. Anyway, figured out how to do that, so the error
message won't get lost in a bunch of 'make' chatter.


There is one tiny downside to this approach, though. Recursive 'make'.

Placing the root sanity check in gar.mk (or gar.gnome.mk) will be evaluated for
each garball. When buidling desktop/ for example (as per the README), this will
result in a single test and immediately crapping out for good -- IFF paranoid-
is being used.

This is due to how the top-level Makefile and the ones in each meta-garball are
calling 'make' recursively for it's contents. Now, the downside when attempting
to build desktop/ with a plain 'install' target as root is, that *each*
desktop/ garball will stop immedietaly with the exact same error message. Since
it is the same with this target and any other general problem, I believe we can
live with that.

(However, there is a possible solution: Including a dedicated sanity check file
from exactly tree top-level files -- gar.mk, category.mk and Makefile. This
just needs to be guarded by an ifndef and defining a variable to prevent
including and evaluating this multiple times, similar to C header includes.
Probably not worth the effort, though.)


Comments? Thoughts?


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=310474.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]