Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests tests/make: demonstrate parse bug in...
details: https://anonhg.NetBSD.org/src/rev/95119a0a43cb
branches: trunk
changeset: 374645:95119a0a43cb
user: rillig <rillig%NetBSD.org@localhost>
date: Tue May 09 08:26:14 2023 +0000
description:
tests/make: demonstrate parse bug in :gmtime and :localtime modifiers
diffstat:
usr.bin/make/unit-tests/varmod-gmtime.exp | 20 ++++++++++----------
usr.bin/make/unit-tests/varmod-gmtime.mk | 16 ++++++++++++++--
usr.bin/make/unit-tests/varmod-localtime.exp | 20 ++++++++++----------
usr.bin/make/unit-tests/varmod-localtime.mk | 16 ++++++++++++++--
4 files changed, 48 insertions(+), 24 deletions(-)
diffs (146 lines):
diff -r a53d0ff500ad -r 95119a0a43cb usr.bin/make/unit-tests/varmod-gmtime.exp
--- a/usr.bin/make/unit-tests/varmod-gmtime.exp Tue May 09 02:31:02 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.exp Tue May 09 08:26:14 2023 +0000
@@ -1,13 +1,13 @@
-make: "varmod-gmtime.mk" line 57: Invalid time value at "${:U1593536400}} != "mtime=11593536400}""
-make: "varmod-gmtime.mk" line 57: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
-make: "varmod-gmtime.mk" line 67: Invalid time value at "-1} != """
-make: "varmod-gmtime.mk" line 67: Malformed conditional (${:L:gmtime=-1} != "")
-make: "varmod-gmtime.mk" line 76: Invalid time value at " 1} != """
-make: "varmod-gmtime.mk" line 76: Malformed conditional (${:L:gmtime= 1} != "")
-make: "varmod-gmtime.mk" line 119: Invalid time value at "10000000000000000000000000000000} != """
-make: "varmod-gmtime.mk" line 119: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
-make: "varmod-gmtime.mk" line 130: Invalid time value at "error} != """
-make: "varmod-gmtime.mk" line 130: Malformed conditional (${:L:gmtime=error} != "")
+make: "varmod-gmtime.mk" line 60: Invalid time value at "${:U1593536400}} != "mtime=11593536400}""
+make: "varmod-gmtime.mk" line 60: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
+make: "varmod-gmtime.mk" line 70: Invalid time value at "-1} != """
+make: "varmod-gmtime.mk" line 70: Malformed conditional (${:L:gmtime=-1} != "")
+make: "varmod-gmtime.mk" line 79: Invalid time value at " 1} != """
+make: "varmod-gmtime.mk" line 79: Malformed conditional (${:L:gmtime= 1} != "")
+make: "varmod-gmtime.mk" line 125: Invalid time value at "10000000000000000000000000000000} != """
+make: "varmod-gmtime.mk" line 125: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
+make: "varmod-gmtime.mk" line 136: Invalid time value at "error} != """
+make: "varmod-gmtime.mk" line 136: Malformed conditional (${:L:gmtime=error} != "")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r a53d0ff500ad -r 95119a0a43cb usr.bin/make/unit-tests/varmod-gmtime.mk
--- a/usr.bin/make/unit-tests/varmod-gmtime.mk Tue May 09 02:31:02 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.mk Tue May 09 08:26:14 2023 +0000
@@ -1,7 +1,10 @@
-# $NetBSD: varmod-gmtime.mk,v 1.10 2021/01/19 05:26:34 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.11 2023/05/09 08:26:14 rillig Exp $
#
# Tests for the :gmtime variable modifier, which formats a timestamp
# using strftime(3) in UTC.
+#
+# See also:
+# varmod-localtime.mk
.if ${TZ:Uundefined} != "undefined" # see unit-tests/Makefile
. error
@@ -75,6 +78,8 @@
# because it would make sense but just as a side-effect from using strtoul.
.if ${:L:gmtime= 1} != ""
. error
+.else
+. error
.endif
@@ -115,7 +120,8 @@
# ULONG_MAX, which got converted to -1. This resulted in a time stamp of
# the second before 1970.
#
-# Since var.c 1.631, the overflow is detected and produces a parse error.
+# Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a
+# parse error.
.if ${:L:gmtime=10000000000000000000000000000000} != ""
. error
.else
@@ -133,5 +139,11 @@
. error
.endif
+# Before var.c 1.TODO from XXXX-XX-XX, the timestamp could be directly
+# followed by the next modifier, without a ':' separator. This is the same
+# bug as for the ':L' and ':P' modifiers.
+.if ${%Y:L:gmtime=100000S,1970,bad,} != "bad"
+. error
+.endif
all:
diff -r a53d0ff500ad -r 95119a0a43cb usr.bin/make/unit-tests/varmod-localtime.exp
--- a/usr.bin/make/unit-tests/varmod-localtime.exp Tue May 09 02:31:02 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-localtime.exp Tue May 09 08:26:14 2023 +0000
@@ -1,13 +1,13 @@
-make: "varmod-localtime.mk" line 57: Invalid time value at "${:U1593536400}} != "mtime=11593536400}""
-make: "varmod-localtime.mk" line 57: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}")
-make: "varmod-localtime.mk" line 67: Invalid time value at "-1} != """
-make: "varmod-localtime.mk" line 67: Malformed conditional (${:L:localtime=-1} != "")
-make: "varmod-localtime.mk" line 76: Invalid time value at " 1} != """
-make: "varmod-localtime.mk" line 76: Malformed conditional (${:L:localtime= 1} != "")
-make: "varmod-localtime.mk" line 119: Invalid time value at "10000000000000000000000000000000} != """
-make: "varmod-localtime.mk" line 119: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
-make: "varmod-localtime.mk" line 130: Invalid time value at "error} != """
-make: "varmod-localtime.mk" line 130: Malformed conditional (${:L:localtime=error} != "")
+make: "varmod-localtime.mk" line 60: Invalid time value at "${:U1593536400}} != "mtime=11593536400}""
+make: "varmod-localtime.mk" line 60: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}")
+make: "varmod-localtime.mk" line 70: Invalid time value at "-1} != """
+make: "varmod-localtime.mk" line 70: Malformed conditional (${:L:localtime=-1} != "")
+make: "varmod-localtime.mk" line 79: Invalid time value at " 1} != """
+make: "varmod-localtime.mk" line 79: Malformed conditional (${:L:localtime= 1} != "")
+make: "varmod-localtime.mk" line 125: Invalid time value at "10000000000000000000000000000000} != """
+make: "varmod-localtime.mk" line 125: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
+make: "varmod-localtime.mk" line 136: Invalid time value at "error} != """
+make: "varmod-localtime.mk" line 136: Malformed conditional (${:L:localtime=error} != "")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r a53d0ff500ad -r 95119a0a43cb usr.bin/make/unit-tests/varmod-localtime.mk
--- a/usr.bin/make/unit-tests/varmod-localtime.mk Tue May 09 02:31:02 2023 +0000
+++ b/usr.bin/make/unit-tests/varmod-localtime.mk Tue May 09 08:26:14 2023 +0000
@@ -1,7 +1,10 @@
-# $NetBSD: varmod-localtime.mk,v 1.8 2021/01/19 05:26:34 rillig Exp $
+# $NetBSD: varmod-localtime.mk,v 1.9 2023/05/09 08:26:14 rillig Exp $
#
# Tests for the :localtime variable modifier, which formats a timestamp
# using strftime(3) in local time.
+#
+# See also:
+# varmod-gmtime.mk
.if ${TZ} != "Europe/Berlin" # see unit-tests/Makefile
. error
@@ -75,6 +78,8 @@
# because it would make sense but just as a side-effect from using strtoul.
.if ${:L:localtime= 1} != ""
. error
+.else
+. error
.endif
@@ -115,7 +120,8 @@
# ULONG_MAX, which got converted to -1. This resulted in a time stamp of
# the second before 1970.
#
-# Since var.c 1.631, the overflow is detected and produces a parse error.
+# Since var.c 1.631 from 2020-10-31, the overflow is detected and produces a
+# parse error.
.if ${:L:localtime=10000000000000000000000000000000} != ""
. error
.else
@@ -133,5 +139,11 @@
. error
.endif
+# Before var.c 1.TODO from XXXX-XX-XX, the timestamp could be directly
+# followed by the next modifier, without a ':' separator. This is the same
+# bug as for the ':L' and ':P' modifiers.
+.if ${%Y:L:localtime=100000S,1970,bad,} != "bad"
+. error
+.endif
all:
Home |
Main Index |
Thread Index |
Old Index