zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: zsh-workers@sunsite.dk
Subject: Re: Umount completion fails when mount point or dev node contains spaces
Date: Tue, 1 Feb 2005 10:57:32 +0000	[thread overview]
Message-ID: <20050201105732.GA4548@sc> (raw)
In-Reply-To: <87d5vl6qf1.fsf@ceramic.fifi.org>

On Mon, Jan 31, 2005 at 05:05:06PM -0800, Philippe Troin wrote:
[...]
>   # umount /mnt/mount\\040point\[\\134
> 
> The enclosed patch takes care of the problem by unescaping octal
> sequences.
> 
[...]
> +  dev_tmp=(${dev_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])})

Note that this would fail for foo\012bar

for ((i = 1; i <= $#dev_tmp; i++)); do
  eval "dev_tmp[i]=\$'${dev_tmp[i]}'"
done

should work and avoid the forks for $(print ...)

$ sudo mkdir '/mnt/f\n\1oo
quote> bar'
~$ sudo mount --bind /tmp $_
~$ tail -1 /etc/mtab
/tmp /mnt/f\134n\1341oo\012bar none rw,bind 0 0
~$ dev_tmp=('/mnt/f\134n\1341oo\012bar')
~$ print -rl -- ${dev_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])}
/mnt/f\n\1oobar

~$ dev_tmp=('/mnt/f\134n\1341oo\012bar')
~$ for ((i = 1; i <= $#dev_tmp; i++)); do
for>   eval "dev_tmp[i]=\$'${dev_tmp[i]}'"
for> done
~$ print -rl "${(@)dev_tmp}"
/mnt/f\n\1oo
bar

-- 
Stéphane


      reply	other threads:[~2005-02-01 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-01  1:05 Philippe Troin
2005-02-01 10:57 ` Stephane Chazelas [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=20050201105732.GA4548@sc \
    --to=stephane_chazelas@yahoo.fr \
    --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).