apt test does not properly parse phased packages

Bug #2002391 reported by Adam Thorn
28
This bug affects 3 people
Affects Status Importance Assigned to Milestone
hobbit-plugins (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When a package has phased updates, the output of apt-cache policy contains some extra text:

grub2:
  Installed: 2.06-2ubuntu7.1
  Candidate: 2.06-2ubuntu7.1
  Version table:
 *** 2.06-2ubuntu7.1 500 (phased 27%)
        500 http://mirror.apps.cam.ac.uk/pub/linux/ubuntu jammy-updates/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.06-2ubuntu7 500
        500 http://mirror.apps.cam.ac.uk/pub/linux/ubuntu jammy/universe amd64 Packages

The regex used to parse the installed version (starting "***") does not match when the string "(phased 27%)" is present:

if (/^ (?: |\*\*\*) (\S*[^\s:]) (\d+)$/) { ... }

and thus the apt test incorrectly reports such a package is not installed from the apt repos:

&yellow Packages not installed from apt repositories (3):
   grub-pc-bin (2.06-2ubuntu7.1)
   grub2 (2.06-2ubuntu7.1)
   grub2-common (2.06-2ubuntu7.1)

Tags: patch

CVE References

Revision history for this message
Adam Thorn (alt36) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "apt-test-handle-phased-package.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in hobbit-plugins (Ubuntu):
status: New → Confirmed
Axel Beckert (xtaran)
Changed in hobbit-plugins (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.3 KiB)

This bug was fixed in the package hobbit-plugins - 20230211

---------------
hobbit-plugins (20230211) unstable; urgency=medium

  [ Axel Beckert ]
  * dirtyvcs: Automatically add existing repositories from
    /etc/xymon/dirty_vcs_dirs to /var/lib/xymon/.gitconfig's
    safe.directory setting to handle fallout of the fix for
    CVE-2022-24765. Thanks to Christian Herzog for the bug report!
    + Change owner and group of /var/lib/xymon/ to xymon:xymon.
  * Remove postinst code relevant for hobbit to xymon migration.
  * Remove debian/maintscript completely. Was relevant for migrations
    before 2015, i.e. before oldoldstable.
  * Replace all occurrences of egrep and fgrep with grep -E/-F.
    Thanks tarzeau for reporting this!
  * Fix typo in comment in libs.yaml.
  * yum: Don't count "Errno" as alert if it is prepended by a dash or
    followed by a full stop, e.g. in package names like perl-Errno.x86_64.
  * Mention explicitly in the package description that hard dependencies
    of plugins enabled by default are listed in Recommends and
    dependencies of plugins disabled by default are listed in
    Suggests. Based on the according comment in debian-goodies' package
    description. (Closes: #1016162)
  * Fix bogus "Last apt update: -0.0 day(s) ago" warning by adding a small
    tolerance. (Closes: #1021775)
  * Split off the kernel/reboot check from the libs check into a separate
    check. (Closes: #752776)
    + Do not warn (and just report "clear") if the kernel image can't be
      parsed. This doesn't prompt for an action by the administrator.
      (Currently a common, but non-trivial issue on armhf, see
      /usr/share/doc/hobbit-plugins/TODO.)
  * temp:
    + Suppress grep error message if a host has no
      /sys/class/scsi_generic/.
    + Also support more than 26 (and up to 676) disks, i.e. disks named
      /dev/sdaa to /dev/sdzz).
    + Support NVMe block devices via drivetemp.
    + Consistent paths below /sys/devices/platform/ and /sys/devices/pci*.
    + Completely remove hddtemp support. (Really closes: #1001950)
    + Report "clear" if no thermal zones or hwmons are found. Avoids going
      purple after hddtemp has been removed.
    + Report "yellow" if no thermal zones or hwmons are found and
      "drivetemp" driver is not loaded.
    + Fix "Use of uninitialized value" errors in exception handling.
  * Declare compliance with Debian Policy 4.6.2.
  * Add new server-side "xcl" check to query Lenovo XClarity API for
    hardware failure events. (disabled by default; add Suggests and B-D on
    libmojolicious-perl for usage of Mojo::JSON and Mojo::UserAgent)
  * Use more precise Files stanzas and update years in debian/copyright.
  * Also update my copyright years in some plugins.

  [ Adam Goryachev ]
  * kern: Be less strict in parsing kernel versions, allow trailing
    garbage as present on Ubuntu for Raspberry Pi. (LP: #1904807)

  [ Adam Thorn ]
  * apt: Properly parse phased packages on Ubuntu. (LP: #2002391,
    #2003062, #1995481)

  [ Debian Janitor ]
  * Remove constraints unnecessary since buster (oldstable):
    + Drop versioned build-dependency on essential package dpkg-dev.
    + Drop versioned pre-d...

Read more...

Changed in hobbit-plugins (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.