Skip to content

Haskell comparator doesn't understand GHC 9.0+ interface files

Unfortunately, it seems that the .hi file format has changed in GHC 9.0+ and diffoscope fails to understand it:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 766, in main
    sys.exit(run_diffoscope(parsed_args))
  File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 717, in run_diffoscope
    difference = compare_root_paths(path1, path2)
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/compare.py", line 66, in compare_root_paths
    file1 = specialize(FilesystemFile(path1, container=container1))
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/specialize.py", line 54, in specialize
    if try_recognize(file, cls, cls.recognizes):
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/specialize.py", line 37, in try_recognize
    if not recognizes(file):
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/haskell.py", line 131, in recognizes
    version_found = "".join(
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/haskell.py", line 132, in <genexpr>
    chr(struct.unpack(">I", fp.read(4))[0])
OverflowError: Python int too large to convert to C int

Here is a hexdump of a 9.0.2 file:

00000000  01 fa ce 64 04 39 30 30  32 00 00 00 1f 87 00 00  |...d.9002.......|
00000010  16 a7 00 00 15 8b 00 00  01 00 00 95 c0 84 ca eb  |................|

It seems the empty field is no longer present and the version information starts right after the magic. The version components seem to be just a single byte now as well.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information