Guys, am I missing something or is that \0 at the end a bug of %S ? My reasoning is -- it servers no purpose; seems to be impossible to get rid of and makes %S not all that appealing for post processing of DTrace output that might contain unprintable characters. Thoughts? $ cat q.d #!/usr/sbin/dtrace -qs BEGIN { st = "\"Roman\''"; printf("%S\n", st); } $ ./q.d \"Roman\\''\0 ^C Thanks, Roman.
Philosophically, I guess this depends on whether you consider the null at the end of a string, part of the string. I would have said no. IMHO, the null is not part of the data and shouldn''t be displayed. Chip Roman Shaposhnik wrote:> Guys, > > am I missing something or is that \0 at the end a bug of %S ? > My reasoning is -- it servers no purpose; seems to be impossible > to get rid of and makes %S not all that appealing for post processing > of DTrace output that might contain unprintable characters. > > Thoughts? > > $ cat q.d > #!/usr/sbin/dtrace -qs > > BEGIN { > st = "\"Roman\''"; > printf("%S\n", st); > } > $ ./q.d > \"Roman\\''\0 > ^C > > Thanks, > Roman. > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
On Wed, 2007-12-19 at 23:02 -0600, Chip Bennett wrote:> Philosophically, I guess this depends on whether you consider the null > at the end of a string, part of the string. I would have said no. > IMHO, the null is not part of the data and shouldn''t be displayed.That''s pretty much my reasoning as well. Would filing an RFE for the ''\0'' to be removed make sense? Once ''\0'' is removed from %S getting it back would be as easy as: printf("%S\\0", string); so it seems that everybody wins. Thanks, Roman.> Chip > > Roman Shaposhnik wrote: > > Guys, > > > > am I missing something or is that \0 at the end a bug of %S ? > > My reasoning is -- it servers no purpose; seems to be impossible > > to get rid of and makes %S not all that appealing for post processing > > of DTrace output that might contain unprintable characters. > > > > Thoughts? > > > > $ cat q.d > > #!/usr/sbin/dtrace -qs > > > > BEGIN { > > st = "\"Roman\''"; > > printf("%S\n", st); > > } > > $ ./q.d > > \"Roman\\''\0 > > ^C > > > > Thanks, > > Roman. > > > > _______________________________________________ > > dtrace-discuss mailing list > > dtrace-discuss at opensolaris.org > > >
On Thu, Dec 20, 2007 at 12:42:14PM -0800, Roman Shaposhnik wrote:> On Wed, 2007-12-19 at 23:02 -0600, Chip Bennett wrote: > > Philosophically, I guess this depends on whether you consider the null > > at the end of a string, part of the string. I would have said no. > > IMHO, the null is not part of the data and shouldn''t be displayed. > > That''s pretty much my reasoning as well. Would filing an RFE > for the ''\0'' to be removed make sense? Once ''\0'' is removed from > %S getting it back would be as easy as: > > printf("%S\\0", string); > > so it seems that everybody wins. > > Thanks, > Roman.This is my bad. When I did the %S stuff I copied my own code from mdb /C where \0 is useful, e.g <address>/40C on zeroed data gives you \0\0\0 ... but for %S the \0 at the end should not be printed. Please open an RFE. -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/