All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5] trace: handle the empty string in a sensible way
@ 2025-08-13 15:57 Kris Van Hees
  2025-08-14 16:18 ` [DTrace-devel] " Eugene Loh
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Van Hees @ 2025-08-13 15:57 UTC (permalink / raw)
  To: dtrace, dtrace-devel

The trace("") action would dump a series of 0x00 bytes (strsize of
them) rather than printing an empty string.  While that is the legacy
behaviour, it does not really make any sense to do so.  The trace
action is described as printing data as a string if possible, and a
block of 0-bytes can certainly be printed as an empty string.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 libdtrace/dt_consume.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdtrace/dt_consume.c b/libdtrace/dt_consume.c
index edfe5bbae..2dce69d6d 100644
--- a/libdtrace/dt_consume.c
+++ b/libdtrace/dt_consume.c
@@ -991,7 +991,7 @@ dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
 		    c[i] == '\b' || c[i] == '\a')
 			continue;
 
-		if (c[i] == '\0' && i > 0) {
+		if (c[i] == '\0') {
 			/*
 			 * This looks like it might be a string.  Before we
 			 * assume that it is indeed a string, check the
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-14 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 15:57 [PATCH 4/5] trace: handle the empty string in a sensible way Kris Van Hees
2025-08-14 16:18 ` [DTrace-devel] " Eugene Loh
2025-08-14 19:38   ` Kris Van Hees

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.