Subject: bin/1080: kdump prints garbage with long program names
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Arne Henrik Juul <arnej@imf.unit.no>
List: netbsd-bugs
Date: 05/27/1995 10:35:04
>Number:         1080
>Category:       bin
>Synopsis:       kdump prints garbage after long program names.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 27 10:35:02 1995
>Originator:     arnej@pvv.unit.no
>Organization:
	University of Trondheim, Norway
>Release:        NetBSD-current, dated May 24, 1995
>Environment:
	This will probably happen on all -current NetBSDs.
System: NetBSD rtfm.imf.unit.no 1.0A NetBSD 1.0A (RTFM) #2: Sat May 20 00:42:51 MET DST 1995 arnej@rtfm.imf.unit.no:/usr/src/sys/arch/i386/compile/RTFM i386


>Description:
	
>How-To-Repeat:
	$ cd /tmp
	$ cat > programwithverylongname.c
	main(){write(1, "Hello, world!\n", 14);}
	^D
	$ cc -static programwithverylongname.c -o programwithverylongname
	$ ktrace /tmp/programwithverylongname
	$ kdump

	sample output:
  6976 ktrace   RET   ktrace 0
  6976 ktrace   CALL  execve(0xf7bfdb47,0xf7bfdae8,0xf7bfdaf0)
  6976 ktrace   NAMI  "/tmp/programwithverylongname"
  6976 programwithverylï¾­ÞrÂ/—B  RET   execve 0
  6976 programwithverylï¾­ÞrÂ/‚I  CALL  write(0x1,0x16f4,0xe)
  6976 programwithverylï¾­ÞrÂ/åL  GIO   fd 1 wrote 14 bytes
       "Hello, world!
       "
  6976 programwithverylï¾­ÞrÂ/ò]  RET   write 14/0xe
  6976 programwithverylï¾­ÞrÂ/3_  CALL  exit(0xe)

>Fix:
	Apply this patch:

--- kdump.c.orig	Fri May 12 13:09:28 1995
+++ kdump.c	Wed May 24 01:44:29 1995
@@ -204,7 +204,7 @@
 		type = unknown;
 	}
 
-	(void)printf("%6d %-8s ", kth->ktr_pid, kth->ktr_comm);
+	(void)printf("%6d %-8.16s ", kth->ktr_pid, kth->ktr_comm);
 	if (timestamp) {
 		if (timestamp == 2) {
 			timersub(&kth->ktr_time, &prevtime, &temp);
>Audit-Trail:
>Unformatted: