[Bug 1974015] [NEW] apt.Cache(rootdir='/') causes PermissionError
Benjamin Drung
1974015 at bugs.launchpad.net
Wed May 18 11:04:16 UTC 2022
Public bug reported:
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'
** Affects: python-apt (Ubuntu)
Importance: Undecided
Status: New
--
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:
New
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