[Pkg-zsh-devel] Bug#962135: patch for bugs 962133 and 962135

Vincent Lefevre vincent at vinc17.net
Wed Jun 3 18:55:50 BST 2020


Control: tags 962133 patch
Control: tags 962135 patch

I've attached a patch for Debian bugs 962133 ("dpkg -s" completion)
and 962135 ("dpkg -l" completion), which also fixes "dpkg --remove"
and "dpkg --purge" completions. I've added a note about that:

# Note: Packages may be marked as "deinstall" or "purge", i.e. selected
# for deinstallation or to be purged (see dpkg(1) man page); this means
# that the operation has not been completed yet. In the meantime, such
# packages may still be installed (if marked as purge, one is not sure,
# though, as the package could have been uninstalled but not purged yet),
# so that purge and remove operations remain valid.

Basically, the fix consists of the _dpkg change.

My patch also removes "deinstalled" from _deb_packages as it does not
seem to be used (and should be useless).

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
-------------- next part --------------
diff -aurd compl-debian-deb/_deb_packages compl-debian-fix/_deb_packages
--- compl-debian-deb/_deb_packages	2020-03-22 15:12:25.000000000 +0000
+++ compl-debian-fix/_deb_packages	2020-06-03 17:09:43.704256786 +0000
@@ -1,6 +1,6 @@
 #autoload
 
-# Usage: _deb_packages expl...  (installed|deinstalled|xinstalled|held|uninstalled|avail|available|source)
+# Usage: _deb_packages expl...  (installed|xinstalled|held|uninstalled|avail|available|source)
 
 _deb_packages_update_avail () {
   if ( [[ ${+_deb_packages_cache_avail} -eq 0 ]] ||
@@ -41,19 +41,6 @@
   cachevar=_deb_packages_cache_held
 }
 
-_deb_packages_update_deinstalled () {
-  if ( [[ ${+_deb_packages_cache_deinstalled} -eq 0 ]] ||
-      _cache_invalid DEBS_deinstalled ) && ! _retrieve_cache DEBS_deinstalled;
-  then
-    _deb_packages_cache_deinstalled=()
-    dpkg --get-selections | while read package state ; do
-        [[ $state = deinstall ]] && _deb_packages_cache_deinstalled+=$package
-    done
-    _store_cache DEBS_deinstalled _deb_packages_cache_deinstalled
-  fi
-  cachevar=_deb_packages_cache_deinstalled
-}
-
 _deb_packages_update_xinstalled () {
   if ( [[ ${+_deb_packages_cache_xinstalled} -eq 0 ]] ||
       _cache_invalid DEBS_xinstalled ) && ! _retrieve_cache DEBS_xinstalled;
@@ -103,14 +90,14 @@
     zstyle ":completion:*:*:$service:*" cache-policy _debs_caching_policy
   fi
 
-  [[ "$command" = (installed|deinstalled|xinstalled|held|uninstalled|avail|available|source) ]] || {
+  [[ "$command" = (installed|xinstalled|held|uninstalled|avail|available|source) ]] || {
     _message "unknown command: $command"
     return
   }
 
   zstyle -s ":completion:${curcontext}:" packageset pkgset
 
-  [[ "$pkgset" = (installed|deinstalled|xinstalled|held|uninstalled|avail|available|source) ]] || {
+  [[ "$pkgset" = (installed|xinstalled|held|uninstalled|avail|available|source) ]] || {
     pkgset="$command"
   }
 
diff -aurd compl-debian-deb/_dpkg compl-debian-fix/_dpkg
--- compl-debian-deb/_dpkg	2020-03-22 15:12:25.000000000 +0000
+++ compl-debian-fix/_dpkg	2020-06-03 17:24:33.866990607 +0000
@@ -149,21 +149,17 @@
       - nonrecur \
 	'*: :_deb_files'
   ;;
-  remove|status|listfiles)
-    _call_function ret _dpkg_$state && return ret
-    _arguments -C -A "-*" -s "$_dpkg_options[@]" \
-       '*:package:_deb_packages installed'
-  ;;
-  purge)
+# Note: Packages may be marked as "deinstall" or "purge", i.e. selected
+# for deinstallation or to be purged (see dpkg(1) man page); this means
+# that the operation has not been completed yet. In the meantime, such
+# packages may still be installed (if marked as purge, one is not sure,
+# though, as the package could have been uninstalled but not purged yet),
+# so that purge and remove operations remain valid.
+  list|listfiles|purge|remove|status)
     _call_function ret _dpkg_$state && return ret
     _arguments -C -A "-*" -s "$_dpkg_options[@]" \
        '*:package:_deb_packages xinstalled'
   ;;
-  list)
-    _call_function ret _dpkg_$state && return ret
-    _arguments -C -A "-*" -s "$_dpkg_options[@]" \
-       '*:packages:_deb_packages avail'
-  ;;
   compare_versions)
     _call_function ret _dpkg_$state && return ret
     _arguments -C -A "-*" -s \


More information about the Pkg-zsh-devel mailing list