Module Name: src Committed By: rillig Date: Tue May 9 08:26:14 UTC 2023
Modified Files: src/usr.bin/make/unit-tests: varmod-gmtime.exp varmod-gmtime.mk varmod-localtime.exp varmod-localtime.mk Log Message: tests/make: demonstrate parse bug in :gmtime and :localtime modifiers To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-gmtime.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-gmtime.mk cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-localtime.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-localtime.mk 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/unit-tests/varmod-gmtime.exp diff -u src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.12 src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.13 --- src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.12 Thu Dec 9 20:27:01 2021 +++ src/usr.bin/make/unit-tests/varmod-gmtime.exp Tue May 9 08:26:14 2023 @@ -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 Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.10 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.11 --- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.10 Tue Jan 19 05:26:34 2021 +++ src/usr.bin/make/unit-tests/varmod-gmtime.mk Tue May 9 08:26:14 2023 @@ -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: Index: src/usr.bin/make/unit-tests/varmod-localtime.exp diff -u src/usr.bin/make/unit-tests/varmod-localtime.exp:1.9 src/usr.bin/make/unit-tests/varmod-localtime.exp:1.10 --- src/usr.bin/make/unit-tests/varmod-localtime.exp:1.9 Thu Dec 9 20:27:01 2021 +++ src/usr.bin/make/unit-tests/varmod-localtime.exp Tue May 9 08:26:14 2023 @@ -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 Index: src/usr.bin/make/unit-tests/varmod-localtime.mk diff -u src/usr.bin/make/unit-tests/varmod-localtime.mk:1.8 src/usr.bin/make/unit-tests/varmod-localtime.mk:1.9 --- src/usr.bin/make/unit-tests/varmod-localtime.mk:1.8 Tue Jan 19 05:26:34 2021 +++ src/usr.bin/make/unit-tests/varmod-localtime.mk Tue May 9 08:26:14 2023 @@ -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: