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

Nick Alcock nick.alcock at oracle.com
Tue May 2 17:12:22 UTC 2023


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.

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




More information about the DTrace-devel mailing list