varparse-dynamic.mk revision 1.2
11.2Srillig# $NetBSD: varparse-dynamic.mk,v 1.2 2020/09/13 21:00:34 rillig Exp $ 21.1Srillig 31.1Srillig# Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped 41.1Srillig# the last character in the variable name. 51.1Srillig# To trigger the bug, the variable must not be defined. 61.1Srillig.if ${.TARGET} # exact match, may be undefined 71.1Srillig.endif 81.1Srillig.if ${.TARGEX} # 1 character difference, must be defined 91.1Srillig.endif 101.1Srillig.if ${.TARGXX} # 2 characters difference, must be defined 111.1Srillig.endif 121.1Srillig 131.2Srillig# When a dynamic variable (such as .TARGET) is evaluated in the global 141.2Srillig# context, it is not yet ready to be expanded. Therefore the complete 151.2Srillig# expression is returned as the variable value, hoping that it can be 161.2Srillig# resolved at a later point. 171.2Srillig# 181.2Srillig# This test covers the code in Var_Parse that deals with VAR_JUNK but not 191.2Srillig# VAR_KEEP for dynamic variables. 201.2Srillig.if ${.TARGET:S,^,,} != "\${.TARGET:S,^,,}" 211.2Srillig. error 221.2Srillig.endif 231.2Srillig 241.1Srilligall: 251.1Srillig @: 26