Module Name:    src
Committed By:   jakllsch
Date:           Fri Apr 19 14:58:18 UTC 2024

Modified Files:
        src/external/bsd/ntp/lib/libntp: Makefile

Log Message:
Increase MKREPRO robustness
 - Use C locale to ensure month abbreviations are as expected
 - bail out if MKREPRO_TIMESTAMP is not defined
 - bail out if resulting __DATE__/__TIME__ replacement strings are empty


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/external/bsd/ntp/lib/libntp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ntp/lib/libntp/Makefile
diff -u src/external/bsd/ntp/lib/libntp/Makefile:1.32 src/external/bsd/ntp/lib/libntp/Makefile:1.33
--- src/external/bsd/ntp/lib/libntp/Makefile:1.32	Fri Apr 19 13:34:15 2024
+++ src/external/bsd/ntp/lib/libntp/Makefile	Fri Apr 19 14:58:18 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2024/04/19 13:34:15 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.33 2024/04/19 14:58:18 jakllsch Exp $
 
 LIBISPRIVATE=yes
 
@@ -88,8 +88,14 @@ CPPFLAGS+= -I${IDIST}/sntp/libopts
 # For MKREPRO, avoid using __DATE__ and __TIME__.
 # Instead, use the date and time from ${MKREPRO_TIMESTAMP}
 .if ${MKREPRO:Uno} == "yes"
-MKREPRO_DATE != ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%b %e %Y"
-MKREPRO_TIME != ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%T"
+.if ${MKREPRO_TIMESTAMP:Uundefined} == "undefined"
+.error MKREPRO_TIMESTAMP is undefined with MKREPRO active
+.endif
+MKREPRO_DATE != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%b %e %Y"
+MKREPRO_TIME != env LC_ALL=C ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%T"
+.if ${MKREPRO_TIME} == "" || ${MKREPRO_TIME} == ""
+.error empty MKREPRO_DATE or MKREPRO_TIME
+.endif
 CPPFLAGS.ntp_calendar.c += -DMKREPRO_DATE=\"${MKREPRO_DATE:Q}\"
 CPPFLAGS.ntp_calendar.c += -DMKREPRO_TIME=\"${MKREPRO_TIME:Q}\"
 .endif

Reply via email to