* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
@ 2016-02-07 3:17 Óscar Fuentes
2016-02-08 4:46 ` Dmitry Gutov
0 siblings, 1 reply; 10+ messages in thread
From: Óscar Fuentes @ 2016-02-07 3:17 UTC (permalink / raw)
To: 22577
emacs -Q
M-x vc-dir <top directory of a git repo. Emacs' for instance>
M-x vc-git-grep
Search for: foo
Search for "foo" in files (default all): <ENTER (accept default)>
In directory: <ENTER (accept default)>
The command fails with
-*- mode: grep; default-directory: "~/dev/emacs/emacs/" -*-
Grep started at Sun Feb 7 03:54:09
git --no-pager grep -n -e VC -- * .*
fatal: ..: '..' is outside repository
Grep exited abnormally with code 128 at Sun Feb 7 03:54:09
The problem consists on `all' defaulting to the file patterns "* .*", as
defined in the variable `grep-files-aliases'. Those patterns matches
".." (the parent directory) which is outside the git repo (when you
execute vc-git-grep on the top directory of the repo.)
BTW, this pattern creates unnecesary noise when used with the `grep'
commands, adding to the grep output lines such as
grep: .: Is a directory
grep: ..: Is a directory
I propose the following patch to fix this problem. Shell gurus, please
review.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 7e6f157..3f77a2a 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -189,7 +189,7 @@ grep-find-template
:group 'grep)
(defcustom grep-files-aliases
- '(("all" . "* .*")
+ '(("all" . "* .[^\\.]*")
("el" . "*.el")
("ch" . "*.[ch]")
("c" . "*.c")
In GNU Emacs 25.0.50.29 (x86_64-unknown-linux-gnu, X toolkit)
of 2016-01-21 built on qcore
Repository revision: 5293d1bdb3e665a565af032a163004c976328cc2
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description: Ubuntu 15.10
Configured using:
'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid'
Configured features:
XAW3D XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS LIBXML2
FREETYPE XFT ZLIB LUCID X11
Important settings:
value of $LANG: C
locale-coding-system: nil
Major mode: Emacs-Lisp
^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-07 3:17 bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files Óscar Fuentes
@ 2016-02-08 4:46 ` Dmitry Gutov
2016-02-08 5:59 ` Óscar Fuentes
0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Gutov @ 2016-02-08 4:46 UTC (permalink / raw)
To: Óscar Fuentes, 22577
On 02/07/2016 05:17 AM, Óscar Fuentes wrote:
> I propose the following patch to fix this problem. Shell gurus, please
> review.
(Not a guru here.)
> diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
> index 7e6f157..3f77a2a 100644
> --- a/lisp/progmodes/grep.el
> +++ b/lisp/progmodes/grep.el
> @@ -189,7 +189,7 @@ grep-find-template
> :group 'grep)
>
> (defcustom grep-files-aliases
> - '(("all" . "* .*")
> + '(("all" . "* .[^\\.]*")
I think you don't even need the escape (and it would create a false
negative for file names starting with '.\'; but nobody should have those
anyway). Otherwise, it looks good.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 4:46 ` Dmitry Gutov
@ 2016-02-08 5:59 ` Óscar Fuentes
2016-02-08 11:16 ` Andreas Schwab
0 siblings, 1 reply; 10+ messages in thread
From: Óscar Fuentes @ 2016-02-08 5:59 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 22577
Dmitry Gutov <dgutov@yandex.ru> writes:
> (Not a guru here.)
Thanks for commenting anyways :-)
>> - '(("all" . "* .*")
>> + '(("all" . "* .[^\\.]*")
>
> I think you don't even need the escape (and it would create a false
> negative for file names starting with '.\'; but nobody should have
> those anyway). Otherwise, it looks good.
It seems that the escape is not required, although every example I saw
on the Internets uses it (one copying the another, I guess.)
What I've discovered while investigating your commentary is that the
[^.] syntax is not POSIX and some shells (posh) does not admit it. The
syntax required by POSIX is [!.]. I checked that .[!.]* works as
expected on GNU/Linux and on Windows (MSYS2 and cmd.exe calling git and
grep). It doesn't work on Eshell, but that doesn't count.
On a few days I'll commit the patch using the [!.] syntax, if nobody
objects to it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 5:59 ` Óscar Fuentes
@ 2016-02-08 11:16 ` Andreas Schwab
2016-02-08 16:10 ` Óscar Fuentes
2016-02-08 16:22 ` Óscar Fuentes
0 siblings, 2 replies; 10+ messages in thread
From: Andreas Schwab @ 2016-02-08 11:16 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: 22577, Dmitry Gutov
Óscar Fuentes <ofv@wanadoo.es> writes:
> On a few days I'll commit the patch using the [!.] syntax, if nobody
> objects to it.
What about file names starting with ".."?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 11:16 ` Andreas Schwab
@ 2016-02-08 16:10 ` Óscar Fuentes
2016-02-08 16:22 ` Óscar Fuentes
1 sibling, 0 replies; 10+ messages in thread
From: Óscar Fuentes @ 2016-02-08 16:10 UTC (permalink / raw)
To: 22577
Andreas Schwab <schwab@suse.de> writes:
> What about file names starting with ".."?
Is there a way to accept them while rejecting the parent directory? If
not, I opt for ignoring those rather than having commands that fail when
used with the default parameters suggested by Emacs.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 11:16 ` Andreas Schwab
2016-02-08 16:10 ` Óscar Fuentes
@ 2016-02-08 16:22 ` Óscar Fuentes
2016-02-08 16:28 ` Andreas Schwab
` (3 more replies)
1 sibling, 4 replies; 10+ messages in thread
From: Óscar Fuentes @ 2016-02-08 16:22 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 22577, Dmitry Gutov
Andreas Schwab <schwab@suse.de> writes:
> What about file names starting with ".."?
Is there a way to accept them while rejecting the parent directory? If
not, I opt for ignoring those rather than having commands that fail when
used with the default parameters suggested by Emacs.
We could add "..?*" but that doesn't match directories:
oscar@qcore:~/dev/emacs/emacs$ ls ..?*
ls: cannot access ..?*: No such file or directory
oscar@qcore:~/dev/emacs/emacs$ mkdir ..foo
oscar@qcore:~/dev/emacs/emacs$ ls ..?*
oscar@qcore:~/dev/emacs/emacs$ rmdir ..foo
oscar@qcore:~/dev/emacs/emacs$ touch ..foo
oscar@qcore:~/dev/emacs/emacs$ ls ..?*
..foo
This is also puzzling to me:
oscar@qcore:~/dev/emacs/emacs$ ls .?
build dbuild old-emacs ses.patch tooltip_pos.diff
build.script emacs pmodes-tests tooltip_pos2.diff
oscar@qcore:~/dev/emacs/emacs$ ls ?
ls: cannot access ?: No such file or directory
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 16:22 ` Óscar Fuentes
@ 2016-02-08 16:28 ` Andreas Schwab
2016-02-08 18:14 ` Dmitry Gutov
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2016-02-08 16:28 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: 22577, Dmitry Gutov
Óscar Fuentes <ofv@wanadoo.es> writes:
> This is also puzzling to me:
>
> oscar@qcore:~/dev/emacs/emacs$ ls .?
> build dbuild old-emacs ses.patch tooltip_pos.diff
> build.script emacs pmodes-tests tooltip_pos2.diff
> oscar@qcore:~/dev/emacs/emacs$ ls ?
> ls: cannot access ?: No such file or directory
A leading dot is never matched by wildcards, but other dots are not
special.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 16:22 ` Óscar Fuentes
2016-02-08 16:28 ` Andreas Schwab
@ 2016-02-08 18:14 ` Dmitry Gutov
2016-02-08 18:41 ` Andreas Schwab
2016-02-14 15:24 ` Óscar Fuentes
3 siblings, 0 replies; 10+ messages in thread
From: Dmitry Gutov @ 2016-02-08 18:14 UTC (permalink / raw)
To: Óscar Fuentes, Andreas Schwab; +Cc: 22577
On 02/08/2016 06:22 PM, Óscar Fuentes wrote:
> We could add "..?*" but that doesn't match directories:
I don't think grep-files-aliases are supposed to match directories anyway.
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 16:22 ` Óscar Fuentes
2016-02-08 16:28 ` Andreas Schwab
2016-02-08 18:14 ` Dmitry Gutov
@ 2016-02-08 18:41 ` Andreas Schwab
2016-02-14 15:24 ` Óscar Fuentes
3 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2016-02-08 18:41 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: 22577, Dmitry Gutov
Óscar Fuentes <ofv@wanadoo.es> writes:
> We could add "..?*" but that doesn't match directories:
Why do you think so?
> oscar@qcore:~/dev/emacs/emacs$ mkdir ..foo
> oscar@qcore:~/dev/emacs/emacs$ ls ..?*
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files
2016-02-08 16:22 ` Óscar Fuentes
` (2 preceding siblings ...)
2016-02-08 18:41 ` Andreas Schwab
@ 2016-02-14 15:24 ` Óscar Fuentes
3 siblings, 0 replies; 10+ messages in thread
From: Óscar Fuentes @ 2016-02-14 15:24 UTC (permalink / raw)
To: 22577-done
Fixed on 856cd948d1a5a016ad36721246a049d33451902f.
The final pattern matches names starting with two dots too.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-02-14 15:24 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 3:17 bug#22577: 25.0.50; vc-git-grep fails when searching for `all' files Óscar Fuentes
2016-02-08 4:46 ` Dmitry Gutov
2016-02-08 5:59 ` Óscar Fuentes
2016-02-08 11:16 ` Andreas Schwab
2016-02-08 16:10 ` Óscar Fuentes
2016-02-08 16:22 ` Óscar Fuentes
2016-02-08 16:28 ` Andreas Schwab
2016-02-08 18:14 ` Dmitry Gutov
2016-02-08 18:41 ` Andreas Schwab
2016-02-14 15:24 ` Óscar Fuentes
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.