xref: /freebsd/contrib/bmake/unit-tests/varmod-to-abs.mk (revision 148ee84570001f46b7b667c86573d378101c3801)
1*148ee845SSimon J. Gerraty# $NetBSD: varmod-to-abs.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Tests for the :tA variable modifier, which returns the absolute path for
42c3632d1SSimon J. Gerraty# each of the words in the variable value.
52c3632d1SSimon J. Gerraty
62c3632d1SSimon J. Gerraty# TODO: Implementation
72c3632d1SSimon J. Gerraty
8e2eeea75SSimon J. Gerraty# Between 2016-06-03 and 2020-11-14, it was possible to trick the :tA modifier
9e2eeea75SSimon J. Gerraty# into resolving completely unrelated absolute paths by defining a global
10e2eeea75SSimon J. Gerraty# variable with the same name as the path that is to be resolved.  There were
11e2eeea75SSimon J. Gerraty# a few restrictions though: The "redirected" path had to start with a slash,
12e2eeea75SSimon J. Gerraty# and it had to exist (see ModifyWord_Realpath).
13e2eeea75SSimon J. Gerraty#
14e2eeea75SSimon J. Gerraty# This unintended behavior was caused by cached_realpath using a GNode for
15e2eeea75SSimon J. Gerraty# keeping the cache, just like the GNode for global variables.
16e2eeea75SSimon J. Gerraty.MAKEFLAGS: -dd
17e2eeea75SSimon J. Gerratydoes-not-exist.c=	/dev/null
18*148ee845SSimon J. Gerraty# expect+1: does-not-exist.c
19e2eeea75SSimon J. Gerraty.info ${does-not-exist.c:L:tA}
20*148ee845SSimon J. Gerraty# expect+1: does-not-exist.c
21e2eeea75SSimon J. Gerraty.info ${does-not-exist.c:L:tA}
22e2eeea75SSimon J. Gerraty
23e2eeea75SSimon J. Gerraty# The output of the following line is modified by the global _SED_CMDS in
24e2eeea75SSimon J. Gerraty# unit-tests/Makefile.  See the .rawout file for the truth.
25*148ee845SSimon J. Gerraty# expect+1: varmod-to-abs.mk
26e2eeea75SSimon J. Gerraty.info ${MAKEFILE:tA}
27e2eeea75SSimon J. Gerraty
28e2eeea75SSimon J. Gerraty.MAKEFLAGS: -d0
29e2eeea75SSimon J. Gerraty
302c3632d1SSimon J. Gerratyall:
312c3632d1SSimon J. Gerraty	@:;
32