[diffoscope] 02/02: comparators/haskell: add a comment describing the file header

Mattia Rizzolo mattia at debian.org
Tue Jan 17 19:51:56 CET 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit c7ac406129ded41eb4566eda0e2c17d90aaea778
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Tue Jan 17 19:51:47 2017 +0100

    comparators/haskell: add a comment describing the file header
    
    Thanks: James Clarke <jrtc27 at debian.org> for all the investigation done
---
 diffoscope/comparators/haskell.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/diffoscope/comparators/haskell.py b/diffoscope/comparators/haskell.py
index 716c4a4..b470c9b 100644
--- a/diffoscope/comparators/haskell.py
+++ b/diffoscope/comparators/haskell.py
@@ -47,6 +47,27 @@ else:
     HI_MAGIC = HI_MAGIC_64
 
 class HiFile(File):
+    """
+    Here is how an example .hi file starts:
+    % hexdump -C tests/data/test1.hi | head -n 1
+    00000000  01 fa ce 64 00 00 00 00  00 00 00 00 04 00 00 00  |...d............|
+              ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ ~~ ~~~~~~~~~~
+                HI_MAGIC    zero padding (used to  ↑↑  int('7')
+                             be a field here)      ||
+                                                   ||
+                           ·~~~~~~~~~~~~~~~~~~~~~~~||
+                           | version string length ||
+                           ·~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    00000010  37 00 00 00 31 00 00 00  30 00 00 00 33 00 00 00  |7...1...0...3...|
+            ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~
+                  int('1')     int('0')    int('3')
+
+
+    So the version of this file has 4 characters, and it's 7103.
+    Note how all this information is store as big endian.
+
+    """
     RE_FILE_EXTENSION = re.compile(r'\.(p_|dyn_)?hi$')
 
     @staticmethod

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list