--- Begin Message ---
Subject: |
23.0.60; split-string-and-unquote problems |
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 address@hidden 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%
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#7563: 23.2; `split-string-and-unquote' mis-documented / purpose unclear |
Date: |
Sat, 11 Dec 2010 11:50:35 +0200 |
> Date: Sun, 05 Dec 2010 16:28:16 -0500
> From: Dave Abrahams <address@hidden>
> Cc:
>
> This function performs two types of quoting: enclosing a whole
> string in double quotes `"..."', and quoting individual characters
> with a backslash escape `\'. The latter is also used in Lisp
> strings, so this function can handle those as well.
>
>
> First problem: the last paragraph above is simply wrong.
> split-string-and-unquote doesn't perform any type of quoting; it
> un-quotes.
I changed "performs" to "supports". Thanks for catching this.
> Second problem: the doc implies that a string that could be executed
> by the shell could be split into its constituent arguments by
> split-string-and-unquote, but in general, it cannot, e.g.:
>
> (split-string-and-unquote "'foo bar'") => ("'foo" "bar'")
> (split-string-and-unquote "foo\\ bar") => ("foo" "bar")
>
> I'm not sure what this function is really supposed to be for, but any
> implication that it properly handles conversion into shell arguments
> is highly misleading. Some motivation should be given for proper use
> of split-string-and-unquote, or it should be deprecated.
This has come up before; see Bug #1212 and this thread:
http://lists.gnu.org/archive/html/emacs-devel/2008-10/msg00431.html
The best explanation I can give you is that this function is for
taking minibuffer input and converting it to a list of string
arguments as required by call-process and start-process. (I added
this information to the manual.) Note that the documentation does not
mention "shell" anywhere. You could also gain some insight by looking
at the users of this function.
With those changes, I'm closing this bug report (and 1212 as well),
because the issue has been already beaten to death in the above
discussion.
The changes I made are on the emacs-23 branch, btw, in case you want
to eyeball them.
--- End Message ---