From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Wolfgang Scherer Newsgroups: gmane.emacs.bugs Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards Date: Fri, 7 Feb 2020 18:25:27 +0100 Message-ID: <3a7c412d-4926-9109-8545-31268ce37fca@gmx.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="18255"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 To: Dmitry Gutov , 39452@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 07 18:26:36 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j07Ol-0004bR-Sv for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Feb 2020 18:26:35 +0100 Original-Received: from localhost ([::1]:33086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j07Ok-0000LO-MI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Feb 2020 12:26:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40229) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j07OF-0000Kj-QL for bug-gnu-emacs@gnu.org; Fri, 07 Feb 2020 12:26:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j07OE-0004hO-Gn for bug-gnu-emacs@gnu.org; Fri, 07 Feb 2020 12:26:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44222) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j07OE-0004fv-8p for bug-gnu-emacs@gnu.org; Fri, 07 Feb 2020 12:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j07OE-0001Tx-54 for bug-gnu-emacs@gnu.org; Fri, 07 Feb 2020 12:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Scherer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Feb 2020 17:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39452 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39452-submit@debbugs.gnu.org id=B39452.15810963375656 (code B ref 39452); Fri, 07 Feb 2020 17:26:02 +0000 Original-Received: (at 39452) by debbugs.gnu.org; 7 Feb 2020 17:25:37 +0000 Original-Received: from localhost ([127.0.0.1]:50195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j07No-0001TA-Qs for submit@debbugs.gnu.org; Fri, 07 Feb 2020 12:25:37 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:38917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j07Nm-0001Ss-NG for 39452@debbugs.gnu.org; Fri, 07 Feb 2020 12:25:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1581096328; bh=f2YgxxQH09RRTNNqlcLPxnlHc8ce6wrU6Bh0RXEp5To=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=aDs6DuLr9gOyUC4xsI6biCeFnF9a+2GgFBxrohF1nYsIl6XOwQ/Rg82M5EobfzllI lqa7cN51+auYLKB0X5fvhK7VdBJHDTzlzK7rE4Qbl2RiILPRm+StKoZ86rVSoxD3o3 qSvQxg6zp4z1nsAfII97JMuEzNzH04MT293dPx04= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from sheckley.simul.de ([87.160.210.52]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbRk3-1jWh2f1vVh-00bpDc; Fri, 07 Feb 2020 18:25:28 +0100 Original-Received: from [127.0.0.1] (sheckley.simul.de [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sheckley.simul.de (Postfix) with ESMTPSA id 41ACD19431CA; Fri, 7 Feb 2020 18:25:27 +0100 (CET) Openpgp: preference=signencrypt Autocrypt: addr=Wolfgang.Scherer@gmx.de; prefer-encrypt=mutual; keydata= xsDiBEb46IgRBACMHOAb1KNo1Ylk+ebri+4R+bG4tyKlqBlrpv8D9/ZwRdXSGt+0DyCHoaAd 7KW7noHapLe87DunABOjKG4nqTGv+dRiWuUBlp3I4aYRFDVa3Da+XnIYkMHKqhK59VEHQCdp Km42nuLS7TS+n99at9YwzTG6VBdOlBKTlRFngOjVLwCg1RGXJ6X3EjS1FKCQeXziURVpWlkD /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEyKKYb9L5pGlqiZz9g/K9xw1EUoZTYuaufquD v4rAGR58K/3V4CYfJLEeshMWiaXHvMmlxMznlG16/um4MvmR8B3r+cx0nOPK1JBdD2qrkNnF Mw8FB+zouLFB4Gt2IUC5IlOmZ8OQA/4qdU53CItzWsCr9Nux4L0qUlRweSmCnV8xGQ2wP5XI MawIQxxREvSrsYDG8cNnYETMg4iQFfIktwAoxCJvuFAwIB6ZxHGF4FcEZm64CXc2u7CmFLqt rVhXhIfMz9oEYC+HhGczGamn9ofbGTFd2hJEtPcQgWNR4f7+aKknmi2+OM0fV29sZmdhbmcg U2NoZXJlciA8d3NAc3ctYW10LndzPsJ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0tWLmfeIEqWIPzJLSOfKO rHPk+ya/lLzp5ixWF735W1zLzKghATZ2/IhZkw9PWcy8370yFnghLPaUuD+PShGR11mua8nYc uknZ8ODP+trulKDohXwUpD5iJRCAePsKQu54BubZpLvMzROGLqQrnIWZaGueThbMfGn67u0gi wmSzCKFWUkwckEfeIoK0F2LmAPh915iycKWM+vN7D47299anJh0NrPtfFFN+ER8qao+XaXvF 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175754 Archived-At: Hi Dmitry, Am 07.02.20 um 00:00 schrieb Dmitry Gutov: > > On 06.02.2020 16:59, Wolfgang Scherer wrote: >> When a filename contains shell wildcard characters matching one or more= files, e.g. `test[56].xx` matching both `test5.xx` and `test6.xx`: >> The command `vc-git-state` does not work correctly. >> >> The attched patch fixes this: >> >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (status (apply #'vc-git--ru= n-command-string file args))) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (status (apply #'vc-git--ru= n-command-string (shell-quote-argument file) args))) >> > > Thanks for the report and the patch. > > I wonder how many other backends commands are broken for files like that= : we basically never shell-quote file names. I finally decided to fully implement the vc ignore feature for all backend= s. So once I am finished, I will have tested all vs-backend-state function= s with filenames containing glob special characters. Since call-process is already used in vc-git, the function shell-quote-arg= ument is not really appropriate. For the ongoing vc ignore implementation I needed a glob escape function, = which only escapes special glob characters and backslash (see http://sw-am= t.ws/emacs/doc/_build/html/emacs-vc-ignore-feature.html): (defun vc-glob-escape (string) =C2=A0 "Escape special glob characters in STRING." =C2=A0 (save-match-data =C2=A0=C2=A0=C2=A0 (if (string-match "[\\?*[]" string) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (mapconcat (lambda (c) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (pcase c =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (?\\ "\\\\") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (?? "\\?") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (?* "\\*") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (?\[ "\\[") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (_ (char-to-s= tring c)))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string "") =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 string))) As for other occurences of glob errors in vc-git, The function vc-git-dir-= status-files also suffers from this bug, when the FILES argument is non-ni= l: ;; (let ((default-directory "/srv/install/linux/emacs/check-git/")) (vc-gi= t-dir-status-files nil '("/srv/install/linux/emacs/check-git/test[56].xx")= (lambda (&rest args) args))) fatal: pathspec 'test[56].xx' did not match any files test5.xx^@test6.xx^@test[56].xx^@ Various other git commands, like vc-git-revert, vc-git-checkin also use gl= ob expansion and are therefore broken.