zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Ferdinand Thiessen <f.thiessen@gmx.de>, zsh-workers@zsh.org
Subject: Re: [BUG] umount mountpoint completion
Date: Wed, 8 Mar 2017 21:55:36 -0800	[thread overview]
Message-ID: <170308215536.ZM28061@torch.brasslantern.com> (raw)
In-Reply-To: <a2e30d34-5a01-bcaf-93e5-5688b7deb144@gmx.de>

OK, Ferdinand, let's try the following patch.

There might still be the bug reported in 40761 by Philipp G. Haselwarter,
but if so I think that's down to _canonical_paths and not _mount.

diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount
index 9ab279d..9a7041d 100644
--- a/Completion/Unix/Command/_mount
+++ b/Completion/Unix/Command/_mount
@@ -959,9 +959,15 @@ udevordir)
   esac
 
   local MATCH MBEGIN MEND
-  mp_tmp=("${(@g::)mp_tmp}")
-  dpath_tmp=( "${(@Mg::)dev_tmp:#/*}" )
-  dev_tmp=( "${(@g::)dev_tmp:#/*}" )
+  # The complicated substitution for mount point names is required because
+  # characters in /etc/mtab that might confuse programs reading the names
+  # are encoded as exactly 3 octal digits, like for example \040 for space.
+  # The cleaner-looking ${(g::)mp_tmp} might consume too many digits.
+  # Both mp_tmp and dev_tmp are derived from /etc/mtab or "mount" output.
+  mp_tmp=("${(@)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
+  dev_tmp=("${(@)dev_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
+  dpath_tmp=( "${(@M)dev_tmp:#/*}" )
+  dev_tmp=( "${(@)dev_tmp:#/*}" )
 
   _alternative \
     'device-labels:device label:compadd -a dev_tmp' \


      reply	other threads:[~2017-03-09  5:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-05 15:08 Ferdinand Thiessen
2017-03-06  0:55 ` Ferdinand Thiessen
2017-03-06  4:01 ` Bart Schaefer
2017-03-06 17:35   ` Ferdinand Thiessen
2017-03-06 23:10     ` Bart Schaefer
2017-03-07 11:19       ` Daniel Shahaf
2017-03-07 19:14         ` Bart Schaefer
2017-03-07 20:37           ` Ferdinand Thiessen
2017-03-07 21:49             ` Bart Schaefer
2017-03-08  2:08               ` Ferdinand Thiessen
2017-03-09  5:55                 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170308215536.ZM28061@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=f.thiessen@gmx.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).