From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#6136: Emerge doesn't handle file names with spaces on MS Windows Date: Sat, 06 Aug 2016 10:06:37 -0400 Message-ID: <87zioq56vm.fsf@users.sourceforge.net> References: <838w7uqvn2.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1470492453 9085 195.159.176.226 (6 Aug 2016 14:07:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 6 Aug 2016 14:07:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) Cc: Joakim =?UTF-8?Q?H=C3=A5rsman?= , 6136@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 06 16:07:29 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bW2G4-000168-I0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Aug 2016 16:07:24 +0200 Original-Received: from localhost ([::1]:49563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bW2G1-0004Nm-93 for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Aug 2016 10:07:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bW2Fo-0004M5-1F for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2016 10:07:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bW2Fh-0000lh-Vm for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2016 10:07:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bW2Fh-0000lS-Ry for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2016 10:07:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bW2Fh-0005ts-KD for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2016 10:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Aug 2016 14:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6136 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6136-submit@debbugs.gnu.org id=B6136.147049239922652 (code B ref 6136); Sat, 06 Aug 2016 14:07:01 +0000 Original-Received: (at 6136) by debbugs.gnu.org; 6 Aug 2016 14:06:39 +0000 Original-Received: from localhost ([127.0.0.1]:58040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bW2FL-0005tD-0o for submit@debbugs.gnu.org; Sat, 06 Aug 2016 10:06:39 -0400 Original-Received: from mail-io0-f171.google.com ([209.85.223.171]:36133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bW2FI-0005ss-VI; Sat, 06 Aug 2016 10:06:37 -0400 Original-Received: by mail-io0-f171.google.com with SMTP id b62so323273848iod.3; Sat, 06 Aug 2016 07:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=3zIwl/lSI7dDmBUerilFTMqU6cI1CkF0CU6O3f3I6lQ=; b=UDE+29SU8sFti6MziAJSVwnjZ+1gcD7v/XFtTKC6K7dE2FdI7dTxsnpGV38528aCtb ytlr6WkiE3jT0yFUuVeSsbGImXLGejnxukMcweX22a+xvsjEwOtGwTB89YllZpReMhEz xm9weoDdRhKFFom5LwqCg06mr+h9ioPbLcOT73yjFtuC02/9jZJJ2TA4+s9b8SLyU3WB sgk7fSjsG4vjb2Hqe1XwCjxP5MB/LeS9BD7RPR73ByaEDSHy8s8+YbHOIBqO7SDT0OSJ wsBBocTDbBxnZZcIZ+p++kXJCJ8VUEx8YVXyg+n96TvSu+Cr0yOU8qRLRcOK5VQDOSy4 NcIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=3zIwl/lSI7dDmBUerilFTMqU6cI1CkF0CU6O3f3I6lQ=; b=Hzqi8/CjvbnDVeYNc7IIY+TFQWWI77Ama+uZLNKYE8a8oGP599JbLU2KcS4wqNc3ih v9MwvsMWxfTcz329yTNd102FIaT3FVvZBLbfUP4EUpxEydJjN9vRNXmxjgUpBM5JAQrE Z4Qmkd88bV5M1Pghdkb1E+NMA9oyqsld+R7BG/R5vbnAAC+pDQXDiwVpt3kCJp4K0Yto Fu3PQfC97D7Y5/okTFsoiQ26V3bWSDQU+gAO3Qpcizp0z0xKeRKCgk2freKPiVeqBpIv TZ1Nnba08HIhtC1DtA/9U6bu1mt8PvwAQtwf08/yW++bgJKSSqP16JDD3pnDqQJy4XJm XrjQ== X-Gm-Message-State: AEkoouvO8znRY5QQ8hwjTxQaWlxCIS/yQTdo+0LbvGHp3Fnd41nIQ6wpXvuORgqsJ+sBkw== X-Received: by 10.107.152.149 with SMTP id a143mr85436569ioe.193.1470492391594; Sat, 06 Aug 2016 07:06:31 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id o15sm7696226ith.2.2016.08.06.07.06.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Aug 2016 07:06:30 -0700 (PDT) In-Reply-To: <838w7uqvn2.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 May 2010 18:08:01 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121899 Archived-At: --=-=-= Content-Type: text/plain fixed 6136 23.3.90 quit Was reported a second time (http://article.gmane.org/gmane.emacs.help/80250) and then fixed by 576bce32 (2011-03-19 "Fix emerge.el on MS-Windows and MS-DOS...") Eli Zaretskii writes: > I think emerge-protect-metachars should simply use > shell-quote-argument, on all platforms. Then it won't need to > distinguish between the different flavors, and it won't need to know > which characters need protection, something that is shell-dependent > and thus tricky even on Unix. But the non-Windows case still uses emerge-metachars. Should we make it same on all platforms: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=v1-0001-Make-emerge-always-use-shell-quote-argument.patch Content-Description: patch >From 7f960d1e91eb69ac14c55de2dc4a78adbf1274f1 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 6 Aug 2016 09:51:15 -0400 Subject: [PATCH v1] Make emerge always use shell-quote-argument * lisp/vc/emerge.el (emerge-metachars): Obsolete. (emerge-protect-metachars): Delete. (emerge-make-diff-list, emerge-make-diff3-list): Replace all calls to `emerge-protect-metachars' with `shell-quote-argument' so that shell quoting is done the same on all system types (Bug #6136). Also shell quote `emerge-diff-program' and `emerge-diff3-program'. --- lisp/vc/emerge.el | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index de25cba..058b15c 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -621,9 +621,10 @@ emerge-make-diff-list (erase-buffer) (shell-command (format "%s %s %s %s" - emerge-diff-program emerge-diff-options - (emerge-protect-metachars file-A) - (emerge-protect-metachars file-B)) + (shell-quote-argument emerge-diff-program) + emerge-diff-options + (shell-quote-argument file-A) + (shell-quote-argument file-B)) t)) (emerge-prepare-error-list emerge-diff-ok-lines-regexp) (emerge-convert-diffs-to-markers @@ -792,10 +793,11 @@ emerge-make-diff3-list (erase-buffer) (shell-command (format "%s %s %s %s %s" - emerge-diff3-program emerge-diff-options - (emerge-protect-metachars file-A) - (emerge-protect-metachars file-ancestor) - (emerge-protect-metachars file-B)) + (shell-quote-argument emerge-diff3-program) + emerge-diff-options + (shell-quote-argument file-A) + (shell-quote-argument file-ancestor) + (shell-quote-argument file-B)) t)) (emerge-prepare-error-list emerge-diff3-ok-lines-regexp) (emerge-convert-diffs-to-markers @@ -3171,26 +3173,11 @@ emerge-unslashify-name ;; Metacharacters that have to be protected from the shell when executing ;; a diff/diff3 command. -(defcustom emerge-metachars - (if (memq system-type '(ms-dos windows-nt)) - "[ \t\"<>|?*^&=]" - "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]") - "Characters that must be quoted when used in a shell command line. -More precisely, a [...] regexp to match any one such character." +(defcustom emerge-metachars nil + "Obsolete, emerge now uses `shell-quote-argument'." :type 'regexp :group 'emerge) - -;; Quote metacharacters (using \) when executing a diff/diff3 command. -(defun emerge-protect-metachars (s) - (if (memq system-type '(ms-dos windows-nt)) - (shell-quote-argument s) - (let ((limit 0)) - (while (string-match emerge-metachars s limit) - (setq s (concat (substring s 0 (match-beginning 0)) - "\\" - (substring s (match-beginning 0)))) - (setq limit (1+ (match-end 0))))) - s)) +(make-obsolete-variable 'emerge-metachars nil "25.2") (provide 'emerge) -- 2.8.0 --=-=-=--