Skip to content
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

Positions >2^32 cause output to be misaligned #228

Open
apple1417 opened this issue Sep 21, 2024 · 1 comment
Open

Positions >2^32 cause output to be misaligned #228

apple1417 opened this issue Sep 21, 2024 · 1 comment

Comments

@apple1417
Copy link

When dumping things with large positions, which take more than 8 character to display, a few things get misaligned. This happens both when --skiping that far, or when just using a --display-offset to fake the position higher.

Working:

> hexyl -s 0x2f0 -n 0x30 $(which hexyl)
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│000002f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│*       │                         ┊                         │        ┊        │
│00000310│ 10 00 00 00 00 00 00 00 ┊ 52 e5 74 64 04 00 00 00 │•⋄⋄⋄⋄⋄⋄⋄┊R×td•⋄⋄⋄│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
> hexyl -s 0x2f0 -n 0x30 $(which hexyl) --border=ascii
+--------+-------------------------+-------------------------+--------+--------+
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |⋄⋄⋄⋄⋄⋄⋄⋄|⋄⋄⋄⋄⋄⋄⋄⋄|
|*       |                         |                         |        |        |
|00000310| 10 00 00 00 00 00 00 00 | 52 e5 74 64 04 00 00 00 |•⋄⋄⋄⋄⋄⋄⋄|R×td•⋄⋄⋄|
+--------+-------------------------+-------------------------+--------+--------+

Misaligned:

> hexyl -o 0x100000000 -s 0x2f0 -n 0x30 $(which hexyl)
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│01000002f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│*       │                         ┊                         │        ┊        │
│0100000310│ 10 00 00 00 00 00 00 00 ┊ 52 e5 74 64 04 00 00 00 │•⋄⋄⋄⋄⋄⋄⋄┊R×td•⋄⋄⋄│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
> hexyl -o 0x100000000 -s 0x2f0 -n 0x30 $(which hexyl) --border=ascii
+--------+-------------------------+-------------------------+--------+--------+
|01000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |⋄⋄⋄⋄⋄⋄⋄⋄|⋄⋄⋄⋄⋄⋄⋄⋄|
|*       |                         |                         |        |        |
|0100000310| 10 00 00 00 00 00 00 00 | 52 e5 74 64 04 00 00 00 |•⋄⋄⋄⋄⋄⋄⋄|R×td•⋄⋄⋄|
+--------+-------------------------+-------------------------+--------+--------+

Note just the 8 characters of dashes/spaces in the first column, instead of 10.

Additionally, if you have a dump crossing the threshold, even with no borders or squeezing the alignment still gets thrown out.

> hexyl -o 0xFFFFFD00 -s 0x2f0 -n 0x30 $(which hexyl) --border=none
 fffffff0  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 *                                                                              
 0100000010  10 00 00 00 00 00 00 00   52 e5 74 64 04 00 00 00  •⋄⋄⋄⋄⋄⋄⋄ R×td•⋄⋄⋄ 
> hexyl -o 0xFFFFFD00 -s 0x2f0 -n 0x30 $(which hexyl) --border=none -v
 fffffff0  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 0100000000  00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00  ⋄⋄⋄⋄⋄⋄⋄⋄ ⋄⋄⋄⋄⋄⋄⋄⋄ 
 0100000010  10 00 00 00 00 00 00 00   52 e5 74 64 04 00 00 00  •⋄⋄⋄⋄⋄⋄⋄ R×td•⋄⋄⋄ 
@sharkdp
Copy link
Owner

sharkdp commented Oct 1, 2024

Thank you for reporting this. How do other tools (xxd, hexdump) handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants