[Reproducible-commits] [debbindiff] 01/01: Stop dumping ELF files when they are too big
Jérémy Bobbio
lunar at moszumanska.debian.org
Sun Mar 29 10:02:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository debbindiff.
commit 303a31e9fd1516e53afb2232b8556cf848a48372
Author: Jérémy Bobbio <lunar at debian.org>
Date: Sun Mar 29 12:02:05 2015 +0200
Stop dumping ELF files when they are too big
We've the current design, it means holding way too much data in memory.
---
debbindiff/comparators/elf.py | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/debbindiff/comparators/elf.py b/debbindiff/comparators/elf.py
index 497ecde..75f9072 100644
--- a/debbindiff/comparators/elf.py
+++ b/debbindiff/comparators/elf.py
@@ -52,6 +52,9 @@ def objdump_disassemble(path):
return re.sub(re.escape(path), os.path.basename(path), output).decode('ascii')
+TOO_BIG_TO_DUMP = 10 * 2 ** 20 # 10 MiB
+
+
# this one is not wrapped with binary_fallback and is used
# by both compare_elf_files and compare_static_lib_files
def _compare_elf_data(path1, path2, source=None):
@@ -61,18 +64,20 @@ def _compare_elf_data(path1, path2, source=None):
if all1 != all2:
differences.append(Difference(
all1, all2, path1, path2, source='readelf --all'))
- debug_dump1 = readelf_debug_dump(path1)
- debug_dump2 = readelf_debug_dump(path2)
- if debug_dump1 != debug_dump2:
- differences.append(Difference(
- debug_dump1, debug_dump2,
- path1, path2, source='readelf --debug-dump'))
- objdump1 = objdump_disassemble(path1)
- objdump2 = objdump_disassemble(path2)
- if objdump1 != objdump2:
- differences.append(Difference(
- objdump1, objdump2,
- path1, path2, source='objdump --disassemble --full-contents'))
+ if os.stat(path1).st_size < TOO_BIG_TO_DUMP and \
+ os.stat(path2).st_size < TOO_BIG_TO_DUMP:
+ debug_dump1 = readelf_debug_dump(path1)
+ debug_dump2 = readelf_debug_dump(path2)
+ if debug_dump1 != debug_dump2:
+ differences.append(Difference(
+ debug_dump1, debug_dump2,
+ path1, path2, source='readelf --debug-dump'))
+ objdump1 = objdump_disassemble(path1)
+ objdump2 = objdump_disassemble(path2)
+ if objdump1 != objdump2:
+ differences.append(Difference(
+ objdump1, objdump2,
+ path1, path2, source='objdump --disassemble --full-contents'))
return differences
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git
More information about the Reproducible-commits
mailing list