Re: [PATCH v3 3/3] hexdump: Print the prefix after the last line to show the dump is over

From: Andy Shevchenko
Date: Wed Mar 19 2025 - 12:47:06 EST


On Wed, Mar 19, 2025 at 05:08:12PM +0100, Miquel Raynal wrote:
> When skipping duplicated lines, the end of the log can just be a
> star ("*") which may be confusing (?), so in order to clarify the end of
> the log, tell the user how many lines where skipped and mimic the
> userspace hexdump output, let's add in this case a new line with the
> next offset.
>
> With the following data:
>
> 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
>
> When skipping identical lines we were seeing:
>
> 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> *
>
> And now we will have:
>
> 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> *
> 00000080
>
> However if the output was (first bit of first byte on last line changed):
>
> 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> 00000070: fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> ^
>
> When skipping identical lines we would see:
>
> 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
> *
> 00000070: fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
>
> And in this case the output would not change with this patch.

Thanks!

LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

...

> This change is not related to the two first patches and is just an
> addition that was requested by Andy who felt like it was not clear where
> the dump was ending with the 'SKIP_DUPLICATE' flag when the last line
> was skipped. Honestly this never bothered me, so depending on the
> maintainers wishes, this can either be applied or skipped.

I was also referring to userpsace `hexdump` behaviour. And I find it logical.

--
With Best Regards,
Andy Shevchenko