From: Philippe Troin <phil@fifi.org>
To: zsh-workers@sunsite.dk
Subject: Umount completion fails when mount point or dev node contains spaces
Date: 31 Jan 2005 17:05:06 -0800 [thread overview]
Message-ID: <87d5vl6qf1.fsf@ceramic.fifi.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 835 bytes --]
On Linux at least, non-straightforward characters are encoded with the
\NNN notation in /etc/mtab, with NNN being the octal ASCII code of the
character.
Our current umount completer does not handle it.
# mkdir /mnt/mount\ point\[\\
# mount --bind /tmp /mnt/mount\ point\[\\
# umount /mnt/mount<TAB>
yields
# umount /mnt/mount\\040point\[\\134
The enclosed patch takes care of the problem by unescaping octal
sequences.
Please note that I've assumed that all unices escape spaces and other
unprintable characters this way. If it's not the case, then the
mp_tmp and dev_tmp assignments should be moved to the Linux branch of
the case.
Can anyone confirm other unices behavior?
Phil.
Changelog entry:
2005-01-31 Philippe Troin <phil@fifi.org>
* Completion/Unix/Command/_mount: Unescape mtab octal sequences.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: zsh-mount-completion.patch --]
[-- Type: text/x-patch, Size: 783 bytes --]
Index: Completion/Unix/Command/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mount,v
retrieving revision 1.18
diff -b -u -r1.18 _mount
--- Completion/Unix/Command/_mount 20 Feb 2004 10:57:11 -0000 1.18
+++ Completion/Unix/Command/_mount 1 Feb 2005 01:01:32 -0000
@@ -794,7 +794,7 @@
esac
;;
udevordir)
- local dev_tmp mp_tmp mline
+ local dev_tmp mp_tmp mline match
case "$OSTYPE" in
linux*|irix*)
@@ -810,6 +810,9 @@
;;
esac
+ mp_tmp=(${mp_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])})
+ dev_tmp=(${dev_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])})
+
_alternative \
'devices:device:compadd -a dev_tmp' \
'directories:mount point:compadd -a mp_tmp' && ret=0
next reply other threads:[~2005-02-01 1:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-01 1:05 Philippe Troin [this message]
2005-02-01 10:57 ` Stephane Chazelas
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=87d5vl6qf1.fsf@ceramic.fifi.org \
--to=phil@fifi.org \
--cc=zsh-workers@sunsite.dk \
/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).