From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29914 invoked from network); 1 Feb 2005 01:06:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Feb 2005 01:06:04 -0000 Received: (qmail 65059 invoked from network); 1 Feb 2005 01:05:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Feb 2005 01:05:58 -0000 Received: (qmail 11274 invoked by alias); 1 Feb 2005 01:05:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20766 Received: (qmail 11255 invoked from network); 1 Feb 2005 01:05:50 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Feb 2005 01:05:50 -0000 Received: (qmail 64005 invoked from network); 1 Feb 2005 01:05:14 -0000 Received: from tantale.fifi.org (64.81.251.130) by a.mx.sunsite.dk with SMTP; 1 Feb 2005 01:05:09 -0000 Received: from ceramic.fifi.org (Debian-exim@ceramic.fifi.org [64.81.251.131]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id RAA26776 for ; Mon, 31 Jan 2005 17:05:06 -0800 Received: from phil by ceramic.fifi.org with local (Exim 4.34) id 1CvmTa-0000VA-9M for zsh-workers@sunsite.dk; Mon, 31 Jan 2005 17:05:06 -0800 To: zsh-workers@sunsite.dk Subject: Umount completion fails when mount point or dev node contains spaces Mail-Copies-To: nobody From: Philippe Troin Date: 31 Jan 2005 17:05:06 -0800 Message-ID: <87d5vl6qf1.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 --=-=-= 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 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 * Completion/Unix/Command/_mount: Unescape mtab octal sequences. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=zsh-mount-completion.patch 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 --=-=-=--