head 1.12; access; symbols netbsd-11-0-RC4:1.12 netbsd-11-0-RC3:1.12 netbsd-11-0-RC2:1.12 netbsd-11-0-RC1:1.12 perseant-exfatfs-base-20250801:1.12 netbsd-11:1.12.0.2 netbsd-11-base:1.12 netbsd-10-1-RELEASE:1.4 perseant-exfatfs-base-20240630:1.7 perseant-exfatfs:1.5.0.2 perseant-exfatfs-base:1.5 netbsd-10-0-RELEASE:1.4 netbsd-10-0-RC6:1.4 netbsd-10-0-RC5:1.4 netbsd-10-0-RC4:1.4 netbsd-10-0-RC3:1.4 netbsd-10-0-RC2:1.4 netbsd-10-0-RC1:1.4 netbsd-10:1.4.0.2 netbsd-10-base:1.4; locks; strict; comment @# @; 1.12 date 2025.03.30.09.51.51; author rillig; state Exp; branches; next 1.11; commitid veGmSzVhPiW2G4PF; 1.11 date 2025.01.11.21.21.33; author rillig; state Exp; branches; next 1.10; commitid NtFvbDJHnW9G17FF; 1.10 date 2025.01.10.23.00.38; author rillig; state Exp; branches; next 1.9; commitid vECOnwAU0SdlAZEF; 1.9 date 2024.08.29.20.20.36; author rillig; state Exp; branches; next 1.8; commitid EaMgk7FrF8mB1LnF; 1.8 date 2024.07.04.17.47.54; author rillig; state Exp; branches; next 1.7; commitid mjDGVMgldk7QYxgF; 1.7 date 2024.06.30.11.44.14; author rillig; state Exp; branches; next 1.6; commitid Jqsc8BMZ1ZvK60gF; 1.6 date 2024.06.30.11.37.21; author rillig; state Exp; branches; next 1.5; commitid yW5k27FNGJ0c30gF; 1.5 date 2023.06.01.20.56.35; author rillig; state Exp; branches 1.5.2.1; next 1.4; commitid j3tIvMRlxolKQhrE; 1.4 date 2022.03.26.14.34.07; author rillig; state Exp; branches; next 1.3; commitid bA2GMsf46REOCJxD; 1.3 date 2022.01.10.20.32.29; author rillig; state Exp; branches; next 1.2; commitid oS7G16sNshH7Z7oD; 1.2 date 2022.01.09.18.22.31; author rillig; state Exp; branches; next 1.1; commitid GlsKE09Ry1rkkZnD; 1.1 date 2021.12.28.00.56.17; author rillig; state Exp; branches; next ; commitid LlBA1cDu6B1KVlmD; 1.5.2.1 date 2024.07.01.01.01.15; author perseant; state Exp; branches; next 1.5.2.2; commitid NkoYLLCQWWw9v4gF; 1.5.2.2 date 2025.08.02.05.58.38; author perseant; state Exp; branches; next ; commitid 23j6GFaDws3O875G; desc @@ 1.12 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 @make: varmod-assign-shell.mk:21: warning: Command "echo output; (exit 13)" exited with status 13 Global: _ = # (empty) Var_Parse: ${ASSIGNED::!=echo output; ${:U(exit 13)}} (eval-keep-dollar-and-undefined) Evaluating modifier ${ASSIGNED::...} on value "previous" (eval-keep-dollar-and-undefined, regular) Modifier part: "echo output; (exit 13)" Capturing the output of command "echo output; (exit 13)" make: varmod-assign-shell.mk:26: warning: Command "echo output; (exit 13)" exited with status 13 Result of ${ASSIGNED::!=echo output; ${:U(exit 13)}} is "" (eval-keep-dollar-and-undefined, regular) Global: _ = # (empty) Global: .MAKEFLAGS = -r -k -d v -d Global: .MAKEFLAGS = -r -k -d v -d 0 DIRECT=output ASSIGNED=previous exit status 0 @ 1.11 log @make: replace "Malformed conditional" with "Variable is undefined" Evaluating a conditional such as ".if ${UNDEF}" produced a "Malformed conditional" error, even though the form of the conditional was correct, it was the content of the variable that was wrong. Replace this message with the more accurate "Variable is undefined", revealing which of the possibly many variables is actually undefined. @ text @d1 1 a1 1 make: "varmod-assign-shell.mk" line 21: warning: Command "echo output; (exit 13)" exited with status 13 d7 1 a7 1 make: "varmod-assign-shell.mk" line 26: warning: Command "echo output; (exit 13)" exited with status 13 @ 1.10 log @tests/make: test expressions based on undefined variables When an undefined variable is used in a conditional, make complains about "Malformed conditional", which is wrong since the conditional is well-formed but errors out during evaluation. In order to fix this wrong error message and preserve the remaining behavior, cover the places in which an expression is evaluated with undefined expressions being an error (VARE_EVAL_DEFINED), but with neither producing an error message nor handling errors. This combination results in the same behavior as evaluating the expressions in the mode that allows undefined variables to be used in expressions. @ text @d7 1 a7 1 make: "varmod-assign-shell.mk" line 32: warning: Command "echo output; (exit 13)" exited with status 13 @ 1.9 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 @d7 1 a7 1 make: "varmod-assign-shell.mk" line 26: warning: Command "echo output; (exit 13)" exited with status 13 @ 1.8 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 @d7 1 a7 1 make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED" with value "previous": Command "echo output; (exit 13)" exited with status 13 @ 1.7 log @make: sync error handling between '!=' assignment and '::!=' modifier @ text @d7 1 a7 1 make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 @ 1.6 log @make: add detailed exit status to message for failed sub-commands Several commands communicate via the exit status and not only distinguish between zero and non-zero, so make this information available to ease investigations. The command "false" is not guaranteed to exit with a consistent status, so use "(exit 13)" instead in the tests, to keep these tests portable across different operating systems. The exit status 127 is required for a shell that cannot find a command, so keep that one. @ text @d1 1 a1 1 make: "varmod-assign-shell.mk" line 28: warning: Command "echo output; (exit 13)" exited with status 13 d7 1 a7 1 make: Command "echo output; (exit 13)" exited with status 13 @ 1.5 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-assign-shell.mk" line 28: warning: "echo output; false" returned non-zero status d3 1 a3 1 Var_Parse: ${ASSIGNED::!=echo output; ${:Ufalse}} (eval-keep-dollar-and-undefined) d5 4 a8 4 Modifier part: "echo output; false" Capturing the output of command "echo output; false" make: "echo output; false" returned non-zero status Result of ${ASSIGNED::!=echo output; ${:Ufalse}} is "" (eval-keep-dollar-and-undefined, regular) @ 1.5.2.1 log @Sync with HEAD. @ text @d1 1 a1 1 make: "varmod-assign-shell.mk" line 21: warning: Command "echo output; (exit 13)" exited with status 13 d3 1 a3 1 Var_Parse: ${ASSIGNED::!=echo output; ${:U(exit 13)}} (eval-keep-dollar-and-undefined) d5 4 a8 4 Modifier part: "echo output; (exit 13)" Capturing the output of command "echo output; (exit 13)" make: "varmod-assign-shell.mk" line 26: warning: while evaluating variable "ASSIGNED": Command "echo output; (exit 13)" exited with status 13 Result of ${ASSIGNED::!=echo output; ${:U(exit 13)}} is "" (eval-keep-dollar-and-undefined, regular) @ 1.5.2.2 log @Sync with HEAD @ text @d1 1 a1 1 make: varmod-assign-shell.mk:21: warning: Command "echo output; (exit 13)" exited with status 13 d7 1 a7 1 make: varmod-assign-shell.mk:26: warning: Command "echo output; (exit 13)" exited with status 13 @ 1.4 log @make: avoid trailing whitespace in debug log for variables Since trailing whitespace is invisible, describe the variable value in words to make it visible. @ text @d1 1 a1 1 make: "varmod-assign-shell.mk" line 27: warning: "echo output; false" returned non-zero status @ 1.3 log @make: add debug logging for capturing the output of external commands This applies to all 4 situations in which the output of an external command is used for modifying a variable or an expression: * the assignment operator '!=' * the assignment modifier '::!=' * the SUN shell modifier ':sh' * the other shell modifier ':!cmd!' Previously, only the shell modifier ':!cmd!' had debug logging. Suggested by Christoph Badura. @ text @d2 1 a2 1 Global: _ = d9 1 a9 1 Global: _ = @ 1.2 log @tests/make: demonstrate inconsistencies in Cmd_Exec callers The assignment 'VAR != cmd' generates a warning, the others generate an error message. That error message is ignored for backwards compatibility though. The assignment via the expression ${VAR::!=cmd} only uses the output of the command if there was no error, the other places use the output nevertheless. @ text @d2 5 d8 4 @ 1.1 log @tests/make: document inconsistencies between '!=' and '::!=' Found while trying to make the error messages from Cmd_Exec more detailed. @ text @d1 1 a1 1 make: "varmod-assign-shell.mk" line 25: warning: "echo output; false" returned non-zero status @