Skip to content
  • intrigeri's avatar
    Test suite: don't rely on the state of the APT lists to check if a package is... · fef1d042
    intrigeri authored
    Test suite: don't rely on the state of the APT lists to check if a package is installed (refs: #14596)
    
    I've seen cases where "apt-cache policy" would fail, when run by
    'the package "cowsay" is not installed', as part of
    "I am notified when Additional Software fails to install a package",
    with:
    
      E: Malformed Description-md5 line; doesn't have the required length (32 != 29)
      '0143a1c3acbdb045e4fcaab0d8657"
    
    This seems wrong and I don't know why this happens, but let's not get
    side-tracked: the goal here is to check whether a given package is installed,
    not to validate the state of the APT lists. So let's use dpkg instead.
    
    For details about why "dpkg -s" was initially replaced with "apt-cache policy",
    see c77c2dd9. The analysis of the problem in
    that commit message was correct: "deinstall" means "The package is selected for
    deinstallation" and is indeed a transient state. The solution did work until we
    face a situation when the higher level tool fails while checking things we're
    not interested in.
    fef1d042