Your message dated Sun, 19 Aug 2018 07:19:25 +0000
with message-id <[email protected]>
and subject line Bug#900841: fixed in git-buildpackage 0.9.10
has caused the Debian Bug report #900841,
regarding git-buildpackage: Fails to import packages when the changelog 
contains invalid UTF-8 sequences
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
900841: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900841
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: git-buildpackage
Version: 0.9.9
Severity: normal
Tags: patch

I ran into the following issue when importing the history of a Debian
package:

> gbp import-dscs --debsnap wireless-tools
gbp:info: Downloading snapshots of 'wireless-tools' to '/tmp/tmpkzi1rlbg'...
gbp:info: No git repository found, creating one.
Traceback (most recent call last):
  File "/usr/bin/gbp", line 149, in <module>
    sys.exit(supercommand())
  File "/usr/bin/gbp", line 145, in supercommand
    return module.main(args)
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_dscs.py", line 180, 
in main
    if importer.importdsc(dscs[0]):
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_dscs.py", line 72, in 
importdsc
    return import_dsc.main(['import-dsc'] + self.args + [dsc.dscfile])
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_dsc.py", line 518, in 
main
    apply_debian_patch(repo, source, dsc, commit, options)
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_dsc.py", line 174, in 
apply_debian_patch
    author = get_author_from_changelog(source.unpacked)
  File "/usr/lib/python3/dist-packages/gbp/scripts/import_dsc.py", line 114, in 
get_author_from_changelog
    dch = ChangeLog(filename=os.path.join(dir, 'debian/changelog'))
  File "/usr/lib/python3/dist-packages/gbp/deb/changelog.py", line 89, in 
__init__
    self._read()
  File "/usr/lib/python3/dist-packages/gbp/deb/changelog.py", line 132, in _read
    self._contents = f.read()
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 906: 
invalid start byte

This happened while it was importing version 23-2 (see
http://snapshot.debian.org/package/wireless-tools/23-2/). The changelog
back then was in ISO-8859-1. I've attached a patch that treats invalid
UTF-8 files as ISO-8859-1.


-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.2 (SMP w/12 CPU cores)
Locale: LANG=nl_NL.utf8, LC_CTYPE=nl_NL.utf8 (charmap=UTF-8), 
LANGUAGE=nl_NL.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages git-buildpackage depends on:
ii  devscripts             2.18.2
ii  git                    1:2.17.0-1
ii  man-db                 2.8.3-2
ii  python3                3.6.5-3
ii  python3-dateutil       2.6.1-1
ii  python3-pkg-resources  39.1.0-1

Versions of packages git-buildpackage recommends:
ii  cowbuilder        0.87+b1
ii  pbuilder          0.229.2
ii  pristine-tar      1.44
ii  python3-requests  2.18.4-2

Versions of packages git-buildpackage suggests:
pn  python3-notify2  <none>
ii  sudo             1.8.23-1
ii  unzip            6.0-21

-- no debconf information
>From 48bc76b8a5294098548ef8c6b10e0f25b718fddf Mon Sep 17 00:00:00 2001
From: Guus Sliepen <[email protected]>
Date: Tue, 5 Jun 2018 21:41:28 +0200
Subject: [PATCH] Treat changelogs with invalid UTF-8 sequences as ISO-8859-1.

This allows import-dscs to import old versions of a package that did not
yet use UTF-8 encoding.
---
 gbp/deb/changelog.py | 8 ++++++--
 gbp/git/vfs.py       | 5 ++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py
index 5cfaaf79..dda9b753 100644
--- a/gbp/deb/changelog.py
+++ b/gbp/deb/changelog.py
@@ -128,8 +128,12 @@ class ChangeLog(object):
         self._cp = cp
 
     def _read(self):
-        with open(self.filename, encoding='utf-8') as f:
-            self._contents = f.read()
+        try:
+            with open(self.filename, encoding='utf-8') as f:
+                self._contents = f.read()
+        except UnicodeDecodeError:
+            with open(self.filename, encoding='iso-8859-1') as f:
+                self._contents = f.read()
 
     def __getitem__(self, item):
         return self._cp[item]
diff --git a/gbp/git/vfs.py b/gbp/git/vfs.py
index 8363f77b..ec47201a 100644
--- a/gbp/git/vfs.py
+++ b/gbp/git/vfs.py
@@ -33,7 +33,10 @@ class GitVfs(object):
             if binary:
                 self._data = io.BytesIO(content)
             else:
-                self._data = io.StringIO(content.decode())
+                try:
+                    self._data = io.StringIO(content.decode())
+                except UnicodeDecodeError:
+                    self._data = io.StringIO(content.decode("iso-8859-1"))
 
         def readline(self):
             return self._data.readline()
-- 
2.17.0


--- End Message ---
--- Begin Message ---
Source: git-buildpackage
Source-Version: 0.9.10

We believe that the bug you reported is fixed in the latest version of
git-buildpackage, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guido Günther <[email protected]> (supplier of updated git-buildpackage package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 19 Aug 2018 08:29:47 +0200
Source: git-buildpackage
Binary: git-buildpackage git-buildpackage-rpm
Architecture: source
Version: 0.9.10
Distribution: unstable
Urgency: medium
Maintainer: Guido Günther <[email protected]>
Changed-By: Guido Günther <[email protected]>
Description:
 git-buildpackage - Suite to help with Debian packages in Git repositories
 git-buildpackage-rpm - Suite to help with RPM packages in Git repositories
Closes: 882187 899234 900606 900841 906331
Changes:
 git-buildpackage (0.9.10) unstable; urgency=medium
 .
   [ Ken Dreyer ]
   * [f0b1bbe] deb.git: fix duplicate "tarball" in docstring.
     Fix the docstring for create_pristine_tar_commits()
   * [29b9f2c] deb.git: fix spelling of "described" in docstring.
     Fix the docstring for _sanitize_version() and _unsanitize_version()
 .
   [ Guido Günther ]
   * [62e0102] push: Allow to skip upstream and debian branch and tag push.
     Push of tag and or branch can be skipped by setting
     --{upstream,debian}-{branch,tag}='' . (Closes: #899234)
   * [28a950a] tests: Check help output of tag and push too
   * [a287bf6] config: allow to override default values via
     add_config_file_option
   * [b8221b8] pull: Check that repo is clean before fetching anything
   * [6dda2da] pull: allow to set up branch tracking for missing branches.
     If the remote branch does not exist at all that's currently not fatal.
     (Closes: #882187)
   * [d69006d] Depend on sensible-utils. gbp-dch uses sensible-editor.
 .
   [ Chris Lamb ]
   * [6c30ac9] import-{dsc,orig}: Make --download deprecation text more useful.
     Point to the manpages for usage examples. (Closes: #900606)
 .
   [ Guus Sliepen ]
   * [48ef0ec] changelog: try iso8859-1 when utf-8 fails.
     Fall back to iso8859-1 when opening the changelog. Helps when importing
     old versions. (Closes: #900841)
 .
   [ Carsten Schoenert ]
   * [50b9223] create_remote_repo: import urllib.parse
     urllib.parse did not get imported in packaegs without changelog.
 .
   [ Iain Lane ]
   * [5fedb2b] Ignore merge commits when looking at the pristine-tar branch.
     (Closes: #906331)
Checksums-Sha1:
 4aed01a443a8c508e5e802b32ca6bc6ea3df0fb9 2277 git-buildpackage_0.9.10.dsc
 edd373154c6754fe705a6ca561ed8cd25e52264e 2388764 git-buildpackage_0.9.10.tar.xz
 8065d97e17d9475c52f4b3a8c81d83273f12d280 11843 
git-buildpackage_0.9.10_amd64.buildinfo
Checksums-Sha256:
 c765b908c67b75ca22e371c07d7212e26517f420defd096f4d59ab6b8befb197 2277 
git-buildpackage_0.9.10.dsc
 e5d82a50544cefbf1bf3254db90efe905e2d213ff7e5baadbd2d63071b507b13 2388764 
git-buildpackage_0.9.10.tar.xz
 d32a792526b9e5c5f7a37fb72b52816cf1a134527adfcfac78cd4609f5a35657 11843 
git-buildpackage_0.9.10_amd64.buildinfo
Files:
 e054d14787ac08664bd846e916699307 2277 vcs optional git-buildpackage_0.9.10.dsc
 cbc4c5a720bbb1aa94288dd571d4018a 2388764 vcs optional 
git-buildpackage_0.9.10.tar.xz
 c6dd8bc78d7e7a73dbac97f2bc878d49 11843 vcs optional 
git-buildpackage_0.9.10_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEvHzQcjh1660F3xzZB7i3sOqYEgsFAlt5E6IACgkQB7i3sOqY
EgtOHxAAs7elZ3p0VDLoh039X2BBMtoFGQkd2IW49USQ7qWEjPIFGWaUvNx2u9HS
hGE4+xtBRE8G+K1KLwVpexdtBbCmulTy9MQCp/JXk/m/ALjLR0Pd+50e5b6SsPZL
4Sn9rS0UU+LxaccNZkIfqA5BKVukbSRd9PGiOEsMH/ZoX+uqa0E7l237Zu0oWtXd
Fpo0J6ztNE26RxawEa2lb+9HDXEnKGrZbfG60eeKVNHOyZ7sMA4Fx+7RujI87h6Z
BXMRTxLEoBkrip5ZbZvyU2Mmym29DrHUEW8qWWs08XDkrOzBFnO6rBapcwiAIv9C
DGOuFh8pHvv1UQrU30QKHITUEEmOvH0lXu5nUWJo/R1hkYiuo3yhIw+Ui/AQ/Gz9
j6hJXuEn2uofVQXY55w2hG2bR/kY/tpiPLisPqvixJMyX+8mo+5+freXtMd8l2ta
nikRs/Sq3qVAc1n5kgYZFs1RhKMd7h0cr6zUq3g/3SfBegXjuO5N7OW0jWqoW+nX
i7W40ovHUWGGrZ52bCn7184UIQeSIX6viwaApAge9H6ojgUTI0jXhOFk8KDfDhG6
ELeZ4B7EV5HZFPt8Db1yXuEGnSUhD7ukWjKkiGNxmFYNKBZOdliBYjw+3yBXiUb6
aNd1CHUR4rSP4HsGymXs9I2mLsr0M4YUebG37d9lwbiSvNR+1XY=
=MtWs
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to