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

Gautam Menghani gautammenghani201 at gmail.com
Wed Jan 10 17:07:28 UTC 2024


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':
+			qualify_abbrev("none");
+			max_strlen = -1U / 4;
+			break;
 		case 'o':
 			outfname = optarg;
 			break;
-- 
2.34.1



More information about the Strace-devel mailing list