Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh Make ${NETBSD_SHELL} value include (a human recognis...
details: https://anonhg.NetBSD.org/src/rev/f0800068c57e
branches: trunk
changeset: 353614:f0800068c57e
user: kre <kre%NetBSD.org@localhost>
date: Sun May 14 11:23:33 2017 +0000
description:
Make ${NETBSD_SHELL} value include (a human recognisable form of)
MKREPRO_TIMESTAMP (as an additional word in the value, with a "BUILD:" prefix)
if it is set during the build. (Trailing 00 pairs in the time are removed).
While here, throw in some extra words that list the compilation
options used which alter sh behaviour (mostly by removing stuff.)
Usually that will only be noticed in a SMALL shell compiled for
install media, or similar - none of the others (not that there
are many) are ever changed from the default in a normal build
(default settings are just omitted.) This also allows scripts
to tell if they are running in a DEBUG shell, which can sometimes
make debugging easier.
diffstat:
bin/sh/Makefile | 10 +++++++++-
bin/sh/var.c | 41 ++++++++++++++++++++++++++++++++++++-----
2 files changed, 45 insertions(+), 6 deletions(-)
diffs (91 lines):
diff -r 73a310f42c6e -r f0800068c57e bin/sh/Makefile
--- a/bin/sh/Makefile Sun May 14 11:17:04 2017 +0000
+++ b/bin/sh/Makefile Sun May 14 11:23:33 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.104 2017/03/20 11:26:07 kre Exp $
+# $NetBSD: Makefile,v 1.105 2017/05/14 11:23:33 kre Exp $
# @(#)Makefile 8.4 (Berkeley) 5/5/95
.include <bsd.own.mk>
@@ -29,6 +29,14 @@
#CFLAGS+=-funsigned-char
#TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" -funsigned-char
+# Reproducible build parameters ... export into sh for NETBSD_SHELL setting
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+BUILD_DATE!= date -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
+# These are (should be) equivalent, but the 2nd is easier to understand
+#CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:C/([^0]0?)(00)*$/\1/}Z"'
+CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00//}Z"'
+.endif
+
.ifdef SMALLPROG
CPPFLAGS+=-DSMALL
.endif
diff -r 73a310f42c6e -r f0800068c57e bin/sh/var.c
--- a/bin/sh/var.c Sun May 14 11:17:04 2017 +0000
+++ b/bin/sh/var.c Sun May 14 11:23:33 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.52 2017/05/10 06:18:43 kre Exp $ */
+/* $NetBSD: var.c,v 1.53 2017/05/14 11:23:33 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: var.c,v 1.52 2017/05/10 06:18:43 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.53 2017/05/14 11:23:33 kre Exp $");
#endif
#endif /* not lint */
@@ -162,14 +162,45 @@
}
/*
+ * Set variables which override anything read from environment.
+ *
* PPID is readonly
- * set after processing environ to override anything there
- * Always default IFS, ignore any value from environment.
+ * Always default IFS
+ * NETBSD_SHELL is a constant (readonly), and is never exported
*/
snprintf(buf, sizeof(buf), "%d", (int)getppid());
setvar("PPID", buf, VREADONLY);
setvar("IFS", ifs_default, VTEXTFIXED);
- setvar("NETBSD_SHELL", NETBSD_SHELL, VTEXTFIXED|VREADONLY|VNOEXPORT);
+
+ setvar("NETBSD_SHELL", NETBSD_SHELL
+#ifdef BUILD_DATE
+ " BUILD:" BUILD_DATE
+#endif
+#ifdef DEBUG
+ " DEBUG"
+#endif
+#if !defined(JOBS) || JOBS == 0
+ " -JOBS"
+#endif
+#ifndef DO_SHAREDVFORK
+ " -VFORK"
+#endif
+#ifdef SMALL
+ " SMALL"
+#endif
+#ifdef TINY
+ " TINY"
+#endif
+#ifdef OLD_TTY_DRIVER
+ " OLD_TTY"
+#endif
+#ifdef SYSV
+ " SYSV"
+#endif
+#ifndef BSD
+ " -BSD"
+#endif
+ , VTEXTFIXED|VREADONLY|VNOEXPORT);
}
#endif
Home |
Main Index |
Thread Index |
Old Index