[DTrace-devel] [PATCH 7/7] options: give the value of rejected options

Kris Van Hees kris.van.hees at oracle.com
Sun May 14 00:06:15 UTC 2023


On Tue, May 02, 2023 at 06:12:22PM +0100, Nick Alcock via DTrace-devel wrote:
> DTrace has long emitted error messages which complain about the value of
> options being invalid without at any point saying what the rejected
> value was.  This is needlessly unhelpful, and now that option error
> handling is centralized, it's easy to fix.  Surprisingly, only one
> test depends on the old behaviour.

While this is useful behaviour, it is also not consistent with the behaviour
that DTrace has presented in all previous versions.  So at a minimum, if we
choose to go this route, we need to document this as a difference from what
DTrace used to do.

The claim that only one test is affected by this is not correct because some
of the work e.g. Eugene has done includes tests that have expected output that
reflects the original behaviour.

> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>  cmd/dtrace.c                        | 6 +++++-
>  test/unittest/options/err.version.r | 2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/dtrace.c b/cmd/dtrace.c
> index 982a8f36decf9..2a12eca39c9c9 100644
> --- a/cmd/dtrace.c
> +++ b/cmd/dtrace.c
> @@ -608,7 +608,11 @@ setopt_err_handler(const dtrace_setopterr_t *data, void *unused)
>  	else
>  		opttype = "DTrace option";
>  
> -	dfatal("failed to set %s %s", opttype, data->dtso_opt);
> +	if (data->dtso_val != NULL)
> +		dfatal("failed to set %s %s=%s", opttype, data->dtso_opt,
> +		    data->dtso_val);
> +	else
> +		dfatal("failed to set %s %s", opttype, data->dtso_opt);
>  }
>  
>  #define	BUFDUMPHDR(hdr) \
> diff --git a/test/unittest/options/err.version.r b/test/unittest/options/err.version.r
> index 6cdd1f7fc6782..a17d87b392693 100644
> --- a/test/unittest/options/err.version.r
> +++ b/test/unittest/options/err.version.r
> @@ -1,2 +1,2 @@
>  -- @@stderr --
> -dtrace: failed to set -x version: Requested version is not supported by compiler
> +dtrace: failed to set -x version=99.1: Requested version is not supported by compiler
> -- 
> 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