[NOT A BUG] Serious hexdump bug

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

[NOT A BUG] Serious hexdump bug

Post by Marco »

You can test it with latest beta and the attached file (it's supposed to be the header of an mp3 file).
Correct dump is

Code: Select all

49 00 44 00 33 00 04 00 00 00 80 00 00 00 03 00 28 00 06 00 
XY wrongly reports

Code: Select all

49 00 44 00 33 00 04 00 00 00 AC 20 00 00 03 00 28 00 06 00 
as a result of

Code: Select all

text hexdump(readfile(<curitem>), 1, "r");
To see the attached files, you need to log into the forum.
Last edited by Marco on 14 Jun 2014 09:37, edited 2 times in total.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66254
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Serious hexdump bug

Post by admin »

No file attached.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Serious hexdump bug

Post by Marco »

PS: I solved by using

Code: Select all

text hexdump(readfile(<curitem>), , "r");
meanwhile
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66254
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Serious hexdump bug

Post by admin »

So, false alarm, right?

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Serious hexdump bug

Post by Marco »

I found a way that gives the correct result (call it a workaround), but the bug is still there.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 66254
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Serious hexdump bug

Post by admin »

I don't think there is the bug. These are the bytes:

Code: Select all

49 44 33 04 00 80 00 03 28 06 
And it is correctly returned by:

Code: Select all

text hexdump(readfile(<curitem>), , "r");
That's no workaround but correct scripting. :)

Your other code makes the wrong assumption that the file is a Unicode text file and therefore decodes it into a text string according to your locale. Makes no sense with a binary file.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Serious hexdump bug

Post by Marco »

Ah ok, thanks for the explanation. And I'm relieved now, I encountered this behaviour during a backup-related scripting session and you can imagine my reaction to seemingly corrupted data!
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: [NOT A BUG] Serious hexdump bug

Post by PeterH »

Just thought a bit about it - and don't understand.

The string supplied is just a set of some bytes - to show it in hex (dump 'raw') there should be no dependency to unicode, isn't it so? As I think the left = hexadecimal part of the dump has to show exactly the hex representation of the supplied string of bytes. No matter if it's to be interpreted as character, unicode, binary, or whatever. For me this is the reason for a hex dump: see, what's there.

Or do I miss something?

admin
Site Admin
Posts: 66254
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [NOT A BUG] Serious hexdump bug

Post by admin »

The string supplied is just a set of some bytes
A string is a locale-sensitive *interpretion* of a set of bytes.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: [NOT A BUG] Serious hexdump bug

Post by PeterH »

admin wrote:
The string supplied is just a set of some bytes
A string is a locale-sensitive *interpretion* of a set of bytes.
We are talking about a (hex) dump, and the bytes to be dumped? I think the dump has to show what is, not not what can be interpreted.
To exaggerate: the dump of the binary number 0x'007b' would not be '31 32 33'.

The interpretation may apply to the right = alphanumeric column, or to the output on inverse dump.

admin
Site Admin
Posts: 66254
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: [NOT A BUG] Serious hexdump bug

Post by admin »

readfile returns a locale aware string. hexdump does what you tell it to do with it (how to interprete it).

Post Reply