Bug#738880: apt-get uses globbing but reports regex for selecting packages + documentation issues
Package: apt
Version: 0.9.15
Severity: normal
Dear Maintainer, here is an example which demonstrates this bug:
$ sudo apt-get remove 'libre?f?ice.*'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libreoffice.org-calc' for regex 'libre?f?ice.*'
Note, selecting 'libreoffice.org-writer' for regex 'libre?f?ice.*'
Package 'libreoffice.org-calc' is not installed, so not removed
Package 'libreoffice.org-writer' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
$ apt-cache dump | grep -E 'libre?f?ice.*'
$ apt-cache dump | grep -F 'libreoffice.org-calc'
Depends: libreoffice.org-calc (null)
Package: libreoffice.org-calc
The above commands show that the packages selected by apt-get
(libreoffice.org-calc and libreoffice.org-writer) didn't match
libre?f?ice.* regex.
Obviously, apt-get interprets libre?f?ice.* as a glob pattern. So,
instead of reporting
Note, selecting 'libreoffice.org-writer' for regex 'libre?f?ice.*'
it should report
Note, selecting 'libreoffice.org-writer' for glob 'libre?f?ice.*'
I came about this bug after experiencing the issue described on
https://lists.debian.org/debian-user/2014/02/msg00639.html
I'd say that the current apt-get manpage should be expanded and
clarified in regard to matching package names.
The last paragraph of the install command description reads:
If no package matches the given expression and the expression
contains one of '.', '?' or '*' then it is assumed to be a POSIX
regular expression, and it is applied to all package names in the
database. Any matches are then installed (or removed). Note that
matching is done by substring so 'lo.*' matches 'how-lo' and
'lowest'. If this is undesired, anchor the regular expression with
a '^' or '$' character, or create a more specific regular
expression.
That explanation has two issues:
(1) It should say that packages may be specified as glob patterns (see
glob(7)).
(2) If no package matches the given expression, it is assumed to be a
POSIX extended regular expression (see regex(7)). It IS NOT required
that the expression contains one of '.', '?' or '*'. Here is an
example:
$ sudo apt-get install '^vlc$'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'vlc' for regex '^vlc$'
vlc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Please improve the manpage so that it explains the pattern matching
accurately. It would prevent issues with regular expressions that can
be also valid glob expressions.
I've found that bug #475341 also reports on the issues in the apt-get
documentation. E.g. the possibility of appending a package name with a
hyphen (-), a plus sign (+) or an equal sign followed by the version
number is not explained in regard to globbing or regex.
The following examples show that each of these suffixes are stripped
off before matching package names:
$ sudo apt-get -s remove 'inx*+'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'inxi' for regex 'inx*'
inxi is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
$ sudo apt-get -s install '^vlc$-'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'vlc' for regex '^vlc$'
The following packages will be REMOVED:
browser-plugin-vlc vlc
0 upgraded, 0 newly installed, 2 to remove and 12 not upgraded.
Remv browser-plugin-vlc [2.0.6-2]
Remv vlc [2.1.2-2+b1]
$ sudo apt-get -s install '^vlc$=2.1.2-2+b1'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'vlc' for regex '^vlc$'
vlc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Please improve the manpage in this regard too.
-- Package-specific info:
-- apt-config dump --
APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Install-Recommends "1";
APT::Install-Suggests "0";
APT::Authentication "";
APT::Authentication::TrustCDROM "true";
APT::NeverAutoRemove "";
APT::NeverAutoRemove:: "^firmware-linux.*";
APT::NeverAutoRemove:: "^linux-firmware$";
APT::NeverAutoRemove:: "^kfreebsd-image.*";
APT::NeverAutoRemove:: "^gnumach$";
APT::NeverAutoRemove:: "^gnumach-image.*";
APT::NeverAutoRemove:: "^linux-image-3.11-2-amd64$";
APT::NeverAutoRemove:: "^linux-image-extra-3.11-2-amd64$";
APT::NeverAutoRemove:: "^linux-signed-image-3.11-2-amd64$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3.11-2-amd64$";
APT::NeverAutoRemove:: "^linux-headers-3.11-2-amd64$";
APT::NeverAutoRemove:: "^linux-image-3.12-1-amd64$";
APT::NeverAutoRemove:: "^linux-image-extra-3.12-1-amd64$";
APT::NeverAutoRemove:: "^linux-signed-image-3.12-1-amd64$";
APT::NeverAutoRemove:: "^linux-backports-modules-.*-3.12-1-amd64$";
APT::NeverAutoRemove:: "^linux-headers-3.12-1-amd64$";
APT::Never-MarkAuto-Sections "";
APT::Never-MarkAuto-Sections:: "metapackages";
APT::Never-MarkAuto-Sections:: "restricted/metapackages";
APT::Never-MarkAuto-Sections:: "universe/metapackages";
APT::Never-MarkAuto-Sections:: "multiverse/metapackages";
APT::Never-MarkAuto-Sections:: "oldlibs";
APT::Never-MarkAuto-Sections:: "restricted/oldlibs";
APT::Never-MarkAuto-Sections:: "universe/oldlibs";
APT::Never-MarkAuto-Sections:: "multiverse/oldlibs";
APT::Update "";
APT::Update::Post-Invoke-Success "";
APT::Update::Post-Invoke-Success:: "[ ! -f
/var/run/dbus/system_bus_socket ] || /usr/bin/dbus-send --system
--dest=org.debian.apt --type=signal /org/debian/apt
org.debian.apt.CacheChanged || true";
APT::Update::Post-Invoke-Success:: "/usr/bin/test -e
/usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service
&& /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus
call --system --dest org.freedesktop.PackageKit --object-path
/org/freedesktop/PackageKit --timeout 4 --method
org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null;
/bin/echo > /dev/null";
APT::Architectures "";
APT::Architectures:: "amd64";
APT::Compressor "";
APT::Compressor::. "";
APT::Compressor::.::Name ".";
APT::Compressor::.::Extension "";
APT::Compressor::.::Binary "";
APT::Compressor::.::Cost "1";
APT::Compressor::gzip "";
APT::Compressor::gzip::Name "gzip";
APT::Compressor::gzip::Extension ".gz";
APT::Compressor::gzip::Binary "gzip";
APT::Compressor::gzip::Cost "2";
APT::Compressor::gzip::CompressArg "";
APT::Compressor::gzip::CompressArg:: "-9n";
APT::Compressor::gzip::UncompressArg "";
APT::Compressor::gzip::UncompressArg:: "-d";
APT::Compressor::bzip2 "";
APT::Compressor::bzip2::Name "bzip2";
APT::Compressor::bzip2::Extension ".bz2";
APT::Compressor::bzip2::Binary "bzip2";
APT::Compressor::bzip2::Cost "3";
APT::Compressor::bzip2::CompressArg "";
APT::Compressor::bzip2::CompressArg:: "-9";
APT::Compressor::bzip2::UncompressArg "";
APT::Compressor::bzip2::UncompressArg:: "-d";
APT::Compressor::xz "";
APT::Compressor::xz::Name "xz";
APT::Compressor::xz::Extension ".xz";
APT::Compressor::xz::Binary "xz";
APT::Compressor::xz::Cost "4";
APT::Compressor::xz::CompressArg "";
APT::Compressor::xz::CompressArg:: "-6";
APT::Compressor::xz::UncompressArg "";
APT::Compressor::xz::UncompressArg:: "-d";
APT::Compressor::lzma "";
APT::Compressor::lzma::Name "lzma";
APT::Compressor::lzma::Extension ".lzma";
APT::Compressor::lzma::Binary "xz";
APT::Compressor::lzma::Cost "5";
APT::Compressor::lzma::CompressArg "";
APT::Compressor::lzma::CompressArg:: "--format=lzma";
APT::Compressor::lzma::CompressArg:: "-9";
APT::Compressor::lzma::UncompressArg "";
APT::Compressor::lzma::UncompressArg:: "--format=lzma";
APT::Compressor::lzma::UncompressArg:: "-d";
APT::Compressor::::Name "";
APT::Compressor::::Extension ".";
APT::Compressor::::Binary "";
APT::Compressor::::Cost "100";
APT::Compressor::::CompressArg "";
APT::Compressor::::CompressArg:: "-9";
APT::Compressor::::UncompressArg "";
APT::Compressor::::UncompressArg:: "-d";
Dir "/";
Dir::State "var/lib/apt/";
Dir::State::lists "lists/";
Dir::State::cdroms "cdroms.list";
Dir::State::mirrors "mirrors/";
Dir::State::extended_states "extended_states";
Dir::State::status "/var/lib/dpkg/status";
Dir::Cache "var/cache/apt/";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
Dir::Etc "etc/apt/";
Dir::Etc::sourcelist "sources.list";
Dir::Etc::sourceparts "sources.list.d";
Dir::Etc::vendorlist "vendors.list";
Dir::Etc::vendorparts "vendors.list.d";
Dir::Etc::main "apt.conf";
Dir::Etc::netrc "auth.conf";
Dir::Etc::parts "apt.conf.d";
Dir::Etc::preferences "preferences";
Dir::Etc::preferencesparts "preferences.d";
Dir::Etc::trusted "trusted.gpg";
Dir::Etc::trustedparts "trusted.gpg.d";
Dir::Bin "";
Dir::Bin::methods "/usr/lib/apt/methods";
Dir::Bin::solvers "";
Dir::Bin::solvers:: "/usr/lib/apt/solvers";
Dir::Bin::dpkg "/usr/bin/dpkg";
Dir::Bin::bzip2 "/bin/bzip2";
Dir::Bin::xz "/usr/bin/xz";
Dir::Bin::lzma "/usr/bin/xz";
Dir::Media "";
Dir::Media::MountPath "/media/cdrom";
Dir::Log "var/log/apt";
Dir::Log::Terminal "term.log";
Dir::Log::History "history.log";
Dir::Ignore-Files-Silently "";
Dir::Ignore-Files-Silently:: "~$";
Dir::Ignore-Files-Silently:: "\.disabled$";
Dir::Ignore-Files-Silently:: "\.bak$";
Dir::Ignore-Files-Silently:: "\.dpkg-[a-z]+$";
Dir::Ignore-Files-Silently:: "\.save$";
Dir::Ignore-Files-Silently:: "\.orig$";
Acquire "";
Acquire::cdrom "";
Acquire::cdrom::mount "/media/cdrom";
Acquire::Languages "";
Acquire::Languages:: "en";
Acquire::Languages:: "none";
DPkg "";
DPkg::Pre-Install-Pkgs "";
DPkg::Pre-Install-Pkgs:: "/usr/bin/apt-listchanges --apt || test $? -ne 10";
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true";
DPkg::Tools "";
DPkg::Tools::Options "";
DPkg::Tools::Options::/usr/bin/apt-listchanges "";
DPkg::Tools::Options::/usr/bin/apt-listchanges::Version "2";
DPkg::Post-Invoke "";
DPkg::Post-Invoke:: "/usr/bin/test -e
/usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service
&& /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus
call --system --dest org.freedesktop.PackageKit --object-path
/org/freedesktop/PackageKit --timeout 4 --method
org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null;
/bin/echo > /dev/null";
Unattended-Upgrade "";
Unattended-Upgrade::Origins-Pattern "";
Unattended-Upgrade::Origins-Pattern::
"origin=Debian,archive=${distro_codename},label=Debian-Security";
CommandLine "";
CommandLine::AsString "apt-config dump";
-- (no /etc/apt/preferences present) --
-- /etc/apt/sources.list --
deb http://ftp.hr.debian.org/debian/ testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib
deb http://ftp.hr.debian.org/debian/ testing-updates main contrib non-free
deb http://ftp.hr.debian.org/debian/ testing-proposed-updates main
contrib non-free
deb-src http://ftp.hr.debian.org/debian/ testing main contrib non-free
-- System Information:
Debian Release: jessie/sid
APT prefers testing-updates
APT policy: (500, 'testing-updates'), (500,
'testing-proposed-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.12-1-amd64 (SMP w/2 CPU cores)
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 2012.4
ii gnupg 1.4.16-1
ii libapt-pkg4.12 0.9.15
ii libc6 2.17-97
ii libgcc1 1:4.8.2-14
ii libstdc++6 4.8.2-14
apt recommends no packages.
Versions of packages apt suggests:
ii apt-doc 0.9.15
ii aptitude 0.6.8.4-1
ii dpkg-dev 1.17.6
ii python-apt 0.9.1
ii synaptic 0.80.4
ii xz-utils 5.1.1alpha+20120614-2
-- no debconf information
Reply to: