Bug 2014636

Summary: Importing debian_support gives error
Product: [Fedora] Fedora Reporter: Ian <saturns_rings>
Component: python-aptAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: fedoraproject.org, lankyleggy, msuchy, ngompa13
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-apt-2.3.0-1.fc34 python-apt-2.3.0-1.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-31 01:11:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ian 2021-10-15 16:54:58 UTC
Description of problem:

Trying to use the debian_support python module this package provides gives an error (see repro below). If you uninstall this package and instead install python-debian via pip it works ok.

Version-Release number of selected component (if applicable):

0.1.36

How reproducible:

100% on F33/4/5.

Steps to Reproduce:

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

Actual results:

```
  File "/usr/lib/python3.9/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:

No error.

Additional info:

As I say if you uninstall via dnf then reinstall from pip python-debian works ok:

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

Gives no error.

Comment 1 Miroslav Suchý 2021-10-19 17:10:50 UTC
This actually comes from 
   import apt_pkg
   apt_pkg.init()
so switching components.

The reproducer should be:

$ python3
import apt_pkg   
apt_pkg.init()


But one question anyway:

> sudo dnf install -y python-debian

There is no python-debian. I assume typo and "python3-debian"

Comment 2 Miroslav Suchý 2021-10-19 17:13:17 UTC
And BTW on my workstation, I cannot reproduce this error. It works without problem.

Comment 3 Ian 2021-10-22 09:07:55 UTC
Thanks for correcting and refining the reproducer. I just tried it on fresh F35 beta and still get it, I've included more output below if it helps:

$ sudo dnf install python3-debian
...
Dependencies resolved.
==============================================================================================================================
 Package                           Architecture             Version                            Repository                Size
==============================================================================================================================
Installing:
 python3-debian                    noarch                   0.1.36-8.fc35                      fedora                   107 k
Installing dependencies:
 apt-libs                          x86_64                   2.3.8-1.fc35                       fedora                   1.2 M
 python3-chardet                   noarch                   4.0.0-4.fc35                       fedora                   219 k
Installing weak dependencies:
 python3-apt                       x86_64                   2.2.0-2.fc35                       fedora                   
...
$ python3
Python 3.10.0rc1 (default, Aug  3 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import apt_pkg
>>> apt_pkg.init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
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
>>>

Comment 4 Miroslav Suchý 2021-10-22 20:31:04 UTC
Both errors ("Directory exist" and "Unable to determin") actually comes from ./apt-pkg/init.cc from apt-libs. But from this point I am really lost and I leave it to someone else who knows the apt code or can reproduce it.

Comment 5 Fedora Update System 2022-01-27 13:52:54 UTC
FEDORA-2022-5a15b7ab52 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-5a15b7ab52

Comment 6 Fedora Update System 2022-01-27 13:53:01 UTC
FEDORA-2022-3f6e44d506 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f6e44d506

Comment 7 Fedora Update System 2022-01-27 22:33:58 UTC
FEDORA-2022-5a15b7ab52 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-5a15b7ab52`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-5a15b7ab52

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-01-27 22:51:51 UTC
FEDORA-2022-3f6e44d506 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-3f6e44d506`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f6e44d506

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-01-31 01:11:47 UTC
FEDORA-2022-5a15b7ab52 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2022-01-31 01:14:44 UTC
FEDORA-2022-3f6e44d506 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.