New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"hexdump file" displays incorrect Windows text file line termination #2817
Comments
hexdump without options dumps the data as little-endian two byte integers, I guess. Are you sure it's a bug? |
Let's say I have never used hexdump before, and I need to look at a
file I know to be a binary file. I don't need to see the character
display with the -C option, nor do I even know about that option
without fully reading the manpage. I use the following command:
$ hexdump file
Why would you think that, by default, I want to see the file in "little
-endian two byte integers"?
How would I know that the format of the display is not the same as it
appears in the file, and what format is actually used?
Wouldn't I want to see the file in hex exactly as it appears on the
disk, without fully studying the manpage for hexdump?
Why should hexdump not operate like "cat" on a text file, and display
as is on the disk?
How would I know that the "Magic Number" of the file is not displayed
correctly? (https://en.wikipedia.org/wiki/List_of_file_signatures)
Look at the "Magic Number" for "Encapsulated PostScript" files, among
other multibyte numbers.
You have provided many options to control the display of the file
contents, and this is very useful.
IMHO, the default hex display of the bytes in the file should be the
same with or without using the -C option!
Call it a "bug" or a major "design flaw", it should be corrected to
display the bytes as they appear in the file, by default, unless one or
more of the options are used.
…On Fri, 2024-05-03 at 21:25 -0700, Selorax wrote:
> > > hexdump without options dumps the data as little-endian two
> > > byte
> > > integers, I guess. Are you sure it's a bug?
> > > —
> > > Reply to this email directly, view it on GitHub, or
> > > unsubscribe.
> > > You are receiving this because you authored the thread.Message
> > > ID:
> > > ***@***.***>
|
"little-endian two byte integers"
Endianness (https://en.wikipedia.org/wiki/Endianness) is for how
integer data is stored in memory, NOT in a file.
Standard file formats (https://docs.fileformat.com)or custom file
formats define the type of data in the file, it's order, and how it is
stored in the file! Integers in a file could be stored in Big Endian,
Little Endian, or some other endian format, plus, the size of any
integers could not be assumed!
Hexdump cannot assume a file of two byte integers, unless provided with
format options!
So by default, converting any data in a file into any format in memory,
other than the order in the file, is most certainly both a major "Bug"
and a major "Design Flaw".
…On Fri, 2024-05-03 at 21:25 -0700, Selorax wrote:
hexdump without options dumps the data as little-endian two byte
integers, I guess. Are you sure it's a bug?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Indeed, if I was designing this program, I would make hexdump -C like output the default. You can also make it an alias in your Actually besides
I am not sure about that. Output and default options of many command line utilities is mandated by POSIX specification. Besides some people might depend on default output format of hexdump without extra options. Please refer to aforementioned text if you are interested. Also, I am not a developer, I'm a user like you. |
Debian Linux Testing (Trixie)
util-linux 2.39.3
"hexdump file", with no command line args, shows incorrect display of hex characters, spacing and byte order
$ hexdump data.txt
0000000 6554 7473 0a0d
0000006
"hexdump -C file", shows correct byte order and spacing
$ hexdump -C data.txt
00000000 54 65 73 74 0d 0a |Test..|
00000006
data.txt
The text was updated successfully, but these errors were encountered: