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`.
This commit is contained in:
parent
5d008dc37b
commit
d640bf899a
1 changed files with 15 additions and 0 deletions
|
@ -153,6 +153,21 @@ def _do_patch_config_guess(self):
|
||||||
|
|
||||||
raise RuntimeError('Failed to find suitable config.guess')
|
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')
|
@run_after('configure')
|
||||||
def _do_patch_libtool(self):
|
def _do_patch_libtool(self):
|
||||||
"""If configure generates a "libtool" script that does not correctly
|
"""If configure generates a "libtool" script that does not correctly
|
||||||
|
|
Loading…
Reference in a new issue