Public bug reported:

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'

** Affects: software-properties (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to software-properties in Ubuntu.
https://bugs.launchpad.net/bugs/1995105

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

Status in software-properties package in Ubuntu:
  New

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'

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1995105/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to