GNU bug report logs - #51711
28.0.60; rgrep fails to pass the search directory to rgrep-default-command

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Tue, 9 Nov 2021 10:03:01 UTC

Severity: normal

Found in version 28.0.60

To reply to this bug, email your comments to 51711 AT debbugs.gnu.org.

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#51711; Package emacs. (Tue, 09 Nov 2021 10:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Phil Sainty <psainty <at> orcon.net.nz>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 09 Nov 2021 10:03:02 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: bug-gnu-emacs <at> gnu.org
Cc: Dmitry Gutov <dgutov <at> yandex.ru>
Subject: 28.0.60; rgrep fails to pass the search directory to
 rgrep-default-command
Date: Tue, 09 Nov 2021 23:02:43 +1300
This was intentionally changed in commit c6ee95ddeef:

https://git.savannah.gnu.org/cgit/emacs.git/commit?id=c6ee95ddeefc17410e15090539d0cb220ab6947c

       (setq dir (file-name-as-directory (expand-file-name dir)))
-      (let ((command (rgrep-default-command regexp files dir)))
+      (let ((command (rgrep-default-command regexp files nil)))

It's not clear to me why this was done, but rgrep-default-command
cannot produce the correct output if it isn't given the search
directory.  In particular, rgrep-find-ignored-directories and
rgrep-find-ignored-files no longer work as expected, if the
directory is not passed, for grep-find-ignored-directories and
grep-find-ignored-files values using the cons cell format, as
the functions specified need to know the search directory.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20719#22 may be the
justification ("it makes the last argument to rgrep-default-command
look superfluous."), but that's definitely not true.

I don't have my head around the other changes made for bug#20719
and so it's not clear to me whether fixing this is as simple as
reverting that one line, or if doing so will cause some other
regression.

CCing Dmitry.  Can you recall specifically why that line was changed?


-Phil




In GNU Emacs 28.0.60 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.15.10, Xaw scroll bars)
 of 2021-10-07 built on phil-lp
Repository revision: f7e6c199bf5b915e000bad964f3be2323d07647e
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 
11.0.12008000
System Description: Ubuntu 18.04.6 LTS





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51711; Package emacs. (Thu, 11 Nov 2021 00:19:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Phil Sainty <psainty <at> orcon.net.nz>, 51711 <at> debbugs.gnu.org
Subject: Re: bug#51711: 28.0.60; rgrep fails to pass the search directory to
 rgrep-default-command
Date: Thu, 11 Nov 2021 03:17:46 +0300
Hi!

On 09.11.2021 13:02, Phil Sainty wrote:
> This was intentionally changed in commit c6ee95ddeef:
> 
> https://git.savannah.gnu.org/cgit/emacs.git/commit?id=c6ee95ddeefc17410e15090539d0cb220ab6947c 
> 
> 
>         (setq dir (file-name-as-directory (expand-file-name dir)))
> -      (let ((command (rgrep-default-command regexp files dir)))
> +      (let ((command (rgrep-default-command regexp files nil)))
> 
> It's not clear to me why this was done, but rgrep-default-command
> cannot produce the correct output if it isn't given the search
> directory.  In particular, rgrep-find-ignored-directories and
> rgrep-find-ignored-files no longer work as expected, if the
> directory is not passed, for grep-find-ignored-directories and
> grep-find-ignored-files values using the cons cell format, as
> the functions specified need to know the search directory.

The effect on the *-ignores function is something we all have missed, alas.

This only matters when grep-find-ignored-directories or 
grep-find-ignored-files have been customized to cons values with 
functions, right?

> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20719#22 may be the
> justification ("it makes the last argument to rgrep-default-command
> look superfluous."), but that's definitely not true.
> 
> I don't have my head around the other changes made for bug#20719
> and so it's not clear to me whether fixing this is as simple as
> reverting that one line, or if doing so will cause some other
> regression.

It would replace "." in the resulting command with the absolute name of 
the directory, which would affect the output, for one thing.

> CCing Dmitry.  Can you recall specifically why that line was changed?

Does the below patch work for you? I suppose the answer depends on 
whether the functions in the customized car values will known what to do 
with ".".


diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index ec2850737c..8cc3e57378 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1218,7 +1218,7 @@ rgrep
 				   grep-find-command)))
 	    (compilation-start regexp 'grep-mode))
       (setq dir (file-name-as-directory (expand-file-name dir)))
-      (let ((command (rgrep-default-command regexp files nil)))
+      (let ((command (rgrep-default-command regexp files ".")))
 	(when command
 	  (if confirm
 	      (setq command




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51711; Package emacs. (Thu, 11 Nov 2021 01:49:02 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 51711 <at> debbugs.gnu.org, DG <raaahh <at> gmail.com>
Subject: Re: bug#51711: 28.0.60; rgrep fails to pass the search directory to
 rgrep-default-command
Date: Thu, 11 Nov 2021 14:48:12 +1300
On 2021-11-11 13:17, Dmitry Gutov wrote:
> This only matters when grep-find-ignored-directories or
> grep-find-ignored-files have been customized to cons values
> with functions, right?

Yes, I believe so.

> Does the below patch work for you? I suppose the answer depends
> on whether the functions in the customized car values will know
> what to do with ".".

Unfortunately I think "." will (at best) be recognised as the
default-directory for the buffer from which the rgrep command was
initiated -- there's no way for it to derive the specified search
directory from that.






This bug report was last modified 2 years and 160 days ago.

Previous Next


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