Subject: 23.0.60; split-string-and-unquote problems

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Oct 2008 18:04:41 +0200

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

The function split-string-and-unquote is a great help in taking apart
shell command lines, but the values it returns seem incorrect in some
situations, at least from shell command quoting perspective:

 (split-string-and-unquote "foo\ bar")
    => ("foobar")                 [where's my blank?]
 (split-string-and-unquote "foo\\\ bar")
    => ("foo\\bar")               [where's my blank?]
 (split-string-and-unquote "foo\" \"bar")
    => ("foo" " " "bar")          [where's my blank]
 (split-string-and-unquote "foo\"*\"bar")
    => ("foo" "*" "bar")          [can't quote in the middle of a string?]
 (split-string-and-unquote "foo\\\"bar")
    => End of file during parsing [how do you quote a quote?]

Also, it doesn't support '..' quoting, which is quite frequent in
shell commands.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
d:/gnu/emacs/etc/DEBUG for instructions.

In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-10-20 on HOME-C4E4A596F7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1255
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down> <down> <down> <down> <down> <down> C-SPC <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> M-w C-x b <return> C-y <return> M-: 
<up> <C-right> <C-right> <C-right> <C-right> <right> 
<right> <right> <right> <right> <right> <right> <delete> 
* <return> M-: <up> C-SPC C-e M-w <return> C-y SPC 
= > SPC C-x b <return> <down> <down> C-a C-SPC <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> M-w C-x b <return> C-y <return> M-: 
<up> <up> <up> <up> <down> <up> <up> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <delete> <delete> <delete> 
<delete> <delete> <delete> <delete> <delete> <delete> 
<delete> <delete> <delete> <delete> <delete> <delete> 
<delete> <delete> <delete> <delete> <delete> <delete> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <delete> <delete> <delete> 
<delete> <delete> <delete> <delete> <delete> <delete> 
<delete> <delete> <delete> <delete> <delete> <right> 
<right> C-SPC C-a M-w <return> C-y SPC = > SPC <down> 
<down> <down> <up> C-a M-: <up> <return> <C-right> 
<C-right> <C-right> <C-right> <C-right> <C-left> C-SPC 
<up> <down> C-e M-w <up> <left> C-y <right> M-: <up> 
<up> <up> <up> <C-right> <C-right> <C-right> <C-right> 
<C-right> \ <return> M-: <up> <C-right> <C-right> <C-right> 
<C-right> <C-right> \ <return> M-: <up> C-SPC C-e M-w 
<return> <up> <up> <up> <left> <return> C-y SPC = > 
SPC C-x b <return> <down> <down> <down> <down> <down> 
<down> <down> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> C-SPC <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> M-w C-x b <return> C-y C-x <up> <down> 
<up> M-x r e p o r t - e m a <tab> <return>

Recent messages:
("foo" "*" "bar") [2 times]
Mark set [3 times]
split-string-and-unquote: End of file during parsing
Mark set
split-string-and-unquote: End of file during parsing
Mark set [2 times]
("foo\\" "bar")
("foo\\bar") [2 times]
Mark set [3 times]
Scanning for dabbrevs...100%