Bug 2003456 - reuse always immediately crashes
Summary: reuse always immediately crashes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: reuse
Version: 36
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Carmen Bianca Bakker
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-12 13:52 UTC by swagfortress
Modified: 2022-10-17 11:32 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-10-17 11:32:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fsfe reuse-tool issues 425 0 None open "Unable to determine a suitable packaging system type" - Fedora 2021-11-25 13:14:04 UTC

Internal Links: 2014636

Description swagfortress 2021-09-12 13:52:21 UTC
Description of problem:
Whenever I run reuse, it immediately crashes.

Version-Release number of selected component (if applicable):
reuse-0.12.1-3.fc35.noarch

How reproducible:
Always

Steps to Reproduce:
1. Run reuse.

Actual results:
Traceback (most recent call last):
  File "/usr/bin/reuse", line 33, in <module>
    sys.exit(load_entry_point('reuse==0.12.1', 'console_scripts', 'reuse')())
  File "/usr/bin/reuse", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.10/importlib/metadata/__init__.py", line 162, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/reuse/_main.py", line 14, in <module>
    from . import (
  File "/usr/lib/python3.10/site-packages/reuse/download.py", line 17, in <module>
    from ._util import (
  File "/usr/lib/python3.10/site-packages/reuse/_util.py", line 26, in <module>
    from debian.copyright import Copyright
  File "/usr/lib/python3.10/site-packages/debian/copyright.py", line 54, in <module>
    from debian import deb822
  File "/usr/lib/python3.10/site-packages/debian/deb822.py", line 283, in <module>
    import debian.debian_support
  File "/usr/lib/python3.10/site-packages/debian/debian_support.py", line 46, in <module>
    apt_pkg.init()
apt_pkg.Error: W:Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory), E:Unable to determine a suitable packaging system type

Expected results:
I expect it to display a help message.

Workaround:
$ mkdir venv
$ python -m venv venv/
$ source venv/bin/activate
$ pip install --upgrade pip setuptools  # Optional
$ pip install reuse

Comment 1 Ian 2021-10-15 16:57:00 UTC
It seems unlikely the fault is in this package but something to do with python-debian (or its dependencies) which reuse requires.

A minimal way to reproduce the same problem on a fresh Fedora 33/34 or 35:

$ sudo dnf install -y python-debian
$ echo "import debian.debian_support" | python

In addition to workaround from swagfortress above you can also remove the dnf package (which also removes python-debian, python-apt and apt-libs) and use pip directly: `sudo dnf remove reuse && pip install reuse`

I've raised a bug against python-debian linked to this: https://bugzilla.redhat.com/show_bug.cgi?id=2014636

Comment 2 Sebastian Crane 2021-11-25 12:49:04 UTC
Indeed, this error is caused by python-debian failing to import one of its dependencies. I've gone into some detail on REUSE's upstream bug tracker (https://github.com/fsfe/reuse-tool/issues/425#issuecomment-979181897). I'll quote it below:

> ... It occurs due to the presence of python3-apt, which is a 'recommended' dependency in the Fedora package for python-debian.
>
> If python3-apt is present, python-debian also expects a valid APT configuration directory, which clearly does not exist on a typical Fedora system!
>
> Neal Gompa added the recommended dependency in Fedora, but told me that even that was a compromise for other users who do actually use APT on Fedora (!), so it can't just be removed. As of yesterday I now have a Debian Salsa account though, so I'll be sending a pull request upstream to make python-debian more resilient to the absence of an APT configuration directory. That should hopefully resolve the issue! :)

Comment 3 Ben Cotton 2022-02-08 21:25:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 4 Ian 2022-06-16 14:56:56 UTC
Patches submitted against https://bugzilla.redhat.com/show_bug.cgi?id=2014636 have fixed this in F34 and F35 now, so presumably this can be closed.

Comment 5 Ben Beasley 2022-10-17 11:32:22 UTC
Verified in F35 and later using mock chroots. See also bug 2135361.


Note You need to log in before you can comment on or make changes to this bug.