Public bug reported:

[Impact]
The last SRU introduced a regression in error handling, where apt_pkg.Error is 
being caught - but that class is not available in xenial - it still uses 
SystemError

[Test case]

Run python3 -c "import apt; apt.Cache().update()" while running apt
update.

You should see:

# <command>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 468, in update
    raise LockFailedException("Failed to lock %s" % lockfile)
apt.cache.LockFailedException: Failed to lock /var/lib/apt/lists/lock

Currently you see:
# <command>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 63, in __enter__
    return self._lock.__enter__()
SystemError: E:Could not get lock /var/lib/apt/lists/lock - open (11: Resource 
temporarily unavailable)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 481, in update
    with _WrappedLock(apt_pkg.config.find_dir("Dir::State::Lists")):
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 64, in __enter__
    except apt_pkg.Error as e:
AttributeError: module 'apt_pkg' has no attribute 'Error'

[Regression potential]
It really can't get worse than this. But FWIW: This only affects code paths 
where we could not lock the lists/ or archives/ directory - they currently 
throw the AttributeError, and will then throw LockFailedException again - as 
they did before the SRU.

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

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

** Description changed:

  [Impact]
  The last SRU introduced a regression in error handling, where apt_pkg.Error 
is being caught - but that class is not available in xenial - it still uses 
SystemError
  
  [Test case]
  
  Run python3 -c "import apt; apt.Cache().update()" while running apt
  update.
  
- 
  You should see:
  
  # <command>
- Traceback (most recent call last):                                            
                                                                                
                                                                                
                                              
-   File "<string>", line 1, in <module>                                        
                                                                                
                                                                                
                                              
-   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 468, in update
-     raise LockFailedException("Failed to lock %s" % lockfile)
+ Traceback (most recent call last):
+   File "<string>", line 1, in <module>
+   File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 468, in update
+     raise LockFailedException("Failed to lock %s" % lockfile)
  apt.cache.LockFailedException: Failed to lock /var/lib/apt/lists/lock
  
  Currently you see:
  # <command>
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/apt/cache.py", line 63, in __enter__
-     return self._lock.__enter__()
+   File "/usr/lib/python3/dist-packages/apt/cache.py", line 63, in __enter__
+     return self._lock.__enter__()
  SystemError: E:Could not get lock /var/lib/apt/lists/lock - open (11: 
Resource temporarily unavailable)
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
-   File "<string>", line 1, in <module>
-   File "/usr/lib/python3/dist-packages/apt/cache.py", line 481, in update
-     with _WrappedLock(apt_pkg.config.find_dir("Dir::State::Lists")):
-   File "/usr/lib/python3/dist-packages/apt/cache.py", line 64, in __enter__
-     except apt_pkg.Error as e:
+   File "<string>", line 1, in <module>
+   File "/usr/lib/python3/dist-packages/apt/cache.py", line 481, in update
+     with _WrappedLock(apt_pkg.config.find_dir("Dir::State::Lists")):
+   File "/usr/lib/python3/dist-packages/apt/cache.py", line 64, in __enter__
+     except apt_pkg.Error as e:
  AttributeError: module 'apt_pkg' has no attribute 'Error'
  
  [Regression potential]
- It really can't get worse than this.
+ It really can't get worse than this. But FWIW: This only affects code paths 
where we could not lock the lists/ or archives/ directory - they currently 
throw the AttributeError, and will then throw LockFailedException again - as 
they did before the SRU.

** Also affects: python-apt (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: python-apt (Ubuntu)
       Status: New => Invalid

** Changed in: python-apt (Ubuntu Xenial)
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1830635

Title:
  Regression: xenial: Uses apt_pkg.Error, which is only available in
  later versions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1830635/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to