GNU bug report logs - #22577
25.0.50; vc-git-grep fails when searching for `all' files

Previous Next

Package: emacs;

Reported by: Óscar Fuentes <ofv <at> wanadoo.es>

Date: Sun, 7 Feb 2016 03:18:02 UTC

Severity: normal

Found in version 25.0.50

Done: Óscar Fuentes <ofv <at> wanadoo.es>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22577 in the body.
You can then email your comments to 22577 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Sun, 07 Feb 2016 03:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Óscar Fuentes <ofv <at> wanadoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 07 Feb 2016 03:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; vc-git-grep fails when searching for `all' files
Date: Sun, 07 Feb 2016 04:17:03 +0100
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 04:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Óscar Fuentes <ofv <at> wanadoo.es>, 22577 <at> debbugs.gnu.org
Subject: Re: bug#22577: 25.0.50; vc-git-grep fails when searching for `all'
 files
Date: Mon, 8 Feb 2016 06:46:37 +0200
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 06:00:01 GMT) Full text and rfc822 format available.

Message #11 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 22577 <at> debbugs.gnu.org
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 06:59:33 +0100
Dmitry Gutov <dgutov <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 11:17:01 GMT) Full text and rfc822 format available.

Message #14 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 22577 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 12:16:22 +0100
Óscar Fuentes <ofv <at> 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 <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 18:02:02 GMT) Full text and rfc822 format available.

Message #17 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 22577 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 17:28:16 +0100
Óscar Fuentes <ofv <at> wanadoo.es> writes:

> This is also puzzling to me:
>
> oscar <at> qcore:~/dev/emacs/emacs$ ls .?
> build         dbuild  old-emacs     ses.patch          tooltip_pos.diff
> build.script  emacs   pmodes-tests  tooltip_pos2.diff
> oscar <at> 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 <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 18:09:02 GMT) Full text and rfc822 format available.

Message #20 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 22577 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 17:22:44 +0100
Andreas Schwab <schwab <at> 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 <at> qcore:~/dev/emacs/emacs$ ls ..?*
ls: cannot access ..?*: No such file or directory
oscar <at> qcore:~/dev/emacs/emacs$ mkdir ..foo
oscar <at> qcore:~/dev/emacs/emacs$ ls ..?*
oscar <at> qcore:~/dev/emacs/emacs$ rmdir ..foo
oscar <at> qcore:~/dev/emacs/emacs$ touch ..foo
oscar <at> qcore:~/dev/emacs/emacs$ ls ..?*
..foo


This is also puzzling to me:

oscar <at> qcore:~/dev/emacs/emacs$ ls .?
build         dbuild  old-emacs     ses.patch          tooltip_pos.diff
build.script  emacs   pmodes-tests  tooltip_pos2.diff
oscar <at> qcore:~/dev/emacs/emacs$ ls ?
ls: cannot access ?: No such file or directory




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 18:15:02 GMT) Full text and rfc822 format available.

Message #23 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Óscar Fuentes <ofv <at> wanadoo.es>,
 Andreas Schwab <schwab <at> suse.de>
Cc: 22577 <at> debbugs.gnu.org
Subject: Re: bug#22577: 25.0.50; vc-git-grep fails when searching for `all'
 files
Date: Mon, 8 Feb 2016 20:14:18 +0200
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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 18:27:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 17:10:36 +0100
Andreas Schwab <schwab <at> 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22577; Package emacs. (Mon, 08 Feb 2016 18:42:02 GMT) Full text and rfc822 format available.

Message #29 received at 22577 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Óscar Fuentes <ofv <at> wanadoo.es>
Cc: 22577 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Mon, 08 Feb 2016 19:41:22 +0100
Óscar Fuentes <ofv <at> wanadoo.es> writes:

> We could add "..?*" but that doesn't match directories:

Why do you think so?

> oscar <at> qcore:~/dev/emacs/emacs$ mkdir ..foo
> oscar <at> qcore:~/dev/emacs/emacs$ ls ..?*

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Reply sent to Óscar Fuentes <ofv <at> wanadoo.es>:
You have taken responsibility. (Sun, 14 Feb 2016 15:25:02 GMT) Full text and rfc822 format available.

Notification sent to Óscar Fuentes <ofv <at> wanadoo.es>:
bug acknowledged by developer. (Sun, 14 Feb 2016 15:25:02 GMT) Full text and rfc822 format available.

Message #34 received at 22577-done <at> debbugs.gnu.org (full text, mbox):

From: Óscar Fuentes <ofv <at> wanadoo.es>
To: 22577-done <at> debbugs.gnu.org
Subject: Re: bug#22577: 25.0.50;
 vc-git-grep fails when searching for `all' files
Date: Sun, 14 Feb 2016 16:24:26 +0100
Fixed on 856cd948d1a5a016ad36721246a049d33451902f.

The final pattern matches names starting with two dots too.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 14 Mar 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.