Public bug reported:

Binary package hint: python-apt

I think this bug is in Python-APT package ...

apt.cache.commit() always failed, if the global lock in apt_pkg is not
released.

To reproduce the bug, please run the following Python program:

        import apt, apt_pkg
        apt_pkg.init()
        apt_pkg.PkgSystemLock()
        apt_cache = apt.cache.Cache()
        pkg = apt_cache['2vcard']
        if not pkg.isInstalled:
            pkg.mark_install()
        else:
            pkg.mark_delete()
        apt_cache.commit()
        apt_pkg.PkgSystemUnLock()

Error message is:
dpkg: status database area is locked by another process
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    apt_cache.commit()
  File "/usr/lib/python2.6/dist-packages/apt/deprecation.py", line 103, in 
deprecated_function
    return func(*args, **kwds)
  File "/usr/lib/python2.6/dist-packages/apt/cache.py", line 381, in commit
    raise SystemError("installArchives() failed")
SystemError: installArchives() failed

If we release the global lock in apt_pkg first, then apt.cache.commit()
will success. The following Python program will success:

        import apt, apt_pkg
        apt_pkg.init()
        apt_pkg.PkgSystemLock()
        apt_cache = apt.cache.Cache()
        pkg = apt_cache['2vcard']
        if not pkg.isInstalled:
            pkg.mark_install()
        else:
            pkg.mark_delete()
        apt_pkg.PkgSystemUnLock()
        apt_cache.commit()

The system is Ubuntu 10.04 x86_64 version. All packages is of the latest
version.

Best regards,
Homer

** Affects: python-apt (Ubuntu)
     Importance: Undecided
         Status: New

-- 
apt.cache.commit() failed if apt_pkg.PkgSystemLock() is called()
https://bugs.launchpad.net/bugs/598945
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to