[DTrace-devel] [PATCH] test, options: work around a subtle lexer bug

Kris Van Hees kris.van.hees at oracle.com
Wed May 31 17:54:04 UTC 2023


On Wed, May 31, 2023 at 05:37:30PM +0100, Nick Alcock via DTrace-devel wrote:
> The err.pspec-default test hits a horrible eleven-year-old bug in the
> lexer (related to the move to flex from AT&T lex) which is triggering
> the printing of garbage instead of a nice syntax error when in state 0
> (possible probe name) and a type name is encountered, and its
> second-to-last character is a *, and we are otherwise at EOF.
> 
> Let's fix this obscure monster in the next release and just evade it for
> now.
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/options/err.pspec-default.r   | 2 +-
>  test/unittest/options/err.pspec-default.r.p | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>  create mode 100755 test/unittest/options/err.pspec-default.r.p
> 
> diff --git a/test/unittest/options/err.pspec-default.r b/test/unittest/options/err.pspec-default.r
> index d2e0535b334f9..6b25f56173d89 100644
> --- a/test/unittest/options/err.pspec-default.r
> +++ b/test/unittest/options/err.pspec-default.r
> @@ -1,2 +1,2 @@
>  -- @@stderr --
> -dtrace: failed to compile script test/unittest/options/err.pspec-default.d: line 14: syntax error near end-of-input
> +dtrace: failed to compile script test/unittest/options/err.pspec-default.d: line 14: syntax error near
> diff --git a/test/unittest/options/err.pspec-default.r.p b/test/unittest/options/err.pspec-default.r.p
> new file mode 100755
> index 0000000000000..a01bdaddebbd5
> --- /dev/null
> +++ b/test/unittest/options/err.pspec-default.r.p
> @@ -0,0 +1,4 @@
> +#!/bin/sed -f
> +# Chop off everything after the 'near' in the error message, to evade a bug
> +# at EOF in our scanner under flex < 2.6.
> +s/syntax error near.*$/syntax error near/g
> -- 
> 2.39.1.268.g9de2f9a303
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list