Home | History | Annotate | Download | only in unit-tests
History log of /src/usr.bin/make/unit-tests/opt-file.mk
RevisionDateAuthorComments
 1.16  01-Apr-2024  rillig make: exit immediately after reading a null byte from a makefile

The chance of other garbage bytes in such a file is just too high.
 1.15  26-Mar-2022  rillig make: clean up comments
 1.14  09-Dec-2021  rillig make: add back support for jemalloc 100

The ports sun2 and vax default to jemalloc 100, as opposed to the rest
of the ports, which use jemalloc 510. Some developers choose to use
jemalloc 100, so let them run the tests with memory debugging as well.

Suggested by mrg on source-changes-d.
 1.13  05-Dec-2021  rillig tests/make: migrate to jemalloc > 100

When I started working on usr.bin/make in 2020, I used NetBSD 8, which
used jemalloc 100.

After updating to NetBSD 8 to 9.99.x, the debugging options for jemalloc
stopped working since MALLOC_OPTIONS had been replaced with MALLOC_CONF
in 2019.

Enable malloc debugging again, to reliably reproduce the use-after-free
for the variable modifier ':@'.
 1.12  04-Apr-2021  rillig make: remove filler word 'Do' from function names for parsing

No functional change, except for debug logging.
 1.11  22-Dec-2020  rillig make(1): fix comment in test about null bytes in makefiles
 1.10  22-Dec-2020  rillig make(1): re-add improved assertion in ParseGetLine
 1.9  22-Dec-2020  rillig make(1): clean up after test opt-file
 1.8  22-Dec-2020  rillig make(1): fix assertion failure for files without trailing newline

Previously, mmapped files didn't always have the final newline added.
Only those that ended at a page boundary did.

This confused ParseRawLine, which assumed (and since parse.c 1.510 from
moments ago also asserted) that every line ends with a newline, which
allows the code to assume that after a backslash, there is at least one
other character in the buffer, thereby preventing an out-of-bounds read.

This bug had been there at least since parse.c 1.170 from 2010-12-25
04:57:07, maybe even earlier, I didn't check.

Now line_end always points to the trailing newline, which allows
ParseGetLine to overwrite that character to end the string.
 1.7  06-Dec-2020  rillig make(1): document undefined behavior from 2014

Earlier versions of make didn't know the -v option to print the expanded
value of a variable. To make the test runnable by older makes as well,
switch to -V instead, which has been available much longer.
 1.6  06-Dec-2020  rillig make(1): error out on null bytes in makefiles

Makefiles are text files, they must not contain null bytes.

The previous code in this area was rotten anyway. It assumed that
buf_end could be NULL even if buf_ptr was a valid pointer, which is no
longer true, probably since a few years already.

Continuing parsing after a null byte does not make sense. If there's a
null byte in a text file, that file is corrupted, and parsing it leads
to unintended effects easily. Therefore the only sensible action is to
stop parsing immediately.

The check whether cf->readMore could be null was outdated as well, which
previously made the fatal error impossible to reach. Because of the
missing unit tests, nobody noticed this though.

The "exit status 0" in opt-file.exp is worring but that's due to another
bug and will be fixed in a follow-up commit.
 1.5  06-Dec-2020  rillig make(1): document how make behaved for null bytes in the makefile
 1.4  06-Dec-2020  rillig make(1): add test for makefile containing null bytes
 1.3  06-Dec-2020  rillig make(1): test parsing a makefile that ends in a backslash
 1.2  16-Aug-2020  rillig make(1): describe the purpose of each newly added unit test dummy
 1.1  16-Aug-2020  rillig make(1): add dummies for fine-grained tests, one per single feature

The test names have been derived from the current manual page.

All these tests are dummies right now, and the code from the existing
tests will be moved into the new tests step by step.

This is done to prevent modmisc, escape, varmod-edge and varmisc from
growing without any bounds, and to reduce the side-effects of one test
to the others.

RSS XML Feed