Bug#660889: apt: apt-cache -- Does not return correct status code
Package: apt
Version: 0.8.15.9
Severity: normal
Problem:
$ apt-cache policy nothing-to-find ; echo $?
N: Unable to locate package nothing-to-find
0
Program should return non-zero status. The current behavior disalows
using call in shell programs:
if ! apt-cache policy $package ; then
echo "Invalid package name: $package" >&2
return 1
fi
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (990, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt depends on:
ii debian-archive-keyring 2010.08.28
ii gnupg 1.4.11-3
ii libc6 2.13-26
ii libgcc1 1:4.6.2-14
ii libstdc++6 4.6.2-14
ii zlib1g 1:1.2.6.dfsg-1
apt recommends no packages.
Versions of packages apt suggests:
ii apt-doc <none>
ii aptitude 0.6.5-1
ii bzip2 1.0.6-1
ii dpkg-dev 1.16.1.2
ii python-apt 0.8.3+nmu1
ii xz-lzma [lzma] 5.1.1alpha+20110809-3
-- no debconf information
Reply to: