head 1.10; access; symbols netbsd-11-0-RC6:1.9 netbsd-11-0-RC5:1.9 netbsd-11-0-RC4:1.9 netbsd-11-0-RC3:1.9 netbsd-11-0-RC2:1.9 netbsd-11-0-RC1:1.9 perseant-exfatfs-base-20250801:1.9 netbsd-11:1.9.0.2 netbsd-11-base:1.9 netbsd-10-1-RELEASE:1.2 perseant-exfatfs-base-20240630:1.4 perseant-exfatfs:1.4.0.2 perseant-exfatfs-base:1.4 netbsd-10-0-RELEASE:1.2 netbsd-10-0-RC6:1.2 netbsd-10-0-RC5:1.2 netbsd-10-0-RC4:1.2 netbsd-10-0-RC3:1.2 netbsd-10-0-RC2:1.2 netbsd-10-0-RC1:1.2 netbsd-10:1.2.0.2 netbsd-10-base:1.2; locks; strict; comment @# @; 1.10 date 2026.02.09.22.03.34; author rillig; state Exp; branches; next 1.9; commitid ltgfw1U8MRwWAKtG; 1.9 date 2025.03.30.09.51.51; author rillig; state Exp; branches; next 1.8; commitid veGmSzVhPiW2G4PF; 1.8 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.7; commitid EaMgk7FrF8mB1LnF; 1.7 date 2024.07.05.19.47.22; author rillig; state Exp; branches; next 1.6; commitid ey8c5i7vJGMuCGgF; 1.6 date 2024.07.04.20.18.40; author rillig; state Exp; branches; next 1.5; commitid 75IS4XOhTa8VOygF; 1.5 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.4; commitid mjDGVMgldk7QYxgF; 1.4 date 2024.04.20.10.18.55; author rillig; state Exp; branches 1.4.2.1; next 1.3; commitid 2fCjOO5HMlf2VR6F; 1.3 date 2023.06.01.20.56.35; author rillig; state Exp; branches; next 1.2; commitid j3tIvMRlxolKQhrE; 1.2 date 2021.12.09.20.13.10; author rillig; state Exp; branches; next 1.1; commitid O1mxwHYOSFzmW0kD; 1.1 date 2021.12.05.15.20.13; author rillig; state Exp; branches; next ; commitid 2c35vbqBOypiptjD; 1.4.2.1 date 2025.08.02.05.58.38; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.10 log @tests/make: demonstrate use-after-free in the :@@ modifier This test is not run regularly because the output varies depending on the memory allocator and its configuration. It can be run manually by: make -r -f unit-tests/varmod-loop-delete.mk use-after-free @ text @make -f varmod-loop-delete.mk delete-active-variable || true make: varmod-loop-delete.mk:31: Cannot delete variable "VAR" while it is used while evaluating "${:U:@@VAR@@@@} rest of the value" with value "" while evaluating variable "VAR" with value "${:U:@@VAR@@@@} rest of the value" in make[1] in directory "" make: Fatal errors encountered -- cannot continue make: stopped making "delete-active-variable" in unit-tests make -f varmod-loop-delete.mk delete-active-variable-in-target || true : delete-active-variable-in-target: ' rest of the value' exit status 0 @ 1.9 log @make: use '"filename" line 123' for locations instead of 'filename:123' The format 'filename:123' is commonly used for identifying a location in a file. Text editors recognize it and allow quick navigation through it. The previous format was specific to make and would have required custom support in editors. The new format was already used in stack traces, except for the first line. Now all lines use the same format. @ text @d1 2 a2 1 make: varmod-loop-delete.mk:20: Cannot delete variable "VAR" while it is used d5 1 d7 6 a12 2 make: stopped making "all" in unit-tests exit status 1 @ 1.8 log @make: reduce line length in error messages The error messages for deeply nested parse errors were hard to decipher, due to the large amount of text. Split these messages into individual lines, just as in the backtrace for .include files and .for loops. This unified backtrace makes the output more uniform. @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 20: Cannot delete variable "VAR" while it is used @ 1.7 log @make: in error messages for anonymous variables, log the value @ text @d1 3 a3 1 make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR" with value "${:U:@@VAR@@@@} rest of the value": while evaluating "${:U:@@VAR@@@@} rest of the value" with value "": Cannot delete variable "VAR" while it is used @ 1.6 log @make: on error, print the targets to be made This helps to understand situations with several nested sub-makes in varying directories. @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR" with value "${:U:@@VAR@@@@} rest of the value": while evaluating "${:U:@@VAR@@@@} rest of the value": Cannot delete variable "VAR" while it is used @ 1.5 log @make: add more context information to error messages In case of a parse error or evaluation error, print the variable value in addition to the variable name, to see the effects of previous expression modifiers. In nested make calls, print the current directory at the bottom of a stack trace, as that information is otherwise hard to get in a parallel build spanning multiple directories. @ text @d3 1 a3 1 make: stopped in unit-tests @ 1.4 log @make: provide more context information for parse/evaluate errors @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 20: while evaluating variable "VAR": while evaluating "${:U:@@VAR@@@@} rest of the value": Cannot delete variable "VAR" while it is used @ 1.4.2.1 log @Sync with HEAD @ text @d1 1 a1 3 make: varmod-loop-delete.mk:20: Cannot delete variable "VAR" while it is used while evaluating "${:U:@@VAR@@@@} rest of the value" with value "" while evaluating variable "VAR" with value "${:U:@@VAR@@@@} rest of the value" d3 1 a3 1 make: stopped making "all" in unit-tests @ 1.3 log @tests/make: force line-based diagnostics to be listed in the tests This way, contradictions between the intended output and the actual output are closer together and have a better chance of being spotted. @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 20: Cannot delete variable "VAR" while it is used @ 1.2 log @make: remove period from end of error messages and warnings The majority of the existing error messages and warnings does not include a period at the end. Follow this style consistently. @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 19: Cannot delete variable "VAR" while it is used @ 1.1 log @make: fix use-after-free in modifier ':@@' Without memory allocator debugging, the newly added test doesn't show any obvious failure. With memory allocator debugging enabled, all make versions since 2016.02.27.16.20.06 crash with a segmentation fault. @ text @d1 1 a1 1 make: "varmod-loop-delete.mk" line 19: Cannot delete variable "VAR" while it is used. @