bin/145748: hexdump(1) %s format qualifier broken

Garrett Cooper yanegomi at gmail.com
Fri Apr 16 07:30:06 UTC 2010


The following reply was made to PR bin/145748; it has been noted by GNATS.

From: Garrett Cooper <yanegomi at gmail.com>
To: bug-followup at FreeBSD.org, gcooper at FreeBSD.org
Cc:  
Subject: Re: bin/145748: hexdump(1) %s format qualifier broken
Date: Fri, 16 Apr 2010 00:25:16 -0700

 This works however:
     echo "$(jot -b a 1024)" | hexdump  -e '/1 "%4s\n"'
 The FSM is skipping over the format qualifier for %s in size()
 according to some basic poking via gdb, because of trailing characters
 after the qualifier:
 
 (gdb) set args -e '"%4s\n"' foo
 (gdb) r
 Starting program: /usr/src/usr.bin/hexdump/hexdump -e '"%4s\n"' foo
 
 Breakpoint 2, size (fs=0x800c07040) at parse.c:174
 174				while (index(spec + 1, *++fmt));
 (gdb) n
 
 Breakpoint 2, size (fs=0x800c07040) at parse.c:174
 174				while (index(spec + 1, *++fmt));
 (gdb) n
 175				if (*fmt == '.' && isdigit(*++fmt)) {
 (gdb) p fmt
 $1 = (unsigned char *) 0x800c09062 "s\n"
 
 So the format strings with the qualifier itself aren't being properly
 divvied up, which is a more difficult state to deal with than I
 originally anticipated I'd be dealing with >:(... This comes back to
 the code mess in add() I have to deal with in several other PRs.
 
 Thanks,
 -Garrett


More information about the freebsd-bugs mailing list