diff --git a/usr.bin/make/unit-tests/export-all b/usr.bin/make/unit-tests/export-all index 05429379e0fc..d1c79e2d341e 100644 --- a/usr.bin/make/unit-tests/export-all +++ b/usr.bin/make/unit-tests/export-all @@ -1,8 +1,20 @@ -# $Id: export-all,v 1.1 2007/10/05 15:27:46 sjg Exp $ +# $Id: export-all,v 1.2 2010/04/21 04:25:28 sjg Exp $ UT_OK=good UT_F=fine +# the old way to do :tA +M_tAbad = C,.*,cd & \&\& 'pwd',:sh +# the new +M_tA = tA + +here := ${.PARSEDIR} + +# this will cause trouble (recursing if we let it) +UT_BADDIR = ${${here}/../${here:T}:L:${M_tAbad}:T} +# this will be ok +UT_OKDIR = ${${here}/../${here:T}:L:${M_tA}:T} + .export .include "export" diff --git a/usr.bin/make/unit-tests/test.exp b/usr.bin/make/unit-tests/test.exp index 660e28982ca7..c13e852d30b6 100644 --- a/usr.bin/make/unit-tests/test.exp +++ b/usr.bin/make/unit-tests/test.exp @@ -33,12 +33,14 @@ UT_FU=fubar UT_TEST=export UT_ZOO=hoopie UT_ALL=even this gets exported +UT_BADDIR=unit-tests UT_DOLLAR=This is $UT_FU UT_F=fine UT_FOO=foobar is fubar UT_FU=fubar UT_NO=all UT_OK=good +UT_OKDIR=unit-tests UT_TEST=export-all UT_ZOO=hoopie At first, I am diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index c2b2e3038459..770e688f5c28 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.157 2010/04/20 17:48:16 sjg Exp $ */ +/* $NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.157 2010/04/20 17:48:16 sjg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.157 2010/04/20 17:48:16 sjg Exp $"); +__RCSID("$NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -591,6 +591,13 @@ Var_Export1(const char *name, int parent) v->flags |= (VAR_EXPORTED|VAR_REEXPORT); return 1; } + if (v->flags & VAR_IN_USE) { + /* + * We recursed while exporting in a child. + * This isn't going to end well, just skip it. + */ + return 0; + } n = snprintf(tmp, sizeof(tmp), "${%s}", name); if (n < (int)sizeof(tmp)) { val = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);