Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Add .MAKE.UID and .MAKE.GID



details:   https://anonhg.NetBSD.org/src/rev/621ec07c36be
branches:  trunk
changeset: 946366:621ec07c36be
user:      sjg <sjg%NetBSD.org@localhost>
date:      Wed Nov 25 00:50:44 2020 +0000

description:
Add .MAKE.UID and .MAKE.GID

diffstat:

 usr.bin/make/main.c                              |   8 ++++++--
 usr.bin/make/make.1                              |  10 ++++++++--
 usr.bin/make/unit-tests/Makefile                 |   4 ++--
 usr.bin/make/unit-tests/opt-debug-graph1.exp     |   2 ++
 usr.bin/make/unit-tests/suff-main-several.exp    |   2 ++
 usr.bin/make/unit-tests/suff-transform-debug.exp |   2 ++
 6 files changed, 22 insertions(+), 6 deletions(-)

diffs (135 lines):

diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/main.c       Wed Nov 25 00:50:44 2020 +0000
@@ -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 @@
                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];
diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/make.1
--- a/usr.bin/make/make.1       Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/make.1       Wed Nov 25 00:50:44 2020 +0000
@@ -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 @@
 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
diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Wed Nov 25 00:50:44 2020 +0000
@@ -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+=                modmisc
 TESTS+=                modts
 TESTS+=                modword
-.if ${id -u:L:sh} > 0
+.if ${.MAKE.UID:U0} > 0
 TESTS+=                objdir-writable
 .endif
 TESTS+=                opt
diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/unit-tests/opt-debug-graph1.exp
--- a/usr.bin/make/unit-tests/opt-debug-graph1.exp      Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-graph1.exp      Wed Nov 25 00:50:44 2020 +0000
@@ -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>
diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/unit-tests/suff-main-several.exp
--- a/usr.bin/make/unit-tests/suff-main-several.exp     Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-main-several.exp     Wed Nov 25 00:50:44 2020 +0000
@@ -85,6 +85,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>
@@ -92,6 +93,7 @@
 .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>
diff -r e61d90738ef5 -r 621ec07c36be usr.bin/make/unit-tests/suff-transform-debug.exp
--- a/usr.bin/make/unit-tests/suff-transform-debug.exp  Wed Nov 25 00:32:18 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-transform-debug.exp  Wed Nov 25 00:50:44 2020 +0000
@@ -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>



Home | Main Index | Thread Index | Old Index