Skip to content

Package printer-driver-bisheng-lexmark-z23-z33-color-jetprinter will cause command-not-found crash. #11122

Description

@ChenPi11

SUMMARY | 问题概要

Package command-not-found is a handler for command_not_found that looks up programs not currently installed but available from the repositories. Package rinter-driver-bisheng-lexmark-z23-z33-color-jetprinter has a file with GB18030 encoding file name:

./usr/share/ppd/printer-driver-deepinwine/Lexmark \264\362ӡ\273\372\307\375\266\257\263\314\320\362-Lexmark Z23-Z33 Color Jetprinter.ppd

This will crash command-not-found's apt trigger while command-not-found building its database.

Image

/usr/share/command-not-found/CommandNotFound/db/creator.py:242:

Image

Log:

忽略:1 https://community-packages.deepin.com/beige beige InRelease
命中:3 https://app-store-files.uniontech.com/250102153637985/appstorev23 beige InRelease
命中:2 https://cdn-community-packages.deepin.com/driver-23 driver InRelease
命中:4 https://community-packages.deepin.com/beige beige Release
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 32, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 96, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 141, in _fill_commands
    self._parse_single_contents_file(con, f, sub.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 241, in _parse_single_contents_file
    l = l.decode("utf-8")
        ^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb4 in position 48: invalid start byte
正在读取软件包列表... 完成
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

SOFTWARE/OS VERSIONS | 软件/系统版本信息

Distro: Deepin 23
Package: printer-driver-bisheng-lexmark-z23-z33-color-jetprinter

PRE-REQUIREMENT | 预置条件

  1. command-not-found is installed.
  2. Its database /var/lib/command-not-found/* is not exists.

STEPS TO REPRODUCE | 复现步骤

  1. Setup a Deepin V23 distro.
  2. Run sudo apt install command-not-found in root user.
  3. Make sure that /var/lib/command-not-found/* is not exists.
  4. Make sure that command command-not-found zsh show this:
没有找到 command-not-found 的数据库。请运行 “sudo apt update” 以增充数据库。
zsh:未找到命令
  1. Run sudo apt update

OBSERVED RESULT | 观察到的结果

Image

EXPECTED RESULT | 期望的结果

忽略:1 https://community-packages.deepin.com/beige beige InRelease
命中:3 https://cdn-community-packages.deepin.com/driver-23 driver InRelease
命中:2 https://app-store-files.uniontech.com/250102153637985/appstorev23 beige InRelease
命中:4 https://community-packages.deepin.com/beige beige Release
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
所有软件包均为最新。

ADDITIONAL INFORMATION | 额外补充

Use

try:
    l = l.decode("utf-8")
except UnicodeDecodeError:
    l = l.decode("gb18030")

in package command-not-found's /usr/share/command-not-found/CommandNotFound/db/creator.py can fix this problem. But IT'S NOT A GOOD IDEA.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions