GNU bug report logs - #11348
24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Thu, 26 Apr 2012 11:12:02 UTC

Severity: normal

Found in version 24.0.95

Fixed in version 24.0.97

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11348 <at> debbugs.gnu.org
Subject: bug#11348: 24.0.95; TAB-completion in shell-command produces d:\/foo on MS-Windows
Date: Sat, 05 May 2012 09:33:04 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 11348 <at> debbugs.gnu.org
> Date: Sat, 05 May 2012 00:20:17 -0400
> 
> >> This said, based on your description, the problem may simply come from
> >> shell.el's setting of pcomplete-arg-quote-list which tells pcomplete
> >> that \ is an escape char.
> >> I.e. does the patch below fix the problem?
> > No, I still get "d:\/gnu/".
> 
> I installed the patch below, which seems to fix this specific problem
> (according to my testing under Wine ;-)

I'm not sure why it worked for you, because it still doesn't for me.
Are you applying the changes to the emacs-24 branch?  Because that's
what I do, this bug being against Emacs 24.0.96 and a regression from
Emacs 23.4.

According to my debugging inside shell-parse-pcomplete-arguments, what
happens there is that this fragment

          (while (looking-at
                  (eval-when-compile
                    (concat
                     "\\(?:[^\s\t\n\\\"']+"
                     "\\|'\\([^']*\\)'?"
                     "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
                     "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))

decides that \g is an escape sequence.  (Btw, what's the purpose of
using eval-when-compile here?)  Therefore, the value of args at the
end of the loop is

   ("nu" "g" "d:")

After this line:

          (push (mapconcat #'identity (nreverse arg) "") args)))

it becomes

   ("d:" "g" "nu")

and the result of the function is therefore

   (("cd" "d:gnu") 16 19)

By contrast, if I type "M-! cd d:/gnu TAB", the results are,
correspondingly,

   ("d:/gnu")

and

   (("cd" "d:/gnu") 16 19)

IOW, the problem is that shell-parse-pcomplete-arguments removes the
backslash in "d:\gnu", because the last alternative in the above
regexp treats backslashes as escape characters, which on MS-DOS and
MS-Windows is true (for shell commands) only when the backslash
precedes a quote character (").

Thanks.




This bug report was last modified 13 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.