Bug 81495

Summary: [patch] hexdump(1) format option does not allow literal '%' in output
Product: Base System Reporter: Hirohisa Yamaguchi <umq>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 6.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
parse.diff
none
bin.81495.diff none

Description Hirohisa Yamaguchi 2005-05-26 12:20:01 UTC
I cannot get literal '%' in hexdump(1) output with any format_string.
Though the man page mentions exceptions in fprintf-style format,
there's no explanation why '%' cannot be printed.

Fix: a) If there's any historical reasons to be so, update the man page; to mention that literal '%' cannot be included in output.

or

b) fix it.
I wrote a patch, not thoroughly tested. And flag name is, perhaps, not appropriate.
How-To-Repeat: exec hexdump(1) with format_string which contains '%%' to get literal '%' in output.
e.g.)
 $ echo foo | hexdump -e '"" /1 "%%%02x" "\n"'

I got:
 hexdump: %%: bad conversion character
Comment 1 Garrett Cooper 2008-06-21 21:57:47 UTC
Patch previously submitted doesn't compile now.
-Garrett
Comment 2 Gavin Atkinson freebsd_committer freebsd_triage 2008-06-23 18:43:18 UTC
Responsible Changed
From-To: freebsd-bugs->gcooper

Give to gcooper, he's working on this
Comment 3 Garrett Cooper 2008-12-23 09:35:09 UTC
Hirohisa,
    Please try the attached patch -- or alternatively
<http://pastebin.com/f5548a625>. Be sure to check the MD5 if you use
pastebin though -- it should be:

MD5 (parse.diff) = bf969fe8de1471ad6e44a0954766d67b

Cheers,
-Garrett
Comment 4 Garrett Cooper 2010-02-06 20:46:55 UTC
    Getting back to this PR...
    1. Hirohisa's patch has an issue with the following input:

hexdump -e '/1 "%%%02x" "\n"'

    This would translate properly using printf(3), and thus violates
this precondition noted for hexdump in the manpage.
    2. My previous patch is overly noisy and should be rejected.
    Still working on it...
Thanks,
-Garrett
Comment 5 Garrett Cooper 2010-03-13 23:57:11 UTC
Hirohisa,
    Please try the following diff. It passes all of my unit tests, but
I just want to confirm that it passes from your end as well.
Thanks,
-Garrett
Comment 6 Chris Rees freebsd_committer freebsd_triage 2012-07-02 21:45:48 UTC
Responsible Changed
From-To: gcooper->freebsd-bugs

gcooper is not a developer
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:52 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 8 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:24 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>