Bug 238586 - od(1): Cannot use 8-byte output format
Summary: od(1): Cannot use 8-byte output format
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-15 17:34 UTC by Mohamed Akram
Modified: 2023-06-05 02:24 UTC (History)
1 user (show)

See Also:


Attachments
patch to fix the issue (265 bytes, patch)
2023-06-04 23:50 UTC, Mohamed Akram
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Akram 2019-06-15 17:34:20 UTC
The following doesn't work even though it is specified by POSIX:

printf 12345678 > file
od -tx8 file
od -txL file
Comment 1 Mohamed Akram 2023-06-04 23:50:11 UTC
Created attachment 242604 [details]
patch to fix the issue
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2023-06-04 23:56:45 UTC
These days we have moved past using the [patch] tag, as we can infer the existance of a patchg from the metadata of the attachment.  Thanks.
Comment 3 Xin LI freebsd_committer freebsd_triage 2023-06-05 02:13:10 UTC
(In reply to Mohamed Akram from comment #1)
This is not complete; 's8' should be int64_t, or we would be overwriting the surrounding stack with the subsequent bcopy().

I'll commit a modified version to reflect that.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-06-05 02:24:49 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=37e3f5b23b0720223186f5a00108fdb8d3e88150

commit 37e3f5b23b0720223186f5a00108fdb8d3e88150
Author:     Ben Harris <bjh21@netbsd.org>
AuthorDate: 2001-12-07 13:37:39 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2023-06-05 02:23:35 +0000

    Enable support for printing 8-byte integers.  For some reason, most of the
    code for this was present, but disabled.
    This is required for POSIX compliance on platforms with 8-byte longs.

    Obtained-From:  NetBSD
    PR:             238586
    Reported-By:    Mohamed Akram <mohd.akram@outlook.com>
    MFC after:      2 weeks

 usr.bin/hexdump/display.c | 2 +-
 usr.bin/hexdump/parse.c   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)