Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninstalled package shows as installed #1092

Closed
nvtkaszpir opened this issue Sep 17, 2016 · 1 comment · Fixed by #1111
Closed

uninstalled package shows as installed #1092

nvtkaszpir opened this issue Sep 17, 2016 · 1 comment · Fixed by #1111
Labels
Type: Bug Feature not working as expected

Comments

@nvtkaszpir
Copy link
Contributor

nvtkaszpir commented Sep 17, 2016

Description

Some systems do not fully uninstall packages, they leave some files used in case of reinstall, and this leads to false positives. Especially when dealing with packages under Ubuntu and is in 'rc' stage, that is, it was not removed with --purge.

In general it shows what package manager shows, and it is true, but I think it is rather misleading.

InSpec and Platform Version

inspec 0.32.0
Ubuntu 15.10, tests executed via ssh on Ubuntu 14.04.

Replication Case

Test file:

title 'htop package'
control 'package-htop' do
  impact 1.0
  title 'htop package should be installed'
  desc 'htop package should be installed'
  describe package('htop') do
    it { should be_installed }
  end
end

Steps:

  • install htop package
  • run inspec test file, see the output, package is installed
  • uninstall htop package
  • run inspec test file, see the output, package is still installed

see dpkg -l |grep -i htop showing the package is in rc state (removed, configured) so dpkg still shows package exists but actually it is in incomplete state.

Possible Solutions

'installed' package should actually be installed, fix parsing of package manager's output.
Current test implementation for deb packages just checks exit code on dpkg -s <package>, which is not enough.

Stacktrace

No stack trace.

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Sep 19, 2016
@chris-rock
Copy link
Contributor

Thanks @nvtkaszpir That is very helpful feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants