[diffoscope] [PATCH] Implement ElfFile as a container of sections

Dhole dhole at openmailbox.org
Mon Jan 4 17:59:09 CET 2016


> Another thing: as soon as we start interpreting output like that,
> there's a chance we might be given things not exactly like we want them.
> Could you make sure that diffoscope will not crash (but rather fallback
> to binary diff for example) in case we can't parse the output of
> readelf?

I've created a new exception called OutputParsingError for this matter.
As you mentioned in irc a refactoring of the Comparator exceptions
handling would be nice since there is some repeated code in
diffoscope/comparators/binary.py:File.compare
I'll work on that once this patch seems good to you.

On 01/03/2016 05:58 PM, Jérémy Bobbio wrote:
> How about looking at the flags column?
> 
> The end of the `--section-headers` output reads:
> 
>     Key to Flags:
>       W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
>       I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
>       O (extra OS processing required) o (OS specific), p (processor specific)
> 
> Code will have an 'X' flag and strings have an 'S' flag. The rest can
> use binary dumps.
> 
> What do you think?

This works perfectly :) I've implemented it in the revision I'm attaching.

Let me know what you think.

Cheers,
Dhole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Implement-ElfFile-as-a-container-of-sections.patch
Type: text/x-patch
Size: 13492 bytes
Desc: not available
URL: <http://lists.reproducible-builds.org/pipermail/diffoscope/attachments/20160104/a0f14dd7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.reproducible-builds.org/pipermail/diffoscope/attachments/20160104/a0f14dd7/attachment.sig>


More information about the diffoscope mailing list