Prove that Makefile is fully defined

The whole repository is now buildable with GNU Make Landlock sandboxing.
This proves that no Makefile targets exist which touch files other than
their declared prerequisites. In order to do this, we had to:

  1. Stop code morphing GCC output in package.com and instead run a
     newly introduced FIXUPOBJ.COM command after GCC invocations.

  2. Disable all the crumby Python unit tests that do things like create
     files in the current directory, or rename() files between folders.
     This ended up being a lot of tests, but most of them are still ok.

  3. Introduce an .UNSANDBOXED variable to GNU Make to disable Landlock.
     We currently only do this for things like `make tags`.

  4. This change deletes some GNU Make code that was preventing the
     execve() optimization from working. This means it should no longer
     be necessary in most cases for command invocations to be indirected
     through the cocmd interpreter.

  5. Missing dependencies had to be declared in certain places, in cases
     where they couldn't be automatically determined by MKDEPS.COM

  6. The libcxx header situation has finally been tamed. One of the
     things that makes this difficult is MKDEPS.COM only wants to
     consider the first 64kb of a file, in order to go fast. But libcxx
     likes to have #include lines buried after huge documentation.

  7. An .UNVEIL variable has been introduced to GNU Make just in case
     we ever wish to explicitly specify additional things that need to
     be whitelisted which aren't strictly prerequisites. This works in
     a manner similar to the recently introduced .EXTRA_PREREQS feature.

There's now a new build/bootstrap/make.com prebuilt binary available. It
should no longer be possible to write invalid Makefile code.
This commit is contained in:
Justine Tunney 2022-08-06 03:51:50 -07:00
parent acdf591833
commit cf93ecbbb2
181 changed files with 1902 additions and 1986 deletions

View file

@ -4720,7 +4720,7 @@ def pairs(iterable):
return zip(a, b)
class ZoneInfo(tzinfo):
zoneroot = '/usr/share/zoneinfo'
zoneroot = '/zip/usr/share/zoneinfo'
def __init__(self, ut, ti):
"""

View file

@ -232,6 +232,7 @@ class CmdLineTest(unittest.TestCase):
script_dir, None,
importlib.machinery.SourceFileLoader)
@unittest.skipIf(True, "[jart] Breaks Landlock LSM due to EXDEV")
def test_script_compiled(self):
with support.temp_dir() as script_dir:
script_name = _make_test_script(script_dir, 'script')
@ -249,6 +250,7 @@ class CmdLineTest(unittest.TestCase):
script_dir, '',
importlib.machinery.SourceFileLoader)
@unittest.skipIf(True, "[jart] Breaks Landlock LSM due to EXDEV")
def test_directory_compiled(self):
with support.temp_dir() as script_dir:
script_name = _make_test_script(script_dir, '__main__')
@ -271,6 +273,7 @@ class CmdLineTest(unittest.TestCase):
self._check_script(zip_name, run_name, zip_name, zip_name, '',
zipimport.zipimporter)
@unittest.skipIf(True, "[jart] Breaks Landlock LSM due to EXDEV")
def test_zipfile_compiled(self):
with support.temp_dir() as script_dir:
script_name = _make_test_script(script_dir, '__main__')
@ -279,6 +282,7 @@ class CmdLineTest(unittest.TestCase):
self._check_script(zip_name, run_name, zip_name, zip_name, '',
zipimport.zipimporter)
@unittest.skipIf(True, "[jart] Breaks Landlock LSM due to EXDEV")
def test_zipfile_error(self):
with support.temp_dir() as script_dir:
script_name = _make_test_script(script_dir, 'not_main')
@ -321,6 +325,7 @@ class CmdLineTest(unittest.TestCase):
script_name, script_dir, 'test_pkg',
importlib.machinery.SourceFileLoader)
@unittest.skipIf(True, "[jart] Breaks Landlock LSM due to EXDEV")
def test_package_compiled(self):
with support.temp_dir() as script_dir:
pkg_dir = os.path.join(script_dir, 'test_pkg')

View file

@ -2,6 +2,7 @@
# Contact: email-sig@python.org
# email package unit tests
import os
import re
import sys
import time
@ -4034,7 +4035,7 @@ class Test8BitBytesHandling(TestEmailBase):
non_latin_bin_msg_as7bit = '\n'.join(non_latin_bin_msg_as7bit)
def test_message_from_binary_file(self):
fn = 'test.msg'
fn = os.path.join(os.environ['TMPDIR'], 'test.msg')
self.addCleanup(unlink, fn)
with open(fn, 'wb') as testfile:
testfile.write(self.non_latin_bin_msg)

View file

@ -110,8 +110,8 @@ class LocaltimeTests(unittest.TestCase):
# XXX: Need a more robust test for Olson's tzdata
@unittest.skipIf(sys.platform.startswith(('win','cosmo')),
"Windows does not use Olson's TZ database")
@unittest.skipUnless(os.path.exists('/usr/share/zoneinfo') or
os.path.exists('/usr/lib/zoneinfo'),
@unittest.skipUnless(os.path.exists('/zip/usr/share/zoneinfo') or
os.path.exists('/zip/usr/lib/zoneinfo'),
"Can't find the Olson's TZ database")
@test.support.run_with_tz('Europe/Kiev')
def test_variable_tzname(self):

View file

@ -236,6 +236,7 @@ class AutoFileTests:
else:
self.fail("Should have raised OSError")
@unittest.skipIf(True, "[jart] Breaks Landlock LSM [why??]")
@unittest.skipIf(os.name == 'nt', "test only works on a POSIX-like system")
def testOpenDirFD(self):
fd = os.open('.', os.O_RDONLY)

View file

@ -103,7 +103,7 @@ c2V0PWlzby04ODU5LTE1CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFi
bGUKR2VuZXJhdGVkLUJ5OiBweWdldHRleHQucHkgMS4zCgA=
'''
LOCALEDIR = os.path.join('xx', 'LC_MESSAGES')
LOCALEDIR = os.path.join(os.environ['TMPDIR'], 'xx', 'LC_MESSAGES')
MOFILE = os.path.join(LOCALEDIR, 'gettext.mo')
MOFILE_BAD_MAJOR_VERSION = os.path.join(LOCALEDIR, 'gettext_bad_major_version.mo')
MOFILE_BAD_MINOR_VERSION = os.path.join(LOCALEDIR, 'gettext_bad_minor_version.mo')