Module Name:    src
Committed By:   sjg
Date:           Wed Nov 25 00:50:44 UTC 2020

Modified Files:
        src/usr.bin/make: main.c make.1
        src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp
            suff-main-several.exp suff-transform-debug.exp

Log Message:
Add .MAKE.UID and .MAKE.GID


To generate a diff of this commit:
cvs rdiff -u -r1.479 -r1.480 src/usr.bin/make/main.c
cvs rdiff -u -r1.292 -r1.293 src/usr.bin/make/make.1
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-graph1.exp
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-main-several.exp \
    src/usr.bin/make/unit-tests/suff-transform-debug.exp

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/main.c
diff -u src/usr.bin/make/main.c:1.479 src/usr.bin/make/main.c:1.480
--- src/usr.bin/make/main.c:1.479	Tue Nov 24 19:52:06 2020
+++ src/usr.bin/make/main.c	Wed Nov 25 00:50:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.479 2020/11/24 19:52:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.480 2020/11/25 00:50:44 sjg Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1442,6 +1442,10 @@ main_Init(int argc, char **argv)
 		Var_Set(".MAKE.PID", tmp, VAR_GLOBAL);
 		snprintf(tmp, sizeof tmp, "%u", getppid());
 		Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL);
+		snprintf(tmp, sizeof tmp, "%u", getuid());
+		Var_Set(".MAKE.UID", tmp, VAR_GLOBAL);
+		snprintf(tmp, sizeof tmp, "%u", getgid());
+		Var_Set(".MAKE.GID", tmp, VAR_GLOBAL);
 	}
 	if (makelevel > 0) {
 		char pn[1024];

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.292 src/usr.bin/make/make.1:1.293
--- src/usr.bin/make/make.1:1.292	Sat Nov 14 22:19:13 2020
+++ src/usr.bin/make/make.1	Wed Nov 25 00:50:44 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.292 2020/11/14 22:19:13 rillig Exp $
+.\"	$NetBSD: make.1,v 1.293 2020/11/25 00:50:44 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd November 14, 2020
+.Dd November 24, 2020
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -1018,6 +1018,12 @@ If set to false,
 becomes
 .Ql $
 per normal evaluation rules.
+.It Va .MAKE.UID
+The user-id running
+.Nm .
+.It Va .MAKE.GID
+The group-id running
+.Nm .
 .It Va MAKE_PRINT_VAR_ON_ERROR
 When
 .Nm

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.225 src/usr.bin/make/unit-tests/Makefile:1.226
--- src/usr.bin/make/unit-tests/Makefile:1.225	Wed Nov 25 00:32:18 2020
+++ src/usr.bin/make/unit-tests/Makefile	Wed Nov 25 00:50:44 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.225 2020/11/25 00:32:18 sjg Exp $
+# $NetBSD: Makefile,v 1.226 2020/11/25 00:50:44 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -193,7 +193,7 @@ TESTS+=		modmatch
 TESTS+=		modmisc
 TESTS+=		modts
 TESTS+=		modword
-.if ${id -u:L:sh} > 0
+.if ${.MAKE.UID:U0} > 0
 TESTS+=		objdir-writable
 .endif
 TESTS+=		opt

Index: src/usr.bin/make/unit-tests/opt-debug-graph1.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.6 src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.7
--- src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.6	Mon Nov 23 16:01:59 2020
+++ src/usr.bin/make/unit-tests/opt-debug-graph1.exp	Wed Nov 25 00:50:44 2020
@@ -20,6 +20,7 @@
 .LIBS            = 
 .MAKE            = <details omitted>
 .MAKE.DEPENDFILE = <details omitted>
+.MAKE.GID        = <details omitted>
 .MAKE.LEVEL      = <details omitted>
 .MAKE.MAKEFILES  = <details omitted>
 .MAKE.MAKEFILE_PREFERENCE = <details omitted>
@@ -27,6 +28,7 @@
 .MAKE.PATH_FILEMON = <details omitted>
 .MAKE.PID        = <details omitted>
 .MAKE.PPID       = <details omitted>
+.MAKE.UID        = <details omitted>
 .MAKEFLAGS       =  -r -k -d g1
 .MAKEOVERRIDES   = 
 .OBJDIR          = <curdir>

Index: src/usr.bin/make/unit-tests/suff-main-several.exp
diff -u src/usr.bin/make/unit-tests/suff-main-several.exp:1.1 src/usr.bin/make/unit-tests/suff-main-several.exp:1.2
--- src/usr.bin/make/unit-tests/suff-main-several.exp:1.1	Sun Nov 22 20:36:17 2020
+++ src/usr.bin/make/unit-tests/suff-main-several.exp	Wed Nov 25 00:50:44 2020
@@ -85,6 +85,7 @@ ParseDoDependency(.MAKEFLAGS: -d0 -dg1)
 .LIBS            = 
 .MAKE            = <details omitted>
 .MAKE.DEPENDFILE = <details omitted>
+.MAKE.GID        = <details omitted>
 .MAKE.LEVEL      = <details omitted>
 .MAKE.MAKEFILES  = <details omitted>
 .MAKE.MAKEFILE_PREFERENCE = <details omitted>
@@ -92,6 +93,7 @@ ParseDoDependency(.MAKEFLAGS: -d0 -dg1)
 .MAKE.PATH_FILEMON = <details omitted>
 .MAKE.PID        = <details omitted>
 .MAKE.PPID       = <details omitted>
+.MAKE.UID        = <details omitted>
 .MAKEFLAGS       =  -r -k -d mps -d 0 -d g1
 .MAKEOVERRIDES   = 
 .OBJDIR          = <curdir>
Index: src/usr.bin/make/unit-tests/suff-transform-debug.exp
diff -u src/usr.bin/make/unit-tests/suff-transform-debug.exp:1.1 src/usr.bin/make/unit-tests/suff-transform-debug.exp:1.2
--- src/usr.bin/make/unit-tests/suff-transform-debug.exp:1.1	Sun Nov 22 23:45:20 2020
+++ src/usr.bin/make/unit-tests/suff-transform-debug.exp	Wed Nov 25 00:50:44 2020
@@ -11,6 +11,7 @@
 .LIBS            = 
 .MAKE            = <details omitted>
 .MAKE.DEPENDFILE = <details omitted>
+.MAKE.GID        = <details omitted>
 .MAKE.LEVEL      = <details omitted>
 .MAKE.MAKEFILES  = <details omitted>
 .MAKE.MAKEFILE_PREFERENCE = <details omitted>
@@ -18,6 +19,7 @@
 .MAKE.PATH_FILEMON = <details omitted>
 .MAKE.PID        = <details omitted>
 .MAKE.PPID       = <details omitted>
+.MAKE.UID        = <details omitted>
 .MAKEFLAGS       =  -r -k -d g1
 .MAKEOVERRIDES   = 
 .OBJDIR          = <curdir>

Reply via email to