severity 1095315 normal
thanks

On Fri, Feb 28, 2025 at 10:09:27AM +0000, Jelmer Vernooij wrote:
On Thu, Feb 06, 2025 at 03:37:51PM -0800, Otto Kekäläinen wrote:
Package: debmutate
Version: 0.71
Severity: important
Tags: python3.13

The python3-debmutate package fails to handle UTF-8 encoded files when
running under Python 3.13. This affects multiple Debian packaging
tools including lintian-brush, making it impossible to process
packages containing non-ASCII characters.

When running lintian-brush, the following error occurs:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
705: ordinal not in range(128)

I'm having trouble reproducing this:

$ ldd ~/src/lintian-brush/target/debug/lintian-brush
        linux-vdso.so.1 (0x00007fde2f1fb000)
        libpython3.13.so.1.0 => /lib/x86_64-linux-gnu/libpython3.13.so.1.0 
(0x00007fde2da00000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 
(0x00007fde2e1a5000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fde2d91a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fde2d724000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fde2f1fd000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fde2d704000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 
(0x00007fde2d6d9000)

$ ~/src/lintian-brush/target/debug/lintian-brush --no-update-changelog --modern 
--uncertain
█████████████████████████████████████████████████████████████████████████████████████████
 154/154No changes made.

By default Python uses utf-8 still, but with some environment
variables set it will change to ascii:

$ cat x.py
#!/usr/bin/python3

with open('debian/copyright', 'r') as f:
    f.read()
$ LC_ALL=C LANG=C PYTHONUTF8=0  python3.12 x.py
Traceback (most recent call last):
  File "/tmp/mariadb/x.py", line 4, in <module>
    f.read()
  File "/usr/lib/python3.12/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 5873: 
ordinal not in range(128)

We should handle this properly even if python is forced into ascii mode though.

Jelmer

Reply via email to