[diffoscope] Which tool is generating the "comments" attribute in JSON?

Chris Lamb chris at reproducible-builds.org
Tue Oct 15 15:27:47 UTC 2024


Hello Aman,

> I was running diffoscope on two Jimple 
> <https://soot-oss.github.io/SootUp/v1.1.2/jimple/> files. As far as I 
> could see from the docs, this syntax is not explicitly supported so 
> diffoscope returns a line based diff. However, it also adds "comments: 
> ["Ordering differences only"]" 
> <https://github.com/chains-project/by-the-pool/blob/main/ground-truth/1/jNorm/diffoscope.json> 
> which is quite cool. How is this being implemented? And what are the 
> possible comments?

It's actually quite a straightforward bit of code that's built into
diffoscope itself. Here's the actual implementation:

  https://salsa.debian.org/reproducible-builds/diffoscope/-/blob/master/diffoscope/difference.py#L428

… although you might also spot that a few lines above, we do some
linear-time optimisations to avoid sorting the lines as that scales by
NlogN.

Hope this helps!


Best wishes,

-- 
      o
    ⬋   ⬊      Chris Lamb
   o     o     reproducible-builds.org 💠
    ⬊   ⬋
      o




More information about the diffoscope mailing list