[Bug 1778547] Re: Broken system lock counting

Julian Andres Klode 1778547 at bugs.launchpad.net
Thu Jun 28 09:12:28 UTC 2018


=========== bionic OK (1.6.1 -> 1.6.2) =====================

+ lxc launch -e ubuntu:bionic lp1778547-bionic
Creating lp1778547-bionic
Starting lp1778547-bionic
+ sleep 5
+ lxc exec lp1778547-bionic -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.6.1
[('0', '/dev/pts/5'), ('1', '/dev/pts/5'), ('2', '/dev/pts/5'), ('3', 'pipe:[749881]'), ('4', '/var/lib/dpkg/lock'), ('5', '/var/lib/dpkg/lock'), ('6', '<deleted>'), ('17', 'socket:[43872]')]                                                                                            
[('0', '/dev/pts/5'), ('1', '/dev/pts/5'), ('2', '/dev/pts/5'), ('3', 'pipe:[749881]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]                                                                                                                         
+ lxc exec lp1778547-bionic -- sh -c 'echo deb http://archive.ubuntu.com/ubuntu bionic-proposed main >> /etc/apt/sources.list && apt-get update && apt-get -qy install libapt-pkg5.0'                                                                                                      
dpkg-preconfigure: unable to re-open stdin: No such file or directory
+ lxc exec lp1778547-bionic -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.6.2
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[779703]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[779703]'), ('4', '<deleted>'), ('17', 'socket:[43872]')]
+ lxc stop lp1778547-bionic

==================== artful OK (1.5.1 -> 1.5.2) ===============================
+ lxc launch -e ubuntu:artful lp1778547-artful
Creating lp1778547-artful
Starting lp1778547-artful
+ sleep 5
+ lxc exec lp1778547-artful -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.5.1
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[818873]'), ('4', '/var/lib/dpkg/lock'), ('5', '/var/lib/dpkg/lock'), ('6', '<deleted>'), ('17', 'socket:[43872]')]                                                                                            
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[818873]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]                                                                                                                         
+ lxc exec lp1778547-artful -- sh -c 'echo deb http://archive.ubuntu.com/ubuntu artful-proposed main >> /etc/apt/sources.list && apt-get update && apt-cache policy libapt-pkg5.0 && apt-get -y install libapt-pkg5.0'                                                                     
dpkg-preconfigure: unable to re-open stdin: No such file or directory
+ lxc exec lp1778547-artful -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.5.2
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[826053]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]                                                                                                                         
[('0', '/dev/pts/4'), ('1', '/dev/pts/4'), ('2', '/dev/pts/4'), ('3', 'pipe:[826053]'), ('4', '<deleted>'), ('17', 'socket:[43872]')]


====== xenial OK (1.2.26->1.2.27) =====================

+ lxc launch -e ubuntu:xenial lp1778547-xenial
Creating lp1778547-xenial
Starting lp1778547-xenial
+ sleep 5
+ lxc exec lp1778547-xenial -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.2.26
[('0', '/dev/pts/6'), ('1', '/dev/pts/6'), ('2', '/dev/pts/6'), ('3', 'pipe:[764358]'), ('4', '/var/lib/dpkg/lock'), ('5', '/var/lib/dpkg/lock'), ('6', '<deleted>'), ('17', 'socket:[43872]')]
[('0', '/dev/pts/6'), ('1', '/dev/pts/6'), ('2', '/dev/pts/6'), ('3', 'pipe:[764358]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]
+ lxc exec lp1778547-xenial -- sh -c 'echo deb http://archive.ubuntu.com/ubuntu xenial-proposed main >> /etc/apt/sources.list && apt-get update && apt-get -qy install libapt-pkg5.0'
dpkg-preconfigure: unable to re-open stdin: No such file or directory
+ lxc exec lp1778547-xenial -- sh -c 'apt-cache policy libapt-pkg5.0 | grep Inst ; python3 /home/jak/a.py'
  Installed: 1.2.27
[('0', '/dev/pts/3'), ('1', '/dev/pts/3'), ('2', '/dev/pts/3'), ('3', 'pipe:[781507]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[43872]')]
[('0', '/dev/pts/3'), ('1', '/dev/pts/3'), ('2', '/dev/pts/3'), ('3', 'pipe:[781507]'), ('4', '<deleted>'), ('17', 'socket:[43872]')]
+ lxc stop lp1778547-xenial


** Tags removed: verification-needed verification-needed-artful verification-needed-bionic verification-needed-xenial
** Tags added: verification-done verification-done-artful verification-done-bionic verification-done-xenial

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

Title:
  Broken system lock counting

Status in apt package in Ubuntu:
  Fix Committed
Status in apt source package in Xenial:
  Fix Committed
Status in apt source package in Artful:
  Fix Committed
Status in apt source package in Bionic:
  Fix Committed

Bug description:
  [Impact]
  System lock unrefing is broken, off-by-one error. Locking twice opens a second fd for the lock file, and the old fd gets lost and remains open for the remaining duration of the program

  [Test case]

  Executing the following script should show one lock file in the first
  line, and none in the last line.

  def maybe_readlink(path):
    try:
      return os.readlink(path)
    except:
      return "<deleted>"

  import os, apt_pkg
  apt_pkg.init()
  apt_pkg.pkgsystem_lock()
  apt_pkg.pkgsystem_lock()
  print([(p, maybe_readlink("/proc/self/fd/" + p)) for p in os.listdir("/proc/self/fd")])
  apt_pkg.pkgsystem_unlock()
  apt_pkg.pkgsystem_unlock()
  print([(p, maybe_readlink("/proc/self/fd/" + p)) for p in os.listdir("/proc/self/fd")])

  [Test output]
  good, cosmic:
  [('0', '/dev/pts/2'), ('1', '/dev/pts/2'), ('2', '/dev/pts/2'), ('3', '/var/lib/dpkg/lock'), ('4', '<deleted>')]
  [('0', '/dev/pts/2'), ('1', '/dev/pts/2'), ('2', '/dev/pts/2'), ('3', '<deleted>')]

  bad, bionic:
  [('0', '/dev/pts/0'), ('1', '/dev/pts/0'), ('2', '/dev/pts/0'), ('3', 'pipe:[40889331]'), ('4', '/var/lib/dpkg/lock'), ('5', '/var/lib/dpkg/lock'), ('6', '<deleted>'), ('17', 'socket:[53931]')]
  [('0', '/dev/pts/0'), ('1', '/dev/pts/0'), ('2', '/dev/pts/0'), ('3', 'pipe:[40889331]'), ('4', '/var/lib/dpkg/lock'), ('5', '<deleted>'), ('17', 'socket:[53931]')]

  [Regression potential]
  A locking change can potentially break locking, but this one seems like an obvious off-by-one error.

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



More information about the foundations-bugs mailing list