Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Make umount complete paths containing special characters as expected

I noticed that, when trying to complete a mount point containing special
characters (like spaces), the argument gets added to the command line without
any escaping:

  % mkdir 'dir with spaces'
  % sudo mount -t tmpfs{,} 'dir with spaces'
  % grep spaces /proc/mounts
  tmpfs /home/dana/dir\040with\040spaces tmpfs rw,relatime 0 0
  % umount dir<TAB>  # yields `dir with spaces`, not `dir\ with\ spaces`

The included patch seems to fix it, but i have to confess i'm not sure what the
other implications might be. There's no explanation provided with the original
commit or in the documentation as to why we would have wanted this behaviour.
Maybe someone could double-check my thinking.


diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths
index 6eab7b677..67377095f 100644
--- a/Completion/Unix/Type/_canonical_paths
+++ b/Completion/Unix/Type/_canonical_paths
@@ -113,7 +113,7 @@ _canonical_paths() {
-  _wanted "$tag" expl "$desc" compadd $__gopts -Q -U -a matches && ret=0
+  _wanted "$tag" expl "$desc" compadd $__gopts -U -a matches && ret=0
   return ret

Messages sorted by: Reverse Date, Date, Thread, Author