GNU bug report logs -
#71078
rgrep accepts wildcard, then throws it away
Previous Next
To reply to this bug, email your comments to 71078 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71078
; Package
emacs
.
(Mon, 20 May 2024 11:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dan Jacobson <jidanni <at> jidanni.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 20 May 2024 11:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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"
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71078
; Package
emacs
.
(Mon, 20 May 2024 17:33:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 71078 <at> debbugs.gnu.org (full text, mbox):
Dan Jacobson <jidanni <at> jidanni.org> writes:
> 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!
That's just how this call works:
(read-directory-name "Base directory: "
nil default-directory t)
If I give an input like "/tmp* RET" at the prompt, it returns "/tmp/".
What's confusing to me is this part in the docstring of
`read-directory-name':
Fourth arg MUSTMATCH non-nil means require existing directory’s name.
Non-nil and non-t means also require confirmation after completion.
I think "require existing directory’s name" should be clarified to say:
"require the user to input an existing directory's name", if that is
indeed the intention here.
That it removes the "*" character seems to be undocumented, but if
that's the intended behaviour perhaps it should be clarified too. Hmm.
Eli, Stefan, any thoughts here?
> In fact if we do add the * here,
> (rgrep "minimaldns" "* .*" "/usr/share/doc/exim4*")
> and do ^X^E, we end up searching ~/ !
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
I'm not sure it makes much sense to make the function this DWIM-y. It'd
be good to hear what other people think about this also.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71078
; Package
emacs
.
(Tue, 21 May 2024 15:32:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 71078 <at> debbugs.gnu.org (full text, mbox):
> (read-directory-name "Base directory: "
> nil default-directory t)
>
> If I give an input like "/tmp* RET" at the prompt, it returns "/tmp/".
>
> What's confusing to me is this part in the docstring of
> `read-directory-name':
>
> Fourth arg MUSTMATCH non-nil means require existing directory’s name.
> Non-nil and non-t means also require confirmation after completion.
>
> I think "require existing directory’s name" should be clarified to say:
> "require the user to input an existing directory's name", if that is
> indeed the intention here.
That's indeed the intention (and the way I read it, that's what it says).
> That it removes the "*" character seems to be undocumented, but if
> that's the intended behaviour perhaps it should be clarified too. Hmm.
It does not remove the *. What you're seeing is the effect of
completion (and `partial-completion` treats the * as a wildcard for
completion purposes) so you can also just type `/tm` and it should
return the same thing (provided `/tmp/` is the sole completion).
> 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.
Stefan
This bug report was last modified 185 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.