From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#29303: 25.2; vc-git-grep should shell-escape FILES Date: Wed, 15 Nov 2017 19:45:52 +0100 Message-ID: <87375fpehr.fsf@gmail.com> References: <87efoz983o.fsf@gmail.com> <83d14jjv5y.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1510771643 2452 195.159.176.226 (15 Nov 2017 18:47:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 15 Nov 2017 18:47:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: 29303@debbugs.gnu.org, gus@inodes.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 15 19:47:10 2017 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 1eF2iJ-0008Uh-Oi for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Nov 2017 19:47:07 +0100 Original-Received: from localhost ([::1]:37377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eF2iR-0005dE-5O for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Nov 2017 13:47:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eF2iK-0005cy-6r for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2017 13:47:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eF2iE-0001co-Md for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2017 13:47:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eF2iE-0001cb-IU for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2017 13:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eF2iE-0006Se-BL for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2017 13:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Nov 2017 18:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29303 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29303-submit@debbugs.gnu.org id=B29303.151077156224202 (code B ref 29303); Wed, 15 Nov 2017 18:47:02 +0000 Original-Received: (at 29303) by debbugs.gnu.org; 15 Nov 2017 18:46:02 +0000 Original-Received: from localhost ([127.0.0.1]:42121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF2hG-0006I3-2V for submit@debbugs.gnu.org; Wed, 15 Nov 2017 13:46:02 -0500 Original-Received: from mail-wm0-f53.google.com ([74.125.82.53]:33426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eF2hF-0006Gx-2S for 29303@debbugs.gnu.org; Wed, 15 Nov 2017 13:46:01 -0500 Original-Received: by mail-wm0-f53.google.com with SMTP id r68so22836515wmr.0 for <29303@debbugs.gnu.org>; Wed, 15 Nov 2017 10:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to :message-id:user-agent:mime-version; bh=hypEIl6sQ+TXJJBJw2rlpUCG5H3f781X1VchTnr0jJE=; b=Gi1+3OYfZnPXz4uB0Hd+yqsI616+dLDUHJzrVa6MjtPC9zmtlNI2dqDELm0MJcNVu8 N/7YXQzBNUEj0niyiu0zMs28IQ0rNreVUfRcCA/bTZ9zvCQR4O7KG78owRnX+1s2XPro JYi9ewut8crNhhEE6rbS25nyMLFB8/hy+P/l4PpgFqSL2JvtpB//56amA5lXWHamWqwL SsVhZFI3GfOkIr83IcXcnoLIqo5skkVVEF3MNvRxlnI16hp08yNu4OVy5Rw4eNo9zSP2 gR1AYBPQ7dJcY2++5hneG8akwO0KGNOkXg9jwGiTlq6kPAKHPYXY92EHRsIHzzC7R1gw rr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references :gmane-reply-to-list:date:in-reply-to:message-id:user-agent :mime-version; bh=hypEIl6sQ+TXJJBJw2rlpUCG5H3f781X1VchTnr0jJE=; b=cqi3EM4uh9QzRwFIvMcCdb/to8trXRhZW15QKV7hDnG8qksIqfw8nEjEaxXEk4hgKz 5JAkqPE8rpD++E3M0AJP9u6rjP8F1nEorUS6cuKlN2fR/uxJFInOU3oQnCo8C/S3ekCt wapNxgXbnYLOLEiv9fqViRNVgfn4W8fIZpstXZuzFCfRtC4Mc4G9F6cGbAC/4ev3ETEZ nEqInjgSXlucP+rZkzYar7/na4PzFF2Prp7f0np7VinHuX7N//how1NaHJRA+Rg5xf/M XBdaybkHlkjqmDNJc/DeO5YfG5Gyym6mMtAYPGxRaVD/tLLsnB7nIEPkG3qK/cIMuKfU RgPg== X-Gm-Message-State: AJaThX7mypSiw87gYX3WZZ4iephVrJBYVBjjtYMQPcxluBFjjffXp0i4 uWdJke+c1Gj9VZc4NzC8IOezWu+C X-Google-Smtp-Source: AGs4zMYm0HwW4Tgk/SOG7fnr/SPfoUSqQLE9B7zYpQBowBkgAywdH8rto4w+BcIYAxj7FDPs34oauQ== X-Received: by 10.28.151.14 with SMTP id z14mr14148614wmd.5.1510771555037; Wed, 15 Nov 2017 10:45:55 -0800 (PST) Original-Received: from rpluim ([2a01:e34:ecfc:a090:1874:a2a8:70da:f879]) by smtp.gmail.com with ESMTPSA id a71sm4632175wme.33.2017.11.15.10.45.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Nov 2017 10:45:53 -0800 (PST) Gmane-Reply-To-List: yes In-Reply-To: <83d14jjv5y.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 15 Nov 2017 19:42:17 +0200") 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:139931 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > This cannot be right, because this style of quoting only works with > Posix shells. There are people who run Emacs on Windows who use cmd.exe as the shell to invoke git? Takes all sorts, I guess. How about this then? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Shell-quote-filenames-to-inhibit-globbing-by-the-she.patch >From 0e3b4ee74bebae702bade0f1715fbb96b46bbec6 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Wed, 15 Nov 2017 10:51:37 +0100 Subject: [PATCH] Shell quote filenames to inhibit globbing by the shell * lisp/vc/vc-git.el (vc-git-grep): Apply shell quoting to filename patterns to ensure globbing is done by git rather than the shell. (Bug#29303) --- lisp/vc/vc-git.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ed85603f82..43164b4fcf 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1428,7 +1428,7 @@ vc-git-grep nil nil 'grep-history) nil)) (t (let* ((regexp (grep-read-regexp)) - (files (grep-read-files regexp)) + (files (mapconcat #'shell-quote-argument (split-string (grep-read-files regexp)) " ")) (dir (read-directory-name "In directory: " nil default-directory t))) (list regexp files dir)))))) -- 2.15.0.276.g89ea799ff --=-=-=--