GNU bug report logs - #7711
Patch for bug #7687

Previous Next

Package: emacs;

Reported by: Flo <sensorflo <at> gmail.com>

Date: Wed, 22 Dec 2010 18:55:02 UTC

Severity: normal

Tags: patch

Merged with 7687

Found in version 23.1.50

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Flo <sensorflo <at> gmail.com>
Cc: 7711 <at> debbugs.gnu.org
Subject: bug#7711: Patch for bug #7687
Date: Fri, 21 Jan 2011 13:07:30 -0500
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  <monnier <at> iro.umontreal.ca>
+
+	* subr.el (shell-quote-argument): Properly quote \n (bug#7687).
+	Suggested by Flo <sensorflo <at> gmail.com>.
+
 2011-01-21  Glenn Morris  <rgm <at> gnu.org>
 
 	* 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.





This bug report was last modified 14 years and 122 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.