Module Name: src Committed By: rillig Date: Fri Feb 11 21:44:11 UTC 2022
Modified Files: src/usr.bin/make: var.c Log Message: make: remove comment about environment variable with empty name At least on NetBSD, make cannot be fooled with an environment variable having an empty name. When running '/usr/bin/env =undefined make', the argument is parsed as a variable assignment, but putenv(3) refuses to process an empty variable name. Calling execve(2) directly got a step further, the kernel didn't filter '=undefined' from the environment variables. But getenv(3) always returns NULL when querying the environment variable with the empty name. On other operating systems, things may be different. Trying to set an environment variable with an empty name may cause errors in env(1), putenv(3), execve(2), getenv(3) or other places, so don't add an automatic test for now. To generate a diff of this commit: cvs rdiff -u -r1.1011 -r1.1012 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1011 src/usr.bin/make/var.c:1.1012 --- src/usr.bin/make/var.c:1.1011 Wed Feb 9 21:32:38 2022 +++ src/usr.bin/make/var.c Fri Feb 11 21:44:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1011 2022/02/09 21:32:38 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1012 2022/02/11 21:44:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1011 2022/02/09 21:32:38 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1012 2022/02/11 21:44:10 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -432,11 +432,6 @@ VarFindSubstring(Substring name, GNode * FStr envName; const char *envValue; - /* - * TODO: try setting an environment variable with the empty - * name, which should be technically possible, just to see - * how make reacts. All .for loops should be broken then. - */ envName = Substring_Str(name); envValue = getenv(envName.str); if (envValue != NULL)