Bug 238586

Summary: od(1): Cannot use 8-byte output format
Product: Base System Reporter: Mohamed Akram <mohd.akram>
Component: binAssignee: Xin LI <delphij>
Status: Closed FIXED    
Severity: Affects Many People CC: delphij
Priority: ---    
Version: 12.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to fix the issue none

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(-)