summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDiego Magdaleno <38844659+DiegoMagdaleno@users.noreply.github.com>2020-04-18 16:25:19 -0500
committerGitHub <noreply@github.com>2020-04-18 14:25:19 -0700
commitd640bf899a36d5e82de823c1fb46f2e2c7a4a6bc (patch)
treedfe04d9334f46e9daf43a86db18ee8bae344c061 /lib
parent5d008dc37b07b2d4bf27d8f1041d54f344d70a22 (diff)
downloadspack-d640bf899a36d5e82de823c1fb46f2e2c7a4a6bc.tar.gz
spack-d640bf899a36d5e82de823c1fb46f2e2c7a4a6bc.tar.bz2
spack-d640bf899a36d5e82de823c1fb46f2e2c7a4a6bc.tar.xz
spack-d640bf899a36d5e82de823c1fb46f2e2c7a4a6bc.zip
autotools: set FORCE_UNSAFE_CONFIGURE to 1 in autotools.py (#16132)
This commit sets the `FORCE_UNSAFE_CONFIGURE` environment variable to 1 in autotools builds. We see a lot of builds popping up and complaining about `FORCE_UNSAFE_CONFIGURE`. This behavior is not actually part of `autoconf` per se. It comes from this patch to `mknod.m4`, which is used by a lot of autoconf builds: * https://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00282.html Which originated from this problem that someone had on AIX: * https://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00279.html The gist of the problem seems to be that they want to check whether `mknod` can do something as root, but instead of checking whether they're running as root and using `su` or something to test this, they just made it harder to run `configure` as root. This seems very ad hoc and this is one of many checks that are run as root in `configure`. Many of them run before this check, so it's not clear that the `FORCE_UNSAFE_CONFIGURE` thing is even preventing bad things from happening. So: 1. This only happens in `autotools` builds, so we should go ahead and put it into `autotools.py` instead of in the global build environment, and 2. The variable does too little and provides a false sense of security in the first place, so we'll just disable it and avoid the nuisance. If we really feel strongly about this we can put some warnings in Spack about running as root, but at the top level, not in the middle of an already running script like `configure`.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/autotools.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py
index df17d2ddf1..6fc77bee6a 100644
--- a/lib/spack/spack/build_systems/autotools.py
+++ b/lib/spack/spack/build_systems/autotools.py
@@ -153,6 +153,21 @@ class AutotoolsPackage(PackageBase):
raise RuntimeError('Failed to find suitable config.guess')
+ @run_before('configure')
+ def _set_autotools_environment_varoables(self):
+ """Many autotools builds use a version of mknod.m4 that fails when
+ running as root unless FORCE_UNSAFE_CONFIGURE is set to 1.
+
+ We set this to 1 and expect the user to take responsibiltiy if
+ they are running as root. They have to anyway, as this variable
+ doesn't actually prevent configure from doing bad things as root.
+ Without it, configure just fails halfway through, but it can
+ still run things *before* this check. Forcing this just removes a
+ nuisance -- this is not circumventing any real protection.
+
+ """
+ os.environ["FORCE_UNSAFE_CONFIGURE"] = "1"
+
@run_after('configure')
def _do_patch_libtool(self):
"""If configure generates a "libtool" script that does not correctly