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

Wayne Sierke ws at au.dyndns.ws
Tue Apr 20 03:20:04 UTC 2010


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

From: Wayne Sierke <ws at au.dyndns.ws>
To: Garrett Cooper <yanegomi at gmail.com>
Cc: bug-followup at freebsd.org
Subject: Re: bin/145748: hexdump(1) %s format qualifier broken
Date: Tue, 20 Apr 2010 12:33:14 +0930

 >  > "4" in %4s" is the field width.  "%.4s" has precision 4 and is =
 >  accepted,
 >  > but I don't know what most of this is supposed to do so I don't know =
 >  if
 >  > this actually works.
 
 As noted by Bruce, the provided test-case was setting field width
 instead of field precision. This seems to be a case of "works as
 advertised".
 
 # jot -b a 1024 | hexdump -e '"%.4s\n"'
 a
 a
 
 *
 # jot -b a 1024 | hexdump -e ' /4 "%s\n"'
 a
 a
 
 *
 # 
 
 I did stumble upon the following, however, which looks like a bug (if I
 haven't missed something):
 
 # jot -w "%07d" 32 0 | tr '\012' '\040' | hexdump -e '"%.32s\n"'
 0000000 0000001 0000002 0000003 
 0000004 0000005 0000006 0000007 
 0000008 0000009 0000010 0000011 
 0000012 0000013 0000014 0000015 
 0000016 0000017 0000018 0000019 
 0000020 0000021 0000022 0000023 
 0000024 0000025 0000026 0000027 
 0000028 0000029 0000030 0000031 
 # jot -w "%07d" 32 0 | tr '\012' '\040' | hexdump -e '/32 "%s\n"'
 0000000 0000001 0000002 0000003 
 0000004 0000005 0000006 0000007 
 0000008 0000009 0000010 0000011 0000004 0000005 0000006 0000007 
 0000012 0000013 0000014 0000015 
 0000016 0000017 0000018 0000019 0000012 0000013 0000014 0000015 
 0000020 0000021 0000022 0000023 
 0000024 0000025 0000026 0000027 0000020 0000021 0000022 0000023 
 0000028 0000029 0000030 0000031 
 # 
 
 Seems to be reproducible for "byte count" = 2^n (n=1,2,3,...).
 
 Should probably go in a new PR (although I haven't checked for an
 existing one).
 
 


More information about the freebsd-bugs mailing list