Bug 81495 - [patch] hexdump(1) format option does not allow literal '%' in output
Summary: [patch] hexdump(1) format option does not allow literal '%' in output
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2005-05-26 12:20 UTC by Hirohisa Yamaguchi
Modified: 2018-01-03 05:16 UTC (History)
0 users

See Also:

file.diff (337 bytes, patch)
2005-05-26 12:20 UTC, Hirohisa Yamaguchi
no flags Details | Diff
parse.diff (25.85 KB, patch)
2008-12-23 09:35 UTC, Garrett Cooper
no flags Details | Diff
bin.81495.diff (1.22 KB, patch)
2010-03-13 23:57 UTC, Garrett Cooper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.


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.
 $ 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.
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
    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

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...
Comment 5 Garrett Cooper 2010-03-13 23:57:11 UTC
    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.
Comment 6 Chris Rees freebsd_committer 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