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