add-apt-repository fails if it encounters immutable sources.list.d entry

Bug #1995105 reported by Martin Schmitt
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Reason:

We're trying to protect an internal APT source from trivial accidental modification by users (who do have sudo as root).

Steps to reproduce:

echo '# dummy' > /etc/apt/sources.list.d/dummy.list
chattr +i /etc/apt/sources.list.d/dummy.list
add-apt-repository -y ppa:longsleep/golang-backports

Expected behaviour:

New sources.list for the PPA gets created.

Observed behaviour:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/add-apt-repository", line 357, in main
    shortcut.add()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 221, in add
    self.add_source()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 307, in add_source
    sourceslist.save()
  File "/usr/lib/python3/dist-packages/softwareproperties/extendedsourceslist.py", line 391, in save
    with open(filename, "w") as f:
PermissionError: [Errno 1] Operation not permitted: '/etc/apt/sources.list.d/dummy.list'

summary: - apt-add-repository fails if it encounters immutable sources.list.d entry
+ add-apt-repository fails if it encounters immutable sources.list.d entry
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-properties (Ubuntu):
status: New → Confirmed
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.