From unknown Fri Aug 15 03:57:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#105 <105@debbugs.gnu.org> To: bug#105 <105@debbugs.gnu.org> Subject: Status: (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case Reply-To: bug#105 <105@debbugs.gnu.org> Date: Fri, 15 Aug 2025 10:57:43 +0000 retitle 105 (split-string-and-unquote (combine-and-quote-strings STRINGS)) = fails on trivial case reassign 105 emacs submitter 105 Joe Wells severity 105 normal thanks From monnier@iro.umontreal.ca Mon Mar 31 19:56:39 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 1 Apr 2008 02:56:39 +0000 Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m312uZ7r013990 for ; Mon, 31 Mar 2008 19:56:36 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4EAOJA8UdMCrUE/2dsb2JhbACBWpBwmAqCHA X-IronPort-AV: E=Sophos;i="4.25,584,1199682000"; d="scan'208";a="17262369" Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 31 Mar 2008 22:56:29 -0400 Received: from pastel.home ([76.10.181.4]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id HGF25029 for ; Mon, 31 Mar 2008 22:56:29 -0400 Received: by pastel.home (Postfix, from userid 20848) id DCCD87FDF; Mon, 31 Mar 2008 22:56:28 -0400 (EDT) Resent-Message-ID: Resent-To: submit@debbugs.gnu.org Resent-From: Stefan Monnier Resent-Date: Mon, 31 Mar 2008 22:56:28 -0400 X-Original-To: monnier@iro.umontreal.ca Received: from pinpin.iro.umontreal.ca (pinpin.iro.umontreal.ca [132.204.24.52]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 9D1F72CF5CE for ; Mon, 31 Mar 2008 21:18:15 -0400 (EDT) Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by pinpin.iro.umontreal.ca (Postfix) with ESMTP id 35FF73B8B43 for ; Mon, 31 Mar 2008 21:18:11 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgV8d-0000Ed-0S for monnier@iro.umontreal.ca; Mon, 31 Mar 2008 21:18:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JgV7t-0008L8-O9 for bug-gnu-emacs@gnu.org; Mon, 31 Mar 2008 21:17:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JgV7s-0008JQ-AC for bug-gnu-emacs@gnu.org; Mon, 31 Mar 2008 21:17:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgV7r-0008JF-Td for bug-gnu-emacs@gnu.org; Mon, 31 Mar 2008 21:17:23 -0400 Received: from mail-r.hw.ac.uk ([137.195.101.215]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JgV7r-0001ra-KI for bug-gnu-emacs@gnu.org; Mon, 31 Mar 2008 21:17:23 -0400 Received: from izanami.macs.hw.ac.uk ([137.195.13.6]) by mail-r.hw.ac.uk with esmtp (Exim 4.54) id 1JgV7i-0005l3-9b for bug-gnu-emacs@gnu.org; Tue, 01 Apr 2008 02:17:14 +0100 Received: from lxultra1.macs.hw.ac.uk ([137.195.27.173]:45622 helo=127.0.0.1) by izanami.macs.hw.ac.uk with smtp (Exim 4.51) id 1JgV7i-0006KJ-01 for bug-gnu-emacs@gnu.org; Tue, 01 Apr 2008 02:17:14 +0100 Received: (nullmailer pid 9793 invoked by uid 1001); Tue, 01 Apr 2008 01:17:23 -0000 To: bug-gnu-emacs@gnu.org From: Joe Wells Date: Tue, 01 Apr 2008 02:17:23 +0100 Message-ID: <86od8u8jbw.fsf@macs.hw.ac.uk> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-HW-MailScanner-Information: Please contact the HW Helpdesk for more information X-HW-MailScanner: Found to be clean X-HW-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.399, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60) X-HW-MailScanner-From: jbw@macs.hw.ac.uk X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Subject: (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org Errors-To: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-1.94, requis 5, BAYES_00 -2.60, RECEIVED_FROM_NOUNK 0.66, SPF_HELO_PASS -0.00) X-DIRO-MailScanner-From: bug-gnu-emacs-bounces+monnier=iro.umontreal.ca@gnu.org 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 From cyd@stupidchicken.com Sun Apr 6 22:31:41 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: * X-Spam-Status: No, score=1.6 required=4.0 tests=AWL,FOURLA,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 105) by emacsbugs.donarmstrong.com; 7 Apr 2008 05:31:41 +0000 Received: from furry (c-98-216-111-182.hsd1.ma.comcast.net [98.216.111.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m375VcGF016886 for <105@emacsbugs.donarmstrong.com>; Sun, 6 Apr 2008 22:31:39 -0700 Received: by furry (Postfix, from userid 1000) id 57FB4C045; Mon, 7 Apr 2008 01:31:34 -0400 (EDT) From: Chong Yidong To: Joe Wells Cc: 105@debbugs.gnu.org, emacs-devel@gnu.org Subject: Re: (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case Date: Mon, 07 Apr 2008 01:31:34 -0400 Message-ID: <87fxty1b9l.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > 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. IIUC, the equation (split-string-and-unquote (combine-and-quote-strings strs)) == strs only holds if STRS is a list containing a single string. The point the docstrings are trying to make is that combine-and-quote-strings performs string quoting, while split-string-and-unquote performs unquoting. If there are no objections to this interpretation, I'll check in a doc fix shortly. From monnier@iro.umontreal.ca Mon Apr 7 09:23:34 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=4.0 tests=AWL,HELO_LH_HOME, MURPHY_DRUGS_REL8,RDNS_DYNAMIC autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 105-done) by emacsbugs.donarmstrong.com; 7 Apr 2008 16:23:34 +0000 Received: from ceviche.home (76-10-147-176.dsl.teksavvy.com [76.10.147.176]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m37GNQEW031077 for <105-done@emacsbugs.donarmstrong.com>; Mon, 7 Apr 2008 09:23:27 -0700 Received: by ceviche.home (Postfix, from userid 20848) id 5A5E8B46F1; Mon, 7 Apr 2008 12:23:25 -0400 (EDT) From: Stefan Monnier To: 105-done@debbugs.gnu.org Subject: Re: (split-string-and-unquote (combine-and-quote-strings STRINGS)) fails on trivial case Message-ID: References: <87fxty1b9l.fsf@stupidchicken.com> Date: Mon, 07 Apr 2008 12:23:25 -0400 In-Reply-To: <87fxty1b9l.fsf@stupidchicken.com> (Chong Yidong's message of "Mon, 07 Apr 2008 01:31:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >> 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))) From unknown Fri Aug 15 03:57:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Tue, 06 May 2008 14:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator