oneconf crashes if one apt list file is unreadable

Bug #1323586 reported by Gioele Barabucci
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oneconf (Ubuntu)
Confirmed
High
Unassigned
python-apt (Ubuntu)
Won't Fix
High
Unassigned

Bug Description

oneconf-service will crash if one of the files in `/etc/apt/sources.list.d` is unreadable (for example because it has been created using sudo and umask 077).

In my case this is the error message

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/oneconf/packagesethandler.py", line 63, in update
        newpkg_list = self.distro.compute_local_packagelist()
      File "/usr/lib/python3/dist-packages/oneconf/distributor/Ubuntu.py", line 42, in compute_local_packagelist
        with apt.Cache() as apt_cache:
      File "/usr/lib/python3/dist-packages/apt/cache.py", line 107, in __init__
        self.open(progress)
      File "/usr/lib/python3/dist-packages/apt/cache.py", line 155, in open
        self._list.read_main_list()
    SystemError: E:Opening /etc/apt/sources.list.d/tor.list - ifstream::ifstream (13: Permission denied)

affects: oneconf (Ubuntu) → python-apt (Ubuntu)
Changed in python-apt (Ubuntu):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Sebastien Bacher (seb128) wrote :

That seems to still be an issue, sent to debian, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800500

Revision history for this message
Julian Andres Klode (juliank) wrote :

This is not a bug. First of all, it's not a bug in python-apt because we use APT to parse. Secondly, we have no intention of ignoring unreadable sources.list files as that would present an inconsistent view of the available sources.

Changed in python-apt (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Sebastien Bacher (seb128) wrote :

The Debian maintainer marked that as wontfix for apt, that should be handled by the client

"Unreadable sources.list files are an unsupported mode of operation
and will not be supported in neither APT nor python-apt (which
directly calls the functions from APT).

Authentication data should not be stored in sources.list files,
but in a netrc file. Using that, there's no need for unreadable
sources.list files.

If you cannot read a sources.list file, the state would be
inconsistent."

Changed in python-apt (Ubuntu):
status: Invalid → Won't Fix
Changed in oneconf (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Gioele Barabucci (gioele) wrote :

It may not be a bug in python-apt, but it is a bug nevertheless. If unreadable files are not supported, the applications should ignore them or complain about them, not crash and raise an apport dialog every hour.

Please note that it is very easy to generate files in `sources.list.d` that are not readable by normal users. Just use `sudo apt-add-repository` and a 077 umask.

Revision history for this message
Sebastien Bacher (seb128) wrote :

you mean 770 umask? 077 is world readable...

Revision history for this message
Gioele Barabucci (gioele) wrote :

I mean `umask 077`. With umask 077 the default file permissions are 600.

With umask 077 a file created by root via sudo will be unreadable for a normal user.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.