Fix a bug of check_installed on Debian squeeze. #138

Merged
merged 1 commit into from Jun 7, 2013

Conversation

Projects
None yet
2 participants
@ryotarai
Contributor

ryotarai commented Jun 7, 2013

On debian squeeze, dpkg -s <purged package name> returns 0 as exit code.

For example:

vagrant@debian-squeeze:~$ cat /etc/debian_version
6.0.7
vagrant@debian-squeeze:~$ dpkg -s git
Package `git' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
vagrant@debian-squeeze:~$ echo $?
1
vagrant@debian-squeeze:~$ sudo apt-get install git
# abbr.
vagrant@debian-squeeze:~$ dpkg -s git
# abbr.
vagrant@debian-squeeze:~$ echo $?
0
vagrant@debian-squeeze:~$ sudo apt-get purge git
# abbr.
vagrant@debian-squeeze:~$ dpkg -s git
Package: git
Status: unknown ok not-installed
Priority: optional
Section: vcs
vagrant@debian-squeeze:~$ echo $?
0

Because of this problem, I use dpkg -s <package> && ! dpkg -s <package> | grep -E '^Status: .+ not-installed$' instead of dpkg -s <package>

I tested this command on Ubuntu (Precise) and Debian (Squeeze).
Test log is here: https://gist.github.com/ryotarai/5729755

mizzy added a commit that referenced this pull request Jun 7, 2013

Merge pull request #138 from ryotarai/fix-debian-check_installed
Fix a bug of check_installed on Debian squeeze.

@mizzy mizzy merged commit 1f86918 into mizzy:master Jun 7, 2013

1 check passed

default The Travis CI build passed
Details
@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Jun 7, 2013

Owner

Thanks!

Owner

mizzy commented Jun 7, 2013

Thanks!

@ryotarai ryotarai deleted the ryotarai:fix-debian-check_installed branch Jun 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment