From: Eric Blake Date: Fri, 30 Jul 2010 23:29:43 +0000 (-0600) Subject: mknod: be more vocal about danger of running tests as root X-Git-Tag: v0.1~3947 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=5c53ef81164bc0e488ad7a87f0d10dbb7e6bee98;p=gnulib.git mknod: be more vocal about danger of running tests as root * m4/mknod.m4 (gl_FUNC_MKNOD): Make it harder to run configure as root, since that is just asking for problems. Suggested by Bruno Haible, based on a report by Rainer Tammer. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 2e7143829..e1a70c8b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-08-09 Eric Blake + mknod: be more vocal about danger of running tests as root + * m4/mknod.m4 (gl_FUNC_MKNOD): Make it harder to run configure as + root, since that is just asking for problems. + Suggested by Bruno Haible, based on a report by Rainer Tammer. + readlinkat: split into its own module * modules/symlinkat: Split readlinkat... * modules/readlinkat: ...into separate module. diff --git a/m4/mknod.m4 b/m4/mknod.m4 index 4d9214d04..c13644b84 100644 --- a/m4/mknod.m4 +++ b/m4/mknod.m4 @@ -1,4 +1,4 @@ -# serial 1 +# serial 2 # See if we need to provide mknod replacement. dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. @@ -27,9 +27,14 @@ AC_DEFUN([gl_FUNC_MKNOD], #include ]], [[/* Indeterminate for super-user, assume no. Why are you running configure as root, anyway? */ - if (!geteuid ()) return 1; + if (!geteuid ()) return 99; if (mknod ("conftest.fifo", S_IFIFO | 0600, 0)) return 2;]])], - [gl_cv_func_mknod_works=yes], [gl_cv_func_mknod_works=no], + [gl_cv_func_mknod_works=yes], + [if test $? == 99 && test x"$FORCE_UNSAFE_CONFIGURE" = x; then + AC_MSG_FAILURE([you should not run configure as root ]dnl +[(set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)]) + fi + gl_cv_func_mknod_works=no], [gl_cv_func_mknod_works="guessing no"]) rm -f conftest.fifo]) if test "$gl_cv_func_mknod_works" != yes; then