[Pkg-mozext-maintainers] Bug#909527: mozilla-devscripts: dh_webext breaks on non-ascii debian/control when building with LANG=C

Christoph Biedl debian.axhn at manchmal.in-ulm.de
Mon Sep 24 19:35:34 BST 2018


Package: mozilla-devscripts
Version: 0.51
Severity: important
Tags: patch

Dear Maintainer,

when trying to rebuild mozilla-noscript (actually, preparing a backport),
I got an error:

| dh binary --with webext
|    dh_testroot
|    dh_prep
|    dh_install
|    dh_webext
| Traceback (most recent call last):
|   File "/usr/bin/dh_webext", line 217, in <module>
|     sys.exit(install_webext(*sys.argv[1:]))
|   File "/usr/bin/dh_webext", line 144, in install_webext
|     packages = args.packages or get_all_packages()
|   File "/usr/bin/dh_webext", line 73, in get_all_packages
|     lines = open("debian/control").readlines()
|   File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
|     return codecs.ascii_decode(input, self.errors)[0]
| UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 210: ordinal not in range(128)
| make: *** [debian/rules:4: binary] Error 1
| dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

Turns out that package's debian/control contains utf-8 sequences but
dh_webext cannot deal with it with when LANG is set to e.g. "C". As far
as I can tell, sbuild does this by default.

Trivial reproducer using the mozilla-noscript source (version 10.1.9.6-1):

  ( export LANG=C ; dpkg-buildpackage  -uc -us -sa -rfakeroot )

Using "en_US.UTF-8" instead makes the build succeed.

The patch below, mostly taken from reportbug, solved the issue but my
Python foo isn't good enough yet to judge its quality.

Regards,

    Christoph

--- /tmp/dh_webext	2018-09-23 23:28:42.000000000 +0200
+++ /usr/bin/dh_webext	2018-09-24 20:26:56.531677978 +0200
@@ -33,6 +33,7 @@
 import argparse
 import datetime
 import json
+import locale
 import os
 import shlex
 import subprocess
@@ -214,4 +215,9 @@
     return 1
 
 if __name__ == '__main__':
+    try:
+        locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
+    except locale.Error as x:
+        print('*** Warning:', x, file=sys.stderr)
+
     sys.exit(install_webext(*sys.argv[1:]))

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

Kernel: Linux 4.18.6 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages mozilla-devscripts depends on:
ii  perl           5.26.2-7
ii  python         2.7.15-3
ii  python-librdf  1.0.17.1+dfsg-1.3+b5
ii  python3        3.6.6-1
ii  unzip          6.0-21
ii  zip            3.0-11+b1

mozilla-devscripts recommends no packages.

mozilla-devscripts suggests no packages.

-- no debconf information

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-mozext-maintainers/attachments/20180924/c8579501/attachment-0001.sig>


More information about the Pkg-mozext-maintainers mailing list