[Reproducible-commits] [debbindiff] 01/01: fix IndexError from --text with empty files (Closes: #781280)
Mattia Rizzolo
mattia at mapreri.org
Fri Mar 27 00:09:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
mapreri-guest pushed a commit to branch master
in repository debbindiff.
commit d0f7e86060b9e35fd44c39319987abf6a787c716
Author: Helmut Grohne <helmut at subdivi.de>
Date: Thu Mar 26 06:58:20 2015 +0100
fix IndexError from --text with empty files (Closes: #781280)
Example input package triggering the error: libreadline6
Example traceback being fixed:
Traceback (most recent call last):
File "/usr/bin/debbindiff", line 120, in <module>
sys.exit(main())
File "/usr/bin/debbindiff", line 114, in main
output_text(differences, print_func=print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 71, in output_text
print_details(difference, print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 62, in print_details
print_details(detail, new_print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 62, in print_details
print_details(detail, new_print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 62, in print_details
print_details(detail, new_print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 59, in print_details
print_difference(detail, print_func)
File "/usr/lib/python2.7/dist-packages/debbindiff/presenters/text.py", line 36, in print_difference
if not difference.lines2[-1].endswith('\n'):
IndexError: list index out of range
---
debbindiff/presenters/text.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/debbindiff/presenters/text.py b/debbindiff/presenters/text.py
index 5cda5ce..c7197a3 100644
--- a/debbindiff/presenters/text.py
+++ b/debbindiff/presenters/text.py
@@ -30,10 +30,10 @@ def print_difference(difference, print_func):
for line in difference.comment.split('\n'):
print_func(u"│┄ %s" % line)
if difference.lines1 or difference.lines2:
- if not difference.lines1[-1].endswith('\n'):
+ if difference.lines1 and not difference.lines1[-1].endswith('\n'):
difference.lines1[-1] = difference.lines1[-1] + '\n'
difference.lines1.append('<No newline at the end>\n')
- if not difference.lines2[-1].endswith('\n'):
+ if difference.lines2 and not difference.lines2[-1].endswith('\n'):
difference.lines2[-1] = difference.lines2[-1] + '\n'
difference.lines2.append('<No newline at the end>\n')
g = difflib.unified_diff(difference.lines1, difference.lines2)
--
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