[Git][reproducible-builds/diffoscope][master] Don't use the runtime platform's native endianness when unpacking .pyc files...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Thu Dec 2 17:32:34 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
a3211be2 by Chris Lamb at 2021-12-02T09:30:48-08:00
Don't use the runtime platform's native endianness when unpacking .pyc files to fix test failures on big-endian machines. (Closes: reproducible-builds/diffoscope#290)

- - - - -


1 changed file:

- diffoscope/comparators/python.py


Changes:

=====================================
diffoscope/comparators/python.py
=====================================
@@ -64,11 +64,11 @@ def parse_pyc(f):
 
     f.seek(4, 1)
     moddate = f.read(4)
-    modtime = time.asctime(time.gmtime(struct.unpack("=L", moddate)[0]))
+    modtime = time.asctime(time.gmtime(struct.unpack("<L", moddate)[0]))
     yield "moddate:  {} ({} UTC)".format(hexlify(moddate), modtime)
 
     filesz = f.read(4)
-    filesz = struct.unpack("=L", filesz)
+    filesz = struct.unpack("<L", filesz)
     yield f"files sz: {filesz[0]}"
 
     code = marshal.load(f)



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/a3211be24c605c2c747b12e1362da75be5eb5265

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/a3211be24c605c2c747b12e1362da75be5eb5265
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20211202/b988ae7a/attachment.htm>


More information about the rb-commits mailing list