Cache(rootdir) needs to be absolute

Bug #792295 reported by Loïc Minier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-apt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-apt

Hi

When instanciating an apt.Cache with a rootdir, it will break if it's not absolute:
mkdir -p apt-test/etc/apt
cp /etc/apt/sources.list* -a apt-test/etc/apt
% python

Python 2.7.2rc1 (default, May 31 2011, 11:34:02)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import apt
>>> apt.Cache(rootdir='apt-test')
creating: apt-test/var/lib/dpkg
creating: apt-test/var/cache/apt/archives/partial
creating: apt-test/var/lib/apt/lists/partial
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 93, in __init__
    self.open(progress)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 136, in open
    self._cache = apt_pkg.Cache(progress)
SystemError: E:Could not open file apt-test/var/lib/apt/apt-test/var/lib/dpkg/status - open (2: No such file or directory), E:The package lists or status file could not be parsed or opened.

this with oneiric, apt 0.8.14.1ubuntu5 and python-apt 0.8.0~exp4ubuntu1.

apt.conf RootDir and python-apt's Cache.__doc__ don't say rootdir needs to be absolute; perhaps some piece of apt is broken WRT to rootdir, perhaps python-apt should make the path absolute, or perhaps the docs need to be updated to require an absolute dir.

Cheers,

Related branches

Revision history for this message
Julian Andres Klode (juliank) wrote :
Changed in python-apt (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-apt - 0.9.3.2

---------------
python-apt (0.9.3.2) unstable; urgency=high

  * Revert "* apt/cache.py:" (rootdir change) (Closes: #741251) (LP: #1288171)

    We cannot reset the configuration when rootdir is specified in
    apt.Cache(). This reopens: #728274.

 -- Julian Andres Klode <email address hidden> Mon, 10 Mar 2014 14:32:53 +0100

Changed in python-apt (Ubuntu):
status: Fix Committed → Fix Released
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.