Package: git-buildpackage
Version: 0.9.30

When trying to convert all the snapshoted versions of multimail to a git
repository using gbp import-dscs, I get this error:

Initialized empty Git repository in /home/pere/src/debian/multimail-salsa/.git/
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 153, 
in main
    dscs.append(DscFile.parse(arg))
                ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gbp/deb/dscfile.py", line 141, in parse
    dsc = cls(filename)
          ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gbp/deb/dscfile.py", line 61, in __init__
    for line in f:
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 458: 
invalid start byte

Tracking down the cause, it is this line in multimail_0.43-1.dsc:

  Comment: F<F6>r information se http://www.gnupg.org/

The <F6> is the ISO-8859-1 character ö.  I manged to get a slightly more
informative error by adjusting dscfile.py like this, but I suspect a
proper fix is to teach dscfile to not demand UTF-8 in dsc files.

--- /tmp/dscfile.py     2024-06-02 10:04:39.056375066 +0200
+++ /usr/lib/python3/dist-packages/gbp/deb/dscfile.py   2024-06-02 
10:05:24.920896575 +0200
@@ -139,6 +139,8 @@
     def parse(cls, filename):
         try:
             dsc = cls(filename)
+        except UnicodeDecodeError as err:
+            raise GbpError("Unicode error reading dsc file: %s" % err)
         except IOError as err:
             raise GbpError("Error reading dsc file: %s" % err)
         return dsc

I managed to work around the problem by editing the .dsc file to replace
the ISO-8859-1 character with the UTF-8 one, and luckily gbp did not
validate signatures. :)

-- 
Happy hacking
Petter Reinholdtsen

Reply via email to