GNU bug report logs - #71078
rgrep accepts wildcard, then throws it away

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 20 May 2024 11:50:02 UTC

Severity: normal

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#71078: closed (rgrep accepts wildcard, then throws it away)
Date: Sat, 01 Mar 2025 02:26:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 28 Feb 2025 18:25:01 -0800
with message-id <CADwFkmk2HgxJ_GibhqjfidwDqwJWZ-Xeh_QU52rqDV8OKuw-_g <at> mail.gmail.com>
and subject line Re: bug#71078: rgrep accepts wildcard, then throws it away
has caused the debbugs.gnu.org bug report #71078,
regarding rgrep accepts wildcard, then throws it away
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
71078: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71078
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: rgrep accepts wildcard, then throws it away
Date: Mon, 20 May 2024 19:48:53 +0800
When rgrep asks for the Base directory, and the user gives a wildcard,
Base directory: /usr/share/doc/exim4*
it is thrown away, and this instead gets run:
(rgrep "minimaldns" "* .*" "/usr/share/doc/exim4")

In fact this is a very special case, as there happens to be a directory
with just that name,

/usr/share/doc:
  wildcard exim4*
  drwxr-xr-x 2 4096 04-13 07:09 exim4-daemon-light
  drwxr-xr-x 3 4096 04-13 07:09 exim4-base
  drwxr-xr-x 3 4096 04-13 07:09 exim4-config
  drwxr-xr-x 2 4096 2023-11-07  exim4-doc-info
  drwxr-xr-x 3 4096 2023-11-07  exim4-doc-html
  lrwxrwxrwx 1   10 2016-12-08  exim4 -> exim4-base

Normally rgrep won't let the user even proceed if e.g., the user just gave
Base directory: /usr/share/doc/exi*
but in the case where there is in fact a directory that matches exim4,
the "*" gets thrown away!

In fact if we do add the * here,
(rgrep "minimaldns" "* .*" "/usr/share/doc/exim4*")
and do ^X^E, we end up searching ~/ !

emacs-version "29.3"


[Message part 3 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Dan Jacobson <jidanni <at> jidanni.org>,
 71078-done <at> debbugs.gnu.org, Stefan Monnier <monnier <at> gnu.org>
Subject: Re: bug#71078: rgrep accepts wildcard, then throws it away
Date: Fri, 28 Feb 2025 18:25:01 -0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> I think this is expected, and not a bug, due to this part in grep.el:
>>
>>      (unless (and dir (file-accessible-directory-p dir))
>>        (setq dir default-directory))
>>
>> I'd rather it would signal an error in this case, to be honest, because
>
> Agreed.  The above can only make sense when `dir` doesn't matter.

Now done on master, and closing the bug.


This bug report was last modified 79 days ago.

Previous Next


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