From owner-freebsd-bugs@FreeBSD.ORG Tue Apr 20 03:20:04 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35024106566B for ; Tue, 20 Apr 2010 03:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 252AE8FC17 for ; Tue, 20 Apr 2010 03:20:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o3K3K4Kb091040 for ; Tue, 20 Apr 2010 03:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o3K3K3iq091039; Tue, 20 Apr 2010 03:20:04 GMT (envelope-from gnats) Date: Tue, 20 Apr 2010 03:20:04 GMT Message-Id: <201004200320.o3K3K3iq091039@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Wayne Sierke Cc: Subject: Re: bin/145748: hexdump(1) %s format qualifier broken X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Wayne Sierke List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2010 03:20:04 -0000 The following reply was made to PR bin/145748; it has been noted by GNATS. From: Wayne Sierke To: Garrett Cooper Cc: bug-followup@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).