Project

General

Profile

Defect #117

Script is reporting an old update as a new one

Added by Deoren Moor about 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Ubuntu
Target version:
Start date:
08/01/2013
Due date:
% Done:

0%

Affected Version:
devel
Resolution:
Cant Reproduce

Description

Sample output of running apt-get dist-upgrade -s on a box that needs patching:

@root@ubuntu:/usr/local/sbin# apt-get dist-upgrade -s

Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  gnupg gpgv libgcrypt11
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst libgcrypt11 [1.5.0-3ubuntu0.1] (1.5.0-3ubuntu0.2 Ubuntu:12.04/precise-updates [amd64])
Inst gpgv [1.4.11-3ubuntu2.2] (1.4.11-3ubuntu2.3 Ubuntu:12.04/precise-updates [amd64])
Conf gpgv (1.4.11-3ubuntu2.3 Ubuntu:12.04/precise-updates [amd64])
Inst gnupg [1.4.11-3ubuntu2.2] (1.4.11-3ubuntu2.3 Ubuntu:12.04/precise-updates [amd64])
Conf gnupg (1.4.11-3ubuntu2.3 Ubuntu:12.04/precise-updates [amd64])
Conf libgcrypt11 (1.5.0-3ubuntu0.2 Ubuntu:12.04/precise-updates [amd64])

On this box for example we can see that the gpgv package needs upgrading and is going from gpgv-1.4.11-3ubuntu2.2 to gpgv-1.4.11-3ubuntu2.3. However, the update is reported as:

gpgv-1.4.11-3ubuntu2.2

Associated revisions

Revision 79 (diff)
Added by Deoren Moor about 4 years ago

[issues #117]
Matching against 'Conf' instead of 'Inst' to make it easier to parse out the "sanitized" name of the new package update to be installed (calculate_updates_via_apt() function).

History

#1 Updated by Deoren Moor about 4 years ago

This is the function that builds an array of available patches for Ubuntu systems (really needs to be tweaked to work on other Debian-based distros also):

calculate_updates_via_apt() {
    local -a RAW_UPDATES_ARRAY

    # Capture output in array so we can clean and return it
    # Using the follwing syntax mainly as a reminder that it's available
    RAW_UPDATES_ARRAY=($(apt-get dist-upgrade -s | grep 'Inst' | cut -c 6-))

    for update in "${RAW_UPDATES_ARRAY[@]}" 
    do
        # Return cleaned up string
        echo $(sanitize_string ${update})
    done

}

Specifically this line:

RAW_UPDATES_ARRAY=($(apt-get dist-upgrade -s | grep 'Inst' | cut -c 6-))

Instead of matching against Inst and doing a bit of regex processing to get at just the updated version, perhaps match against Conf instead?

#2 Updated by Deoren Moor about 4 years ago

  • Resolution set to Fixed

Deoren Moor wrote:

Instead of matching against Inst and doing a bit of regex processing to get at just the updated version, perhaps match against Conf instead?

Appears to work well. I'll test for a while before closing this out.

#3 Updated by Deoren Moor about 4 years ago

Looks like matching on Conf is causing some duplicate entries. I'll need to toss duplicates instead of adding them to the available updates array.

#4 Updated by Deoren Moor about 4 years ago

Deoren Moor wrote:

Looks like matching on Conf is causing some duplicate entries. I'll need to toss duplicates instead of adding them to the available updates array.

Uhm, nevermind?

root@content:~# apt-get dist-upgrade -s | grep 'Conf' | wc -l

19

root@content:~# apt-get dist-upgrade -s | grep 'Inst' | wc -l

19

#5 Updated by Deoren Moor almost 3 years ago

  • Status changed from Assigned to Closed
  • Resolution changed from Fixed to Cant Reproduce

Looks like a false positive. I've not noticed any issues since this was reported.

Also available in: Atom PDF