Control: tags -1 + patch It seems that currently the lines1 and lines2 lists in a Difference object can contain str and unicode. This means that:
* The Difference class has poor API documentation and does not explain how it is supposed to be used. * Consequently, functions that generate Difference objects do not agree what it should contain and choose different interpretations. * In particular: + control files tend to be unicode. + readelf output tends to be str. The bug results from issuing .encode("utf8") on a str object. When doing so, it is automatically decoded to unicode using the sys.getdefaultencoding() (which happens to default to "ascii"). This class of bugs can be found by: * Running debbindiff in the python3 interpreter (if that is feasible already). * Issuing: "import sys; reload(sys); sys.setdefaultencoding("invalid")" after importing all modules. This causes implicit encoding and encoding to always fail and it breaks importing and using certain builtin modules (which is why setdefaultencoding is normally deleted). Attaching a minimal patch that makes it work somewhat. Helmut
diff -Nru debbindiff-9/debbindiff/presenters/text.py debbindiff-9+nmu1/debbindiff/presenters/text.py --- debbindiff-9/debbindiff/presenters/text.py 2015-02-15 12:13:51.000000000 +0100 +++ debbindiff-9+nmu1/debbindiff/presenters/text.py 2015-02-24 00:50:38.000000000 +0100 @@ -34,7 +34,9 @@ for line in g: if line.startswith('--- ') or line.startswith('+++ '): continue - print_func("â %s" % line.encode('utf-8'), end='') + if isinstance(line, unicode): + line = line.encode('utf-8') + print_func("â %s" % line, end='') def print_details(difference, print_func): if not difference.details: diff -Nru debbindiff-9/debian/changelog debbindiff-9+nmu1/debian/changelog --- debbindiff-9/debian/changelog 2015-02-15 12:13:51.000000000 +0100 +++ debbindiff-9+nmu1/debian/changelog 2015-02-24 08:49:58.000000000 +0100 @@ -1,3 +1,10 @@ +debbindiff (9+nmu1) UNRELEASED; urgency=low + + * Non-maintainer upload. + * Work around UnicodeDecodeError in --text. (Closes: #778641) + + -- Helmut Grohne <hel...@subdivi.de> Tue, 24 Feb 2015 08:49:08 +0100 + debbindiff (9) unstable; urgency=medium [ Chris Lamb ]
_______________________________________________ Reproducible-builds mailing list Reproducible-builds@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds