head 1.9; access; symbols perseant-exfatfs-base-20261102:1.9 netbsd-11-1-RELEASE:1.8 netbsd-10-2-RELEASE:1.2 netbsd-11-0-RELEASE:1.8 netbsd-11-0-RC7:1.8 netbsd-11-0-RC6:1.8 netbsd-11-0-RC5:1.8 netbsd-11-0-RC4:1.8 netbsd-11-0-RC3:1.8 netbsd-11-0-RC2:1.8 netbsd-11-0-RC1:1.8 perseant-exfatfs-base-20250801:1.8 netbsd-11:1.8.0.2 netbsd-11-base:1.8 netbsd-10-1-RELEASE:1.2 perseant-exfatfs-base-20240630:1.2 perseant-exfatfs:1.2.0.4 perseant-exfatfs-base:1.2 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 cjep_sun2x-base1:1.1 cjep_sun2x:1.1.0.4 cjep_sun2x-base:1.1 cjep_staticlib_x-base1:1.1 cjep_staticlib_x:1.1.0.2 cjep_staticlib_x-base:1.1; locks; strict; comment @# @; 1.9 date 2026.02.01.16.42.35; author rillig; state Exp; branches; next 1.8; commitid QDTzAMUxdyOj5HsG; 1.8 date 2025.03.30.01.27.13; author rillig; state Exp; branches; next 1.7; commitid 6EuALUPPSAIsU1PF; 1.7 date 2025.03.29.10.39.49; author rillig; state Exp; branches; next 1.6; commitid 22Yp9aLGm4mSZWOF; 1.6 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.5; commitid EaMgk7FrF8mB1LnF; 1.5 date 2024.07.20.11.05.12; author rillig; state Exp; branches; next 1.4; commitid Bey1UaNE0WVGeziF; 1.4 date 2024.07.09.19.43.01; author rillig; state Exp; branches; next 1.3; commitid qrdgBafp1onZqchF; 1.3 date 2024.07.04.18.53.37; author rillig; state Exp; branches; next 1.2; commitid 7qUZd0dIKoMjlygF; 1.2 date 2022.01.23.16.09.38; author rillig; state Exp; branches 1.2.4.1; next 1.1; commitid 55UrqaZMiBo29MpD; 1.1 date 2020.08.16.12.07.51; author rillig; state Exp; branches; next ; commitid coEgPk3hgfeYGhkC; 1.2.4.1 date 2025.08.02.05.58.39; author perseant; state Exp; branches; next 1.2.4.2; commitid 23j6GFaDws3O875G; 1.2.4.2 date 2026.11.04.23.28.39; author perseant; state Exp; branches; next ; commitid 3QTNojfCEH9lUb2H; desc @@ 1.9 log @make: in stack traces, add location information for targets @ text @make: Invalid modifier ":[]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[]="${LIST:[]}" is an error'" in target "mod-squarebrackets-empty" from varmod-select-words.mk:54 LIST:[0]="one two three four five six" LIST:[0x0]="one two three four five six" LIST:[000]="one two three four five six" LIST:[*]="one two three four five six" LIST:[@@]="one two three four five six" LIST:[0]:C/ /,/="one,two three four five six" LIST:[0]:C/ /,/g="one,two,three,four,five,six" LIST:[0]:C/ /,/1g="one,two,three,four,five,six" LIST:[*]:C/ /,/="one,two three four five six" LIST:[*]:C/ /,/g="one,two,three,four,five,six" LIST:[*]:C/ /,/1g="one,two,three,four,five,six" LIST:[@@]:C/ /,/="one two three four five six" LIST:[@@]:C/ /,/g="one two three four five six" LIST:[@@]:C/ /,/1g="one two three four five six" LIST:[@@]:[0]:C/ /,/="one,two three four five six" LIST:[0]:[@@]:C/ /,/="one two three four five six" LIST:[@@]:[*]:C/ /,/="one,two three four five six" LIST:[*]:[@@]:C/ /,/="one two three four five six" EMPTY="" EMPTY:[#]="1" == 1 ? ESCAPEDSPACE="\ " ESCAPEDSPACE:[#]="1" == 1 ? REALLYSPACE=" " REALLYSPACE:[#]="1" == 1 ? LIST:[#]="6" LIST:[0]:[#]="1" == 1 ? LIST:[*]:[#]="1" == 1 ? LIST:[@@]:[#]="6" LIST:[1]:[#]="1" LIST:[1..3]:[#]="3" EMPTY:[1]="" ESCAPEDSPACE="\ " ESCAPEDSPACE:[1]="\ " REALLYSPACE=" " REALLYSPACE:[1]="" == "" ? REALLYSPACE:[*]:[1]=" " == " " ? LIST:[1]="one" make: Invalid modifier ":[1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.]="${LIST:[1.]}" is an error'" in target "mod-squarebrackets-n-error-1" from varmod-select-words.mk:100 make: Extra text after "[1]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1].="${LIST:[1].}" is an error'" in target "mod-squarebrackets-n-error-2" from varmod-select-words.mk:103 LIST:[2]="two" LIST:[6]="six" LIST:[7]="" LIST:[999]="" make: Invalid modifier ":[-]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[-]="${LIST:[-]}" is an error'" in target "mod-squarebrackets-n-error-3" from varmod-select-words.mk:111 make: Invalid modifier ":[--]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[--]="${LIST:[--]}" is an error'" in target "mod-squarebrackets-n-error-4" from varmod-select-words.mk:114 LIST:[-1]="six" LIST:[-2]="five" LIST:[-6]="one" LIST:[-7]="" LIST:[-999]="" LONGLIST:[17]="17" LONGLIST:[0x11]="17" LONGLIST:[021]="17" LIST:[0]:[1]="one two three four five six" LIST:[*]:[1]="one two three four five six" LIST:[@@]:[1]="one" LIST:[0]:[2]="" LIST:[*]:[2]="" LIST:[@@]:[2]="two" LIST:[*]:C/ /,/:[2]="" LIST:[*]:C/ /,/:[*]:[2]="" LIST:[*]:C/ /,/:[@@]:[2]="three" LONGLIST:[012..0x12]="10 11 12 13 14 15 16 17 18" make: Invalid modifier ":[1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.]="${LIST:[1.]}" is an error'" in target "mod-squarebrackets-start-end-error-1" from varmod-select-words.mk:137 make: Invalid modifier ":[1..]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1..]="${LIST:[1..]}" is an error'" in target "mod-squarebrackets-start-end-error-2" from varmod-select-words.mk:140 make: Invalid modifier ":[1.. ]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.. ]="${LIST:[1.. ]}" is an error'" in target "mod-squarebrackets-start-end-error-3" from varmod-select-words.mk:143 LIST:[1..1]="one" make: Invalid modifier ":[1..1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error'" in target "mod-squarebrackets-start-end-error-4" from varmod-select-words.mk:148 LIST:[1..2]="one two" LIST:[2..1]="two one" LIST:[3..-2]="three four five" LIST:[-4..4]="three four" make: Invalid modifier ":[0..1]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[0..1]="${LIST:[0..1]}" is an error'" in target "mod-squarebrackets-start-end-error-5" from varmod-select-words.mk:156 make: Invalid modifier ":[-1..0]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[-1..0]="${LIST:[-1..0]}" is an error'" in target "mod-squarebrackets-start-end-error-6" from varmod-select-words.mk:159 LIST:[-1..1]="six five four three two one" LIST:[0..0]="one two three four five six" LIST:[3..99]="three four five six" LIST:[-3..-99]="four three two one" LIST:[-99..-3]="one two three four" HASH="#" == "#" ? LIST:[${HASH}]="6" LIST:[${ZERO}]="one two three four five six" LIST:[${ZERO}x${ONE}]="one" LIST:[${ONE}]="one" LIST:[${MINUSONE}]="six" LIST:[${STAR}]="one two three four five six" LIST:[${AT}]="one two three four five six" make: Invalid modifier ":[]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[$${EMPTY}]="${LIST:[${EMPTY}]}" is an error'" in target "mod-squarebrackets-nested-error-1" from varmod-select-words.mk:178 LIST:[${LONGLIST:[21]:S/2//}]="one" LIST:[${LIST:[#]}]="six" LIST:[${LIST:[${HASH}]}]="six" LIST:[ -1.. +3]="six five four three" LIST:S/ /,/="one two three four five six" LIST:S/ /,/W="one,two three four five six" LIST:S/ /,/gW="one,two,three,four,five,six" EMPTY:S/^/,/="," EMPTY:S/^/,/W="," LIST:C/ /,/="one two three four five six" LIST:C/ /,/W="one,two three four five six" LIST:C/ /,/gW="one,two,three,four,five,six" EMPTY:C/^/,/="," EMPTY:C/^/,/W="," LIST:tW="one two three four five six" LIST:tw="one two three four five six" LIST:tW:C/ /,/="one,two three four five six" LIST:tW:C/ /,/g="one,two,three,four,five,six" LIST:tW:C/ /,/1g="one,two,three,four,five,six" LIST:tw:C/ /,/="one two three four five six" LIST:tw:C/ /,/g="one two three four five six" LIST:tw:C/ /,/1g="one two three four five six" LIST:tw:tW:C/ /,/="one,two three four five six" LIST:tW:tw:C/ /,/="one two three four five six" exit status 2 @ 1.8 log @make: fix error message for invalid ":[...]" modifier The unparsed value of the modifier argument can already be seen in the stack trace, but the modifier argument may contain expressions and the expanded value of these expressions was hidden up to now. See the EMPTY test at the bottom of varmod-select-words.mk for details. @ text @d4 1 a4 1 in target "mod-squarebrackets-empty" d45 1 a45 1 in target "mod-squarebrackets-n-error-1" d49 1 a49 1 in target "mod-squarebrackets-n-error-2" d57 1 a57 1 in target "mod-squarebrackets-n-error-3" d61 1 a61 1 in target "mod-squarebrackets-n-error-4" d83 1 a83 1 in target "mod-squarebrackets-start-end-error-1" d87 1 a87 1 in target "mod-squarebrackets-start-end-error-2" d91 1 a91 1 in target "mod-squarebrackets-start-end-error-3" d96 1 a96 1 in target "mod-squarebrackets-start-end-error-4" d104 1 a104 1 in target "mod-squarebrackets-start-end-error-5" d108 1 a108 1 in target "mod-squarebrackets-start-end-error-6" d125 1 a125 1 in target "mod-squarebrackets-nested-error-1" @ 1.7 log @make: in stack traces from target commands, add the command level A target can contain several commands, and these commands are likely to contain the same expressions. To distinguish them, add one more line to the stack trace, to narrow down the source of the error. @ text @d1 1 a1 1 make: Bad modifier ":[]" d42 1 a42 1 make: Bad modifier ":[1.]" d46 1 a46 1 make: Bad modifier ":[1]." d54 1 a54 1 make: Bad modifier ":[-]" d58 1 a58 1 make: Bad modifier ":[--]" d80 1 a80 1 make: Bad modifier ":[1.]" d84 1 a84 1 make: Bad modifier ":[1..]" d88 1 a88 1 make: Bad modifier ":[1.. ]" d93 1 a93 1 make: Bad modifier ":[1..1.]" d101 1 a101 1 make: Bad modifier ":[0..1]" d105 1 a105 1 make: Bad modifier ":[-1..0]" d122 1 a122 1 make: Bad modifier ":[${EMPTY" @ 1.6 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 @d3 1 d44 1 d48 1 d56 1 d60 1 d82 1 d86 1 d90 1 d95 1 d103 1 d107 1 d124 1 @ 1.5 log @make: don't run erroneous commands in compat mode When there is a parse or evaluation error in an expression that becomes part of the command, don't run that command, as the result of the failed evaluation typically contains garbage characters. Skip the remaining commands from that target as well, as they may depend on the erroneous command. @ text @d1 3 a3 1 make: in target "mod-squarebrackets-empty": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[]" d41 6 a46 2 make: in target "mod-squarebrackets-n-error-1": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]" make: in target "mod-squarebrackets-n-error-2": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1]." d51 6 a56 2 make: in target "mod-squarebrackets-n-error-3": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-]" make: in target "mod-squarebrackets-n-error-4": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[--]" d75 9 a83 3 make: in target "mod-squarebrackets-start-end-error-1": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]" make: in target "mod-squarebrackets-start-end-error-2": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..]" make: in target "mod-squarebrackets-start-end-error-3": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.. ]" d85 3 a87 1 make: in target "mod-squarebrackets-start-end-error-4": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..1.]" d92 6 a97 2 make: in target "mod-squarebrackets-start-end-error-5": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[0..1]" make: in target "mod-squarebrackets-start-end-error-6": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-1..0]" d111 3 a113 1 make: in target "mod-squarebrackets-nested-error-1": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[${EMPTY" @ 1.4 log @make: error out on parse/evaluation errors in shell commands The expression ${VAR:X} has an unknown modifier ':X'. Previously, this expression errored out when the expression was evaluated at parse time, but not when the expression was evaluated when generating the commands to bring a target up to date. The errors were previously reported, they didn't affect the exit status, though. Now, errors in expressions are handled in the same way, regardless of the time at which they are evaluated. @ text @d1 1 a1 2 make: in target "mod-squarebrackets-0-star-at": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[]" LIST:[]="" is an error d39 2 a40 4 make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]" LIST:[1.]="" is an error make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1]." LIST:[1].="}" is an error d45 2 a46 4 make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-]" LIST:[-]="" is an error make: in target "mod-squarebrackets-n": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[--]" LIST:[--]="" is an error d65 3 a67 6 make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.]" LIST:[1.]="" is an error make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..]" LIST:[1..]="" is an error make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1.. ]" LIST:[1.. ]="" is an error d69 1 a69 2 make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[1..1.]" LIST:[1..1.]="" is an error d74 2 a75 4 make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[0..1]" LIST:[0..1]="" is an error make: in target "mod-squarebrackets-start-end": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[-1..0]" LIST:[-1..0]="" is an error d89 1 a89 2 make: in target "mod-squarebrackets-nested": while evaluating variable "LIST" with value "one two three four five six": Bad modifier ":[${EMPTY" LIST:[${EMPTY}]="" is an error @ 1.3 log @make: error out on the "Bad modifier" error message Previously, the "Bad modifier" error message did not affect make's exit status. As a side effect, this kind of error now gets more context information. @ text @d126 1 a126 1 exit status 0 @ 1.2 log @tests/make: extend test suite, move old tests to 2020 scheme The tests from envfirst.mk are now in opt-env.mk. The tests from modword.mk are now in varmod-select-words.mk. @ text @d1 1 a1 1 make: Bad modifier ":[]" for variable "LIST" d40 1 a40 1 make: Bad modifier ":[1.]" for variable "LIST" d42 1 a42 1 make: Bad modifier ":[1]." for variable "LIST" d48 1 a48 1 make: Bad modifier ":[-]" for variable "LIST" d50 1 a50 1 make: Bad modifier ":[--]" for variable "LIST" d70 1 a70 1 make: Bad modifier ":[1.]" for variable "LIST" d72 1 a72 1 make: Bad modifier ":[1..]" for variable "LIST" d74 1 a74 1 make: Bad modifier ":[1.. ]" for variable "LIST" d77 1 a77 1 make: Bad modifier ":[1..1.]" for variable "LIST" d83 1 a83 1 make: Bad modifier ":[0..1]" for variable "LIST" d85 1 a85 1 make: Bad modifier ":[-1..0]" for variable "LIST" d100 1 a100 1 make: Bad modifier ":[${EMPTY" for variable "LIST" @ 1.2.4.1 log @Sync with HEAD @ text @d1 2 a2 4 make: Invalid modifier ":[]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[]="${LIST:[]}" is an error'" in target "mod-squarebrackets-empty" d40 4 a43 8 make: Invalid modifier ":[1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.]="${LIST:[1.]}" is an error'" in target "mod-squarebrackets-n-error-1" make: Extra text after "[1]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1].="${LIST:[1].}" is an error'" in target "mod-squarebrackets-n-error-2" d48 4 a51 8 make: Invalid modifier ":[-]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[-]="${LIST:[-]}" is an error'" in target "mod-squarebrackets-n-error-3" make: Invalid modifier ":[--]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[--]="${LIST:[--]}" is an error'" in target "mod-squarebrackets-n-error-4" d70 6 a75 12 make: Invalid modifier ":[1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.]="${LIST:[1.]}" is an error'" in target "mod-squarebrackets-start-end-error-1" make: Invalid modifier ":[1..]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1..]="${LIST:[1..]}" is an error'" in target "mod-squarebrackets-start-end-error-2" make: Invalid modifier ":[1.. ]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1.. ]="${LIST:[1.. ]}" is an error'" in target "mod-squarebrackets-start-end-error-3" d77 2 a78 4 make: Invalid modifier ":[1..1.]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[1..1.]="${LIST:[1..1.]}" is an error'" in target "mod-squarebrackets-start-end-error-4" d83 4 a86 8 make: Invalid modifier ":[0..1]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[0..1]="${LIST:[0..1]}" is an error'" in target "mod-squarebrackets-start-end-error-5" make: Invalid modifier ":[-1..0]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[-1..0]="${LIST:[-1..0]}" is an error'" in target "mod-squarebrackets-start-end-error-6" d100 2 a101 4 make: Invalid modifier ":[]" while evaluating variable "LIST" with value "one two three four five six" in command "@@echo 'LIST:[$${EMPTY}]="${LIST:[${EMPTY}]}" is an error'" in target "mod-squarebrackets-nested-error-1" d126 1 a126 1 exit status 2 @ 1.2.4.2 log @Sync with HEAD @ text @d4 1 a4 1 in target "mod-squarebrackets-empty" from varmod-select-words.mk:54 d45 1 a45 1 in target "mod-squarebrackets-n-error-1" from varmod-select-words.mk:100 d49 1 a49 1 in target "mod-squarebrackets-n-error-2" from varmod-select-words.mk:103 d57 1 a57 1 in target "mod-squarebrackets-n-error-3" from varmod-select-words.mk:111 d61 1 a61 1 in target "mod-squarebrackets-n-error-4" from varmod-select-words.mk:114 d83 1 a83 1 in target "mod-squarebrackets-start-end-error-1" from varmod-select-words.mk:137 d87 1 a87 1 in target "mod-squarebrackets-start-end-error-2" from varmod-select-words.mk:140 d91 1 a91 1 in target "mod-squarebrackets-start-end-error-3" from varmod-select-words.mk:143 d96 1 a96 1 in target "mod-squarebrackets-start-end-error-4" from varmod-select-words.mk:148 d104 1 a104 1 in target "mod-squarebrackets-start-end-error-5" from varmod-select-words.mk:156 d108 1 a108 1 in target "mod-squarebrackets-start-end-error-6" from varmod-select-words.mk:159 d125 1 a125 1 in target "mod-squarebrackets-nested-error-1" from varmod-select-words.mk:178 @ 1.1 log @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. @ text @d1 125 @