GNU bug report logs -
#105
(split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case
Previous Next
Reported by: Joe Wells <jbw <at> macs.hw.ac.uk>
Date: Tue, 1 Apr 2008 03:05:06 UTC
Severity: normal
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Mon, 07 Apr 2008 12:23:25 -0400
with message-id <jwv7if9wsjk.fsf-monnier+emacs <at> gnu.org>
and subject line Re: (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case
has caused the Emacs bug report #105,
regarding (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don <at> donarmstrong.com
immediately.)
--
105: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=105
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
The documentation strings for both split-string-and-unquote and
combine-and-quote-strings state that they attempt to achieve this
property:
(split-string-and-unquote (combine-and-quote-strings strs)) == strs
Here is a trivial case that they fail on; the following sexp wrongly
evaluates to nil:
(let ((l '("a b" "c")))
(equal l
(split-string-and-unquote (combine-and-quote-strings l))))
I hope this problem report is helpful.
Joe
======================================================================
In GNU Emacs 22.2.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
of 2008-04-01 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure '--prefix=/home/jbw/local4' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb -fno-crossjumping -DGLYPH_DEBUG=1''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: en_US.UTF-8
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: jbw
value of $LANG: nil
locale-coding-system: utf-8
default-enable-multibyte-characters: t
--
Heriot-Watt University is a Scottish charity
registered under charity number SC000278
[Message part 3 (message/rfc822, inline)]
>> The documentation strings for both split-string-and-unquote and
>> combine-and-quote-strings state that they attempt to achieve this
>> property:
>>
>> (split-string-and-unquote (combine-and-quote-strings strs)) == strs
>>
>> Here is a trivial case that they fail on; the following sexp wrongly
>> evaluates to nil:
>>
>> (let ((l '("a b" "c")))
>> (equal l
>> (split-string-and-unquote (combine-and-quote-strings l))))
> I think this is a docstring mistake.
I disagree. This is a bug in the code. I believe the patch below fixes it.
Stefan
--- subr.el.~1.588.~ 2008-04-07 10:23:51.000000000 -0400
+++ subr.el 2008-04-07 12:21:23.000000000 -0400
@@ -2987,10 +2987,11 @@
This tries to quote the strings to avoid ambiguity such that
(split-string-and-unquote (combine-and-quote-strings strs)) == strs
Only some SEPARATORs will work properly."
- (let ((sep (or separator " ")))
+ (let* ((sep (or separator " "))
+ (re (concat "[\\\"]" "\\|" (regexp-quote sep))))
(mapconcat
(lambda (str)
- (if (string-match "[\\\"]" str)
+ (if (string-match re str)
(concat "\"" (replace-regexp-in-string "[\\\"]" "\\\\\\&" str) "\"")
str))
strings sep)))
This bug report was last modified 17 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.