mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00:00
![Simon J. Gerraty](/assets/img/avatar_default.png)
Lots more unit tests and code cleanup Relevant changes from ChangeLog o job.c: Print -de error information when running multiple jobs o var.c: only report error for unmatched regex subexpression when linting (-dL) since we cannot tell when an unmatched subexpression is an expected result. reduce memory allocations in the modifiers ':D' and ':U' reduce memory allocation and strlen calls in modifier ':from=to' in the ':Q' modifier, only allocate memory if necessary improve performance for LazyBuf reduce debug logging and memory allocation for ${:U...} reduce verbosity of the -dv debug logging for standard cases fix double varname expansion in the variable modifier '::=' o var.c: avoid evaluating many modifiers in parse only mode in strict mode (-dL) many variable references are parsed twice, the first time just to report parse errors early, so we want to avoid side effects and wasted effort to the extent possible.
45 lines
1.1 KiB
Makefile
45 lines
1.1 KiB
Makefile
# $NetBSD: directive-export.mk,v 1.8 2021/02/16 19:01:18 rillig Exp $
|
|
#
|
|
# Tests for the .export directive.
|
|
#
|
|
# See also:
|
|
# directive-misspellings.mk
|
|
|
|
# TODO: Implementation
|
|
|
|
INDIRECT= indirect
|
|
VAR= value $$ ${INDIRECT}
|
|
|
|
# Before 2020-12-13, this unusual expression invoked undefined behavior since
|
|
# it accessed out-of-bounds memory via Var_Export -> ExportVar -> MayExport.
|
|
.export ${:U }
|
|
|
|
# A variable is exported using the .export directive.
|
|
# During that, its value is expanded, just like almost everywhere else.
|
|
.export VAR
|
|
.if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect"
|
|
. error
|
|
.endif
|
|
|
|
# Undefining a variable that has been exported implicitly removes it from
|
|
# the environment of all child processes.
|
|
.undef VAR
|
|
.if ${:!env | grep '^VAR' || true!} != ""
|
|
. error
|
|
.endif
|
|
|
|
# No syntactical argument means to export all variables.
|
|
.export
|
|
|
|
# An empty argument means no additional variables to export.
|
|
.export ${:U}
|
|
|
|
|
|
# Trigger the "This isn't going to end well" in ExportVarEnv.
|
|
EMPTY_SHELL= ${:sh}
|
|
.export EMPTY_SHELL # only marked for export at this point
|
|
_!= :;: # Force the variable to be actually exported.
|
|
|
|
|
|
all:
|