#979695 Bug in Package reportbug

Package:
python3-apt
Source:
python-apt
Description:
Python 3 interface to libapt-pkg
Submitter:
Date:
2021-12-03 15:39:02 UTC
Severity:
normal
Tags:
#979695#5
Date:
2021-01-10 08:58:51 UTC
From:
To:
Debian testing bullseye


When i start reportbug, its crashing, due to python error.


Terminal output:

ydna@debian:~$ reportbug
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 3: invalid continuation byte

The above exception was the direct cause of the following exception:

SystemError: <class 'UnicodeDecodeError'> returned a result with an error set

The above exception was the direct cause of the following exception:

SystemError: <class 'UnicodeDecodeError'> returned a result with an error set

The above exception was the direct cause of the following exception:

SystemError: <class 'UnicodeDecodeError'> returned a result with an error set

The above exception was the direct cause of the following exception:

SystemError: <class 'UnicodeDecodeError'> returned a result with an error set

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/reportbug", line 44, in <module>
    from reportbug import utils
  File "/usr/lib/python3/dist-packages/reportbug/utils.py", line 108, in <module>
    _apt_cache = apt.Cache()
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 152, in __init__
    self.open(progress)
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 214, in open
    self._cache = apt_pkg.Cache(progress)
SystemError: <class 'apt_pkg.Cache'> returned a result with an error set

#979695#10
Date:
2021-01-10 10:00:36 UTC
From:
To:
control: tags -1 moreinfo

Thank you for the report. Since I cannot reproduce the problem, we'll
need more information to resolve it.

It seems like there might be something wrong with apt on your system.
Does `apt-get check` indicate any issues? Are the usual invocations of
`apt-cache` working, like searching for packages or showing package
descriptions? Do you have any unusual entries in your sources.list? Or
perhaps your apt cache is somehow missing and running `sudo apt-cache
gencaches` or something similar fixes the problem?

#979695#17
Date:
2021-01-10 13:08:58 UTC
From:
To:
Hello!

Here my tests:

sudo apt-get check
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig

#979695#22
Date:
2021-01-10 17:06:17 UTC
From:
To:
control: reassign -1 python3-apt

the crash happens within the apt module, by just instantiating the
Cache class, reassigning

#979695#31
Date:
2021-12-03 15:30:28 UTC
From:
To:
Hi!
I did some digging, coming from the same error working with ansible.
I have been able to reproduce the error switching between locales:

root@27dc07527a5e:/py# LANG="de_DE.UTF-8" ansible -m apt -i 127.0.0.1, all -a "update_cache=yes"
127.0.0.1 | CHANGED => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "cache_update_time": 1638522532,
    "cache_updated": true,
    "changed": true
}
root@27dc07527a5e:/py# LANG="de_DE@euro" ansible -m apt -i 127.0.0.1, all -a "update_cache=yes"
127.0.0.1 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "msg": "<class 'apt_pkg.Cache'> returned a result with an error set"
}
root@27dc07527a5e:/py#

reproduce with: bullseye (05d2318291e3)

image=debian:bullseye ; time docker run -it --rm $image bash -c 'apt-get update >/dev/null && DEBIAN_FRONTEND=noninteractive apt-get install -y python3 locales ansible >/dev/null; sed -i -e "s/# de_DE@euro/de_DE@euro/;s/# de_DE.UTF-8/de_DE.UTF-8/" /etc/locale.gen; locale-gen de_DE@euro de_DE.UTF-8 >/dev/null ;update-locale LANG="de_DE@euro" ; cat /etc/default/locale;LANG=de_DE@euro ansible --connection local -m apt -i 127.0.0.1, all -a "update_cache=yes";update-locale LANG=de_DE@euro; LANG="de_DE.UTF-8" ansible --connection local -m apt -i 127.0.0.1, all -a "update_cache=yes";cat /etc/issue'

This occures with ansible from pip3 and on debian:sid(33f3c2db12ab).
It doesn’t reproduce on bullseye-slim(dfeb831cef5f) or after rm –rf /usr/share/cache

…
regards

InterRed GmbH ▪ Eiserfelder Straße 316 ▪ 57080 Siegen
T: +49 271 30377-0 ▪ F: +49 271 30377-77
Sitz der Gesellschaft: Haiger
Vertretungsberechtigt als Geschäftsführer: Dr. André Klahold, Daniela Klahold, Klaus Schuster
Amtsgericht Wetzlar, HRB 3604 ▪ USt.-Ident.Nr.: DE 214 981 189
Unsere Datenschutzerklärung finden Sie hier: www.interred.de/Datenschutz