From: Wolfgang Scherer <Wolfgang.Scherer@gmx.de>
To: Dmitry Gutov <dgutov@yandex.ru>, 39452@debbugs.gnu.org
Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
Date: Fri, 7 Feb 2020 18:25:27 +0100 [thread overview]
Message-ID: <3a7c412d-4926-9109-8545-31268ce37fca@gmx.de> (raw)
In-Reply-To: <da916f04-ca02-ab00-4864-cddfcc463e25@yandex.ru>
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:
>>
>> - (status (apply #'vc-git--run-command-string file args)))
>> + (status (apply #'vc-git--run-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 backends. So once I am finished, I will have tested all vs-backend-state functions with filenames containing glob special characters.
Since call-process is already used in vc-git, the function shell-quote-argument 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-amt.ws/emacs/doc/_build/html/emacs-vc-ignore-feature.html):
(defun vc-glob-escape (string)
"Escape special glob characters in STRING."
(save-match-data
(if (string-match "[\\?*[]" string)
(mapconcat (lambda (c)
(pcase c
(?\\ "\\\\")
(?? "\\?")
(?* "\\*")
(?\[ "\\[")
(_ (char-to-string c))))
string "")
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-nil:
;; (let ((default-directory "/srv/install/linux/emacs/check-git/")) (vc-git-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 glob expansion and are therefore broken.
next prev parent reply other threads:[~2020-02-07 17:25 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 13:59 bug#39452: [PATCH] vc-git-state fails for filenames with wildcards Wolfgang Scherer
2020-02-06 23:00 ` Dmitry Gutov
2020-02-07 7:57 ` Eli Zaretskii
2020-02-07 8:43 ` Dmitry Gutov
2020-02-07 9:26 ` Eli Zaretskii
2020-02-07 11:43 ` Dmitry Gutov
2020-02-07 14:43 ` Noam Postavsky
2020-02-11 23:01 ` Dmitry Gutov
2020-02-12 15:24 ` Noam Postavsky
2021-05-12 16:04 ` Lars Ingebrigtsen
2021-05-17 1:05 ` Dmitry Gutov
2021-07-22 12:42 ` Lars Ingebrigtsen
2021-08-14 0:11 ` Dmitry Gutov
2021-08-14 11:56 ` Lars Ingebrigtsen
2021-08-15 1:25 ` Dmitry Gutov
2021-08-27 6:05 ` Juri Linkov
2021-08-27 12:51 ` Dmitry Gutov
2021-08-27 17:10 ` Juri Linkov
2021-08-27 19:57 ` Stephen Berman
2021-08-28 15:07 ` Lars Ingebrigtsen
2021-08-28 15:44 ` Stephen Berman
2021-08-28 15:48 ` Lars Ingebrigtsen
2021-08-28 16:02 ` Stephen Berman
2021-08-28 22:19 ` Dmitry Gutov
2021-08-30 2:36 ` Dmitry Gutov
2021-08-30 13:34 ` Stephen Berman
2021-08-30 23:48 ` Dmitry Gutov
2021-08-27 22:47 ` Dmitry Gutov
2021-08-29 0:18 ` Dmitry Gutov
2021-08-29 16:44 ` Juri Linkov
2021-08-29 19:50 ` Dmitry Gutov
2021-08-29 19:57 ` Lars Ingebrigtsen
2021-08-29 20:11 ` Dmitry Gutov
2020-02-13 18:34 ` Wolfgang Scherer
2020-02-13 23:23 ` Dmitry Gutov
2020-02-14 9:37 ` Eli Zaretskii
2020-02-14 13:59 ` Dmitry Gutov
2020-02-14 14:14 ` Eli Zaretskii
2020-02-14 14:40 ` Dmitry Gutov
2020-02-14 15:45 ` Eli Zaretskii
2020-02-14 20:37 ` Dmitry Gutov
2020-09-20 9:54 ` Lars Ingebrigtsen
2020-02-07 17:25 ` Wolfgang Scherer [this message]
2020-02-07 22:31 ` Wolfgang Scherer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a7c412d-4926-9109-8545-31268ce37fca@gmx.de \
--to=wolfgang.scherer@gmx.de \
--cc=39452@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).