From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 20 11:40:44 2010 Received: (at submit) by debbugs.gnu.org; 20 Dec 2010 16:40:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PUimx-0002C4-AK for submit@debbugs.gnu.org; Mon, 20 Dec 2010 11:40:44 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PUiOd-0001eX-6A for submit@debbugs.gnu.org; Mon, 20 Dec 2010 11:15:36 -0500 Received: from eggs.gnu.org ([140.186.70.92]:47563) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PUiUs-0004GX-1G for emacs-pretest-bug@gnu.org; Mon, 20 Dec 2010 11:22:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PUiUp-0005Af-08 for emacs-pretest-bug@gnu.org; Mon, 20 Dec 2010 11:22:04 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received: from mail-iw0-f169.google.com ([209.85.214.169]:60716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PUiUo-00059S-SI for emacs-pretest-bug@gnu.org; Mon, 20 Dec 2010 11:21:58 -0500 Received: by iwn40 with SMTP id 40so3764626iwn.0 for ; Mon, 20 Dec 2010 08:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=YDvP7znZnK0diWfK3ZxjbYlETp1I6Cl2EBTw3Bs/G7o=; b=wz4rTTKJdrii5X2G6NFIrIv8E6q73Q5NXafDgxh1NoeLz8gDhdtOovL/yJKnaVYEda KyOaX9cL9FYMFhH/nGXUt+eBdBmnSpr+o6471uNiW4bk8POfOgckAsMNthaR7znEfb/e J9/EKjavpbF3EpBYmLKawcKCAPlFKtJ1XcCMA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=l+yORIOzw4+f6mGigrhzSFig0ofhdtqPJL0B4KnWDLOiqDWFujG1+eWna5L/xZJbY0 Yq/mOSOeS0eCPiKgoRArGkHaDseNhP7F0zx4CwatcBXWc2tRMbA1ik3TynnDRUPZJ94/ kjy70eIznyozJV4TFsD4Qu333LTuVQm/QY+h4= Received: by 10.231.39.133 with SMTP id g5mr4308071ibe.28.1292862117359; Mon, 20 Dec 2010 08:21:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.10.195 with HTTP; Mon, 20 Dec 2010 08:21:37 -0800 (PST) From: Flo Date: Mon, 20 Dec 2010 17:21:37 +0100 Message-ID: Subject: 23.1.50; shell-quote-argument does not correctly quote newlines To: emacs-pretest-bug@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 20 Dec 2010 11:40:41 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) 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 emacs-pretest-bug@gnu.org mailing list. Please describe exactly what actions triggered the bug and the precise symptoms of the bug: When I run the following script: ---------------------------------- #!/bin/bash emacs -Q --batch eval='(shell-command (concat "echo " (shell-quote-argument "line1\nline2") " >tmpfile"))' cat tmpfile ---------------------------------- I expect the following content within 'tmpfile', i.e. exactly the string I passed to shell-quote-argument. ------------- line1 line2 ------------- Instead I get this: ------------- line1line2 ------------- I have not made any modification to Emacs. I made a patch and will send it as described in the Emacs manual in chapter 'Sending Patches for GNU Emacs'. 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 /usr/share/emacs/23.1.50/etc/DEBUG for instructions. In GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.0) of 2009-09-27 on palmer, modified by Debian (emacs-snapshot package, version 1:20090909-1) Windowing system distributor `The X.Org Foundation', version 11.0.10706000 configured using `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.50/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS='' 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: en_US.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Info Minor modes in effect: 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: M-x b u g - r e p o C-g C-h i C-h r C-s b u g C-s 2 C-v SPC M-x r e p o r t - e m a c s - b u Recent messages: uncompressing emacs-6.gz...done uncompressing emacs-7.gz...done uncompressing emacs-8.gz...done Mark saved where search started uncompressing emacs.gz...done uncompressing emacs-6.gz...done uncompressing emacs.gz...done uncompressing emacs-6.gz...done uncompressing emacs.gz...done uncompressing emacs-6.gz...done Load-path shadows: /usr/share/emacs/23.1.50/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs/site-lisp/rst hides /usr/share/emacs/23.1.50/lisp/textmodes/rst From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 23 10:07:18 2010 Received: (at control) by debbugs.gnu.org; 23 Dec 2010 15:07:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PVml6-0006P4-Ib for submit@debbugs.gnu.org; Thu, 23 Dec 2010 10:07:18 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PVml5-0006Ot-5F for control@debbugs.gnu.org; Thu, 23 Dec 2010 10:07:11 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkYGAAf2Ek3O+ILX/2dsb2JhbACWD44YdMEthUoEhGWOGw X-IronPort-AV: E=Sophos;i="4.60,219,1291611600"; d="scan'208";a="86383992" Received: from 206-248-130-215.dsl.teksavvy.com (HELO ceviche.home) ([206.248.130.215]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 23 Dec 2010 10:13:48 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 3FCC96610E; Thu, 23 Dec 2010 10:13:48 -0500 (EST) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: bug#7711: Patch for bug #7687 Message-ID: References: Date: Thu, 23 Dec 2010 10:13:48 -0500 In-Reply-To: (Flo's message of "Wed, 22 Dec 2010 20:00:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) merge 7711 7687 tags 7711 +patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 21 12:59:42 2011 Received: (at control) by debbugs.gnu.org; 21 Jan 2011 17:59:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PgLGv-0006vj-C0 for submit@debbugs.gnu.org; Fri, 21 Jan 2011 12:59:41 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PgLGs-0006vV-IN; Fri, 21 Jan 2011 12:59:39 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id p0LI7sNw028531; Fri, 21 Jan 2011 13:07:55 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id F3A2CB411E; Fri, 21 Jan 2011 13:07:30 -0500 (EST) From: Stefan Monnier To: Flo Subject: Re: bug#7711: Patch for bug #7687 Message-ID: References: Date: Fri, 21 Jan 2011 13:07:30 -0500 In-Reply-To: (Flo's message of "Wed, 22 Dec 2010 20:00:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Level: X-NAI-Spam-Score: 0.7 X-NAI-Spam-Rules: 2 Rules triggered SUBJ_HAS_UNIQ_ID=0.7, RV3735=0 X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: control Cc: 7711@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.0 (--) forcemerge 7687 7711 close 7711 thanks > the empty string. The new version of shell-quote-argument > treats newlines specially. They are quoted with single > quotes. Thanks. I've installed a slightly different patch (took the opportunity to simplify the code by using replace-regexp-in-string) that implements your idea. Stefan === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-21 05:04:45 +0000 +++ lisp/ChangeLog 2011-01-21 18:04:16 +0000 @@ -1,3 +1,8 @@ +2011-01-21 Stefan Monnier + + * subr.el (shell-quote-argument): Properly quote \n (bug#7687). + Suggested by Flo . + 2011-01-21 Glenn Morris * progmodes/compile.el (compilation-error-regexp-alist): === modified file 'lisp/subr.el' --- lisp/subr.el 2011-01-15 02:32:19 +0000 +++ lisp/subr.el 2011-01-21 18:04:45 +0000 @@ -2426,13 +2426,8 @@ "''" ;; Quote everything except POSIX filename characters. ;; This should be safe enough even for really weird shells. - (let ((result "") (start 0) end) - (while (string-match "[^-0-9a-zA-Z_./]" argument start) - (setq end (match-beginning 0) - result (concat result (substring argument start end) - "\\" (substring argument end (1+ end))) - start (1+ end))) - (concat result (substring argument start)))))) + (replace-regexp-in-string "\n" "'\n'" + (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument))))) (defun string-or-null-p (object) "Return t if OBJECT is a string or nil. From unknown Wed Jun 18 23:08:09 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 19 Feb 2011 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator