Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: remove comment about environment variable...



details:   https://anonhg.NetBSD.org/src/rev/d9b77984fbeb
branches:  trunk
changeset: 361127:d9b77984fbeb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 11 21:44:10 2022 +0000

description:
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.

diffstat:

 usr.bin/make/var.c |  9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diffs (30 lines):

diff -r f57ec24a4fb4 -r d9b77984fbeb usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Feb 11 21:40:58 2022 +0000
+++ b/usr.bin/make/var.c        Fri Feb 11 21:44:10 2022 +0000
@@ -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 @@
                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)



Home | Main Index | Thread Index | Old Index