[RFC PATCH] src/strace: Add a 'no-truncate' option to disable truncation

Dmitry V. Levin ldv at strace.io
Fri Jan 12 00:21:39 UTC 2024


On Thu, Jan 11, 2024 at 11:58:42PM +0530, Gautam Menghani wrote:
> On Thu, Jan 11, 2024 at 02:27:29AM +0200, Dmitry V. Levin wrote:
> > On Wed, Jan 10, 2024 at 10:37:28PM +0530, Gautam Menghani wrote:
> > > Introduce the "no-truncate" flag to disable truncation in strace
> > > output. This fixes issue 269 on github [1].
> > > 
> > > Signed-off-by: Gautam Menghani <gautammenghani201 at gmail.com>
> > > ---
> > > [1]: https://github.com/strace/strace/issues/269
> > > 
> > >  src/strace.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/strace.c b/src/strace.c
> > > index 780e51e91..5d80f6c1e 100644
> > > --- a/src/strace.c
> > > +++ b/src/strace.c
> > > @@ -2296,7 +2296,7 @@ init(int argc, char *argv[])
> > >  #endif
> > >  
> > >  	static const char optstring[] =
> > > -		"+a:Ab:cCdDe:E:fFhiI:kno:O:p:P:qrs:S:tTu:U:vVwxX:yYzZ";
> > > +		"+a:Ab:cCdDe:E:fFhiI:knNo:O:p:P:qrs:S:tTu:U:vVwxX:yYzZ";
> > >  
> > >  	enum {
> > >  		GETOPT_SECCOMP = 0x100,
> > > @@ -2350,6 +2350,7 @@ init(int argc, char *argv[])
> > >  		{ "stack-traces" ,	optional_argument, 0, GETOPT_STACK },
> > >  		{ "syscall-limit",	required_argument, 0, GETOPT_SYSCALL_LIMIT },
> > >  		{ "syscall-number",	no_argument,	   0, 'n' },
> > > +		{ "no-truncate",	no_argument,	0, 'N' },
> > >  		{ "output",		required_argument, 0, 'o' },
> > >  		{ "summary-syscall-overhead", required_argument, 0, 'O' },
> > >  		{ "attach",		required_argument, 0, 'p' },
> > > @@ -2537,6 +2538,10 @@ init(int argc, char *argv[])
> > >  		case 'n':
> > >  			nflag = 1;
> > >  			break;
> > > +		case 'N':
> > 
> > Why do you think adding a short option for this would be a good idea?
> > 
> > > +			qualify_abbrev("none");
> 
> Looking at the current supported options, I didn't see an obvious way to modify the 
> existing flags to solve this issue, so I thought of this way. Please do suggest a 
> better way if any.
> 
> Also we have "--abbrev=none" and "-v" which are equivalent. Likewise, we have 
> "--string-limit=<size>". Can we repurpose this to say "--string-limit=none" which will
> disable truncation? 

I think it's ok for -s/--string-limit to have non-numeric arguments.
Not sure about --string-limit=none because "-s none" looks confusing.
Maybe --string-limit=inf or --string-limit=unlimited is more
self-explanatory.

I'm not sure why a new option should imply another option.
That is, it's not obvious for me why e.g. "-s unlimited" should imply -v.


-- 
ldv


More information about the Strace-devel mailing list