about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-01-19 19:37:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-01-19 19:37:01 +0000
commit9382be33479fa2f7276ada9de927268d46c6b46b (patch)
treebe3548be52f1dca540d5b60ad772013b55df6a9f
parentb44aef27545c6b5744de7d6315137fcec8ea6eb2 (diff)
downloadzsh-9382be33479fa2f7276ada9de927268d46c6b46b.tar.gz
zsh-9382be33479fa2f7276ada9de927268d46c6b46b.tar.xz
zsh-9382be33479fa2f7276ada9de927268d46c6b46b.zip
users/12461: fix quoting of mount points for umount
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_mount23
2 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3716540e1..d24abad2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-19  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* users/12461: Completion/Unix/Command/_mount: mount points
+	weren't completed properly for umount.
+
 2008-01-18  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* users/12453: Functions/Misc/xtermctl: X11 window control for
diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount
index 6333c3d5b..417af2502 100644
--- a/Completion/Unix/Command/_mount
+++ b/Completion/Unix/Command/_mount
@@ -867,8 +867,27 @@ udevordir)
     ;;
   esac
 
-  dpath_tmp=( "${(@M)dev_tmp:#/*}" )
-  dev_tmp=( "${(@)dev_tmp:#/*}" )
+  # "Mummy, why is mount point matching full of squiggles?"
+  #
+  # "Well, dear, the clever people who wrote Linux decided that some
+  # funny characters that might confuse programmes looking at the names
+  # would be encoded as octal escapes, like for example \040 for space.
+  # The clever people who wrote zsh decided that nothing would
+  # ever be quite as simple as it should be, so to substitute octal
+  # escapes everywhere in a string, even though the shell understands
+  # them natively in print escapes, needs some hackery where you match
+  # the octal number using the numeric closure syntax introduced after
+  # 4.3.4, then reinput the number in a standard math mode format as 8#OOO,
+  # and turn that into a character using the (#) parameter flag."
+  #
+  # "Mummy, why is nothing ever quite as simple as it should be?"
+  #
+  # "Well, dear, if it was then the clever people who write programmes would
+  # have been replaced by intelligent monkeys and then they'd be out
+  # of working roaming the streets, and we wouldn't want that, would we?"
+  mp_tmp=("${(@q)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
+  dpath_tmp=( "${(@Mq)dev_tmp:#/*}" )
+  dev_tmp=( "${(@q)dev_tmp:#/*}" )
 
   _alternative \
     'device-labels:device label:compadd -a dev_tmp' \