From: Marc Espie Subject: make: refuse empty variable names To: tech@openbsd.org Date: Sun, 14 Jun 2026 11:01:47 +0200 Found by accident while looking at www/dufs/crates.inc gmake refuses empty variable names, I think we should too. Especially if we make typos and end up expanding empty stuff. (currently, stuff that starts with an = will be treated as a comment) This needs to get through a full release, obviously... Index: usr.bin/make/parsevar.c =================================================================== RCS file: /build/data/openbsd/cvs/src/usr.bin/make/parsevar.c,v diff -u -p -r1.18 parsevar.c --- usr.bin/make/parsevar.c 18 Jun 2024 02:11:03 -0000 1.18 +++ usr.bin/make/parsevar.c 14 Jun 2026 08:54:16 -0000 @@ -72,6 +72,9 @@ parse_variable_assignment(const char *li arg = VarName_Get(line, &name, NULL, true, find_op1); + if (name.s == name.e) + Parse_Error(PARSE_FATAL, "empty variable name"); + while (ISSPACE(*arg)) arg++; Index: regress/usr.bin/make/Makefile =================================================================== RCS file: /build/data/openbsd/cvs/src/regress/usr.bin/make/Makefile,v diff -u -p -r1.51 Makefile --- regress/usr.bin/make/Makefile 2 Sep 2021 07:14:15 -0000 1.51 +++ regress/usr.bin/make/Makefile 14 Jun 2026 09:00:21 -0000 @@ -4,7 +4,7 @@ REGRESS_TARGETS= t1 t2 t3 t4 t5 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 \ t20 t21 t22 t23 t24 t25 t26 t27 t28 t29 \ t30 t31 t32 t33 t34 t35 t36 t37 t38 t38j t39 \ - t40 t41 t42 t42bis t43 t44 t45 t46 t47 t48 + t40 t41 t42 t42bis t43 t44 t45 t46 t47 t48 t49 REGRESS_EXPECTED_FAILURES = t14 t17 t18 @@ -204,6 +204,11 @@ t47: tok.o t48: cd ${.CURDIR} && make -r -f mk43 a + +t49: + if cd ${.CURDIR} && env -i PATH=${PATH} ${MAKE} -r -f mk44 all 2>/dev/null; then \ + false; \ + fi t1.out: echo MACHINE_ARCH=${MACHINE_ARCH} >$@ Index: regress/usr.bin/make/mk44 =================================================================== RCS file: regress/usr.bin/make/mk44 diff -N regress/usr.bin/make/mk44 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ regress/usr.bin/make/mk44 14 Jun 2026 08:58:01 -0000 @@ -0,0 +1,7 @@ +# empty variable ! += + +all: + echo "not okay" + +.PHONY: all