[Bug 1974015] Re: apt.Cache(rootdir='/') causes PermissionError
Julian Andres Klode
1974015 at bugs.launchpad.net
Fri Jul 21 14:34:26 UTC 2023
rootdir generally expects a writable directory, but it seems like a nice
idea to make it not write a sources.list if sources.list.d exist
** Changed in: python-apt (Ubuntu)
Importance: Undecided => Low
** Changed in: python-apt (Ubuntu)
Status: New => Triaged
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/1974015
Title:
apt.Cache(rootdir='/') causes PermissionError
Status in python-apt package in Ubuntu:
Triaged
Bug description:
The apport test case test_run_report_bug_kernel_thread fails in my
schroot environment. My schroot environment has only one
/etc/apt/sources.list.d/ubuntu.sources file and no
/etc/apt/sources.list file.
Running following test script as non-root will fail:
```
#!/usr/bin/python3
import apt
apt.Cache(rootdir='/')
```
$ ./test
Traceback (most recent call last):
File "./test", line 3, in <module>
apt.Cache(rootdir='/')
File "/usr/lib/python3/dist-packages/apt/cache.py", line 143, in __init__
self._check_and_create_required_dirs(rootdir)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 186, in _check_and_create_required_dirs
open(rootdir + f, "w").close()
PermissionError: [Errno 13] Permission denied: '//etc/apt/sources.list'
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1974015/+subscriptions
More information about the foundations-bugs
mailing list