Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Handle deprecation of egrep
make(1): revert previous commit It had accidentally reverted all the work from the past few days.
make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02) The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25. In that commit, openDirectories was replaced with a combination of a list with a hash table, for more efficient lookup by name. Upon cleanup, OpenDirs_Done is called, which in turn called Dir_ClearPath. Dir_ClearPath takes full ownership of the given list and empties it. This was no problem before since afterwards the list was empty and calling Lst_Free just frees the remaining list pointer. With OpenDirs, this list was combined with a hash table, and the hash table contains the list nodes, assuming that the OpenDirs functions have full ownership of both the list and the hash table. This assumption was generally correct, except for the one moment during cleanup where full ownership of the list was passed to Dir_ClearPath, while the hash table still contained pointers to the (now freed) list nodes. This by itself was not a problem since the hash table would be freed afterwards. But as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up the freed directory by name and now found the freed list node, trying to free it again. Boom. Fixed by replacing the call to Dir_ClearPath with code that only frees the directories, without giving up control over the list.
make(1): ignore -env and -literal in assignments to .MAKE.EXPORTED Previously, assigning the string "-env" to the variable .MAKE.EXPORTED had the same effect as the .export-env directive. This was only due to a sloppy implementation, not by design. For the string "-literal" and the directive .export-literal, the situation was even worse since the actually executed code was a wild mixture between .export and .export-literal that in the end exported the expanded form of the variable. Therefore there was no practical use case of this implementation flaw.
make(1): do not export variable names starting with '-' By convention, names of environment variables consist of uppercase letters and underscores. Most of them start with an uppercase letter. In a few cases, the names also contain lowercase letters, such as in http_proxy. Variable names starting with a hyphen are confusing and might be mistaken as command line options. Therefore don't export these. This also affects a few edge cases that don't occur in practice, such as setting .MAKE.EXPORTED=-env or .MAKE.EXPORTED=-literal. These had not worked as expected anyway.
make(1): explain the purpose of the test make-exported
make(1): add test for non-obvious .MAKE.EXPORTED edge case