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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Dan Jacobson <jidanni@HIDDEN>; Done: Stefan Kangas <stefankangas@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 71078-done <at> debbugs.gnu.org:


Received: (at 71078-done) by debbugs.gnu.org; 1 Mar 2025 02:25:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 21:25:09 2025
Received: from localhost ([127.0.0.1]:56198 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toCXN-00077k-Hu
	for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 21:25:09 -0500
Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:46150)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1toCXL-00072t-VX
 for 71078-done <at> debbugs.gnu.org; Fri, 28 Feb 2025 21:25:08 -0500
Received: by mail-ed1-x530.google.com with SMTP id
 4fb4d7f45d1cf-5e4b410e48bso4099366a12.0
 for <71078-done <at> debbugs.gnu.org>; Fri, 28 Feb 2025 18:25:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740795902; x=1741400702; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=NaCVgeishPVVBsPlq5EpSBQ+EKTGBcdTGFSRY+3nf3I=;
 b=Oy9nuOOL0Xbfzf/S8Qkg1jmYOZgeK4pInUdbKTps2rh8efUnWYHGcdTK+OeeuNoWKA
 MwY4WX1urhmIKSZGKgpQymCHnWJnTTA1n0V0PnF7epbD/cbB/lloUKHLdwWxTSq+ijdB
 azh+n8dL6cT3XeCJG1ONJAefkQOAIgBF6hiVWiTYqN7jwfd3PCU5jTadfFOLbt71y+1I
 FlNzGdPwGR0HHbDGGq8i/a5nwFQTHAS8GhSFYD+ffUOwnH58GYnvMBM4Z8H2WVfW4ilC
 nNTDHhI5ThpHuXwTF0FvO/oKTUjl5ajwJqan8iqc0yeXTwnk9Ww/zfNmwjBS0x+YAn8I
 W2iQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740795902; x=1741400702;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=NaCVgeishPVVBsPlq5EpSBQ+EKTGBcdTGFSRY+3nf3I=;
 b=m6wFjPgxSzAYhxZpJ3yAMrE0/TevzdbeidC40iTYf66W7RYs3iqXpIcipPwl4Ma/ko
 E2y0ApIoBypXCgfoafOC9Ttix+J6yRQlWpjZOer5YPSAnpZUp49MpNOMJ0G3c/z4SXRN
 OTJVptMP2jQMdX4eAJbGaAevoz1fmwOihm3AHvVu7HIvaR5U9Pk5zBulx3uLZE1m0tdR
 kFTgP7ccEVZFON2CLTOk2J79b+M2h4LVE58ZVFEpgw+o2ddpB6RCCYxKeQJRzmMQmQ7S
 Hq7JjtQxn0N3sSlgOvEgmFeige3omONeztF4TX7NrG398AxCPYNAAGMoE0zG8Yj5B+g5
 DKGA==
X-Forwarded-Encrypted: i=1;
 AJvYcCWiC6OjfiLefnHLMxNTj5FBPRzCloOGDM1/QmtKGQrN4KxwPePp5u4LsndApbpN6OOF9kGHpY89/Ihk <at> debbugs.gnu.org
X-Gm-Message-State: AOJu0YwzkGwzNGTf8zQoMwPRQJYeLqFpgmY/EuKB8Qcy4wsF1aIJHWWF
 0Rg788LS5gViPI9qImVWLDNmOo26G1faKETRaljLqFeQDJ16ctR0Z6Rp3aF/csWYapekUmwbJbi
 v2y0DYnL7Suhdp0lgou3E7iZfPb0=
X-Gm-Gg: ASbGnctC+sb4ttsa+VMx5R/i7Mt8a9Sx66+llBheD8yeLEC6JVw0Tt3IDusvSGpxzXL
 qhmcpS3m2FI3wna9HFj0AC0U9A9dXrm7jKtRLfOOuhixVlIJm/kRav7cQ9bpKCGhTQTuDUrcbfL
 zyc0frj086wAsPur7p6D3lDL3++Z4=
X-Google-Smtp-Source: AGHT+IE2oZLBM7xzqDk72Z19MKP8Al+XdRTRydKQkmhnFcFFOJE/NguFgoovXfmKxrsvh7iOItYo08usEOwFhEL0dGc=
X-Received: by 2002:a05:6402:1d49:b0:5e0:8064:b42e with SMTP id
 4fb4d7f45d1cf-5e4d6b6911amr3566994a12.25.1740795901735; Fri, 28 Feb 2025
 18:25:01 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 28 Feb 2025 18:25:01 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <jwvr0dv9oht.fsf-monnier+emacs@HIDDEN>
References: <877cfowvoa.5.fsf@HIDDEN>
 <CADwFkmkTe+ih9dPEfzHXSEbn4ep+J9p2GSgtxksQfA=d-phCQQ@HIDDEN>
 <jwvr0dv9oht.fsf-monnier+emacs@HIDDEN>
MIME-Version: 1.0
Date: Fri, 28 Feb 2025 18:25:01 -0800
X-Gm-Features: AQ5f1JprD-xKX60042A77elPfMKb6smMl5MFqQvzK4YOPD_CWK09XDUwXV-RMSU
Message-ID: <CADwFkmk2HgxJ_GibhqjfidwDqwJWZ-Xeh_QU52rqDV8OKuw-_g@HIDDEN>
Subject: Re: bug#71078: rgrep accepts wildcard, then throws it away
To: Stefan Monnier <monnier@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71078-done
Cc: Eli Zaretskii <eliz@HIDDEN>, Dan Jacobson <jidanni@HIDDEN>,
 71078-done <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> 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.




Notification sent to Dan Jacobson <jidanni@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Stefan Kangas <stefankangas@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 71078 <at> debbugs.gnu.org:


Received: (at 71078) by debbugs.gnu.org; 21 May 2024 15:31:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 21 11:31:27 2024
Received: from localhost ([127.0.0.1]:49683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s9RSZ-0008Jx-0L
	for submit <at> debbugs.gnu.org; Tue, 21 May 2024 11:31:27 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32378)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1s9RSW-0008JR-2k
 for 71078 <at> debbugs.gnu.org; Tue, 21 May 2024 11:31:25 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 953EC444185;
 Tue, 21 May 2024 11:31:12 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1716305471;
 bh=SMF2VtOHqJ2qDm6wvCo3Ff3cBNPPP07g+FWLyYgSZf0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Qlm2Xf7n+eEnqbgNuGHc8r2P4niYE5jrwSZe9iopJeeIBNIh+GLajbfwOOjddMgwj
 IZ8DqRE41DLhIc4OSfI/d0F7PL75iIDUS2QgE5n2yexL+iUnPjGYRpkgOHL7HyonJt
 XtbLxjipvHVzjQ1WU6Ee59Ix6E95p2NxttlXIy34DHOuUil1ll3HhYSqPmTR+bcZhk
 AnGTz/iFVr3oGyfCWBkGac8FUkfs6DRnTG1a1UQNeZa6D7EOPicHFFu/dFId/hj08G
 OxvEJ2LdKQNbHtp7d7EXRnG3++NtCiiYz5+QJN+CbFTwaR8MCTLAdarfhp+vQ7r6ie
 /7R40W+2i/qfQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1E504441FFC;
 Tue, 21 May 2024 11:31:11 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0CB0F12034F;
 Tue, 21 May 2024 11:31:11 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#71078: rgrep accepts wildcard, then throws it away
In-Reply-To: <CADwFkmkTe+ih9dPEfzHXSEbn4ep+J9p2GSgtxksQfA=d-phCQQ@HIDDEN>
 (Stefan Kangas's message of "Mon, 20 May 2024 17:26:08 +0000")
Message-ID: <jwvr0dv9oht.fsf-monnier+emacs@HIDDEN>
References: <877cfowvoa.5.fsf@HIDDEN>
 <CADwFkmkTe+ih9dPEfzHXSEbn4ep+J9p2GSgtxksQfA=d-phCQQ@HIDDEN>
Date: Tue, 21 May 2024 11:30:59 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.111 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71078
Cc: Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>,
 71078 <at> debbugs.gnu.org, Dan Jacobson <jidanni@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>     (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=E2=80=
=99s name.
>     Non-nil and non-t means also require confirmation after completion.
>
> I think "require existing directory=E2=80=99s name" should be clarified t=
o 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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71078; Package emacs. Full text available.

Message received at 71078 <at> debbugs.gnu.org:


Received: (at 71078) by debbugs.gnu.org; 20 May 2024 17:32:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 20 13:32:50 2024
Received: from localhost ([127.0.0.1]:43815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s96sU-0004r6-1N
	for submit <at> debbugs.gnu.org; Mon, 20 May 2024 13:32:50 -0400
Received: from mail-wr1-f52.google.com ([209.85.221.52]:61814)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1s96sS-0004r0-2n
 for 71078 <at> debbugs.gnu.org; Mon, 20 May 2024 13:32:49 -0400
Received: by mail-wr1-f52.google.com with SMTP id
 ffacd0b85a97d-354c5b7fafaso1344931f8f.3
 for <71078 <at> debbugs.gnu.org>; Mon, 20 May 2024 10:32:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1716226297; x=1716831097; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fGRajrfDIGcxwDDCOTcV+rbxmhW+xdxcsxL2s+X5mUU=;
 b=Q32Obpv+EpUe0xCAb4jJocIVdDcLy3OaY7pvspSG2DXY2Rz7e53XqYO6f/rKwLoDPP
 cE9rUq4Gzo0QSHVQHvTpu1//jzy9hgkRtzDvleHqT4fj556kOodBykG3Q/o6Nwgi/hYK
 NZeClqW4JCu6G4dbe8xAqXnL5d8xq1vce/mqJ4vglXh7r3QWahiVIRI6zDd/khKdyE2y
 Ihzwbn8YtvuEtrjhiWHqEqfbWerGyiHQmRp11NH5UNefsymMHXcqbRSttoA7SfeBzN/S
 j2Voj7HHEMdhsN9FUAYfxJljGnbpLLEs0cRE7l6K5PqkIvJmWMaQE5oc+2lp6RGVlIiJ
 Eo3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1716226297; x=1716831097;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=fGRajrfDIGcxwDDCOTcV+rbxmhW+xdxcsxL2s+X5mUU=;
 b=SBCdBMYrBKkrq2EFqPuGMId6dAVXljyT+69+MPsbLSTAHThE77ngRc4Q0yvndhfTsl
 +qLex7PS32j3JvwWuVDwOzFbzMXNF72LhKGArEIfPs2wYtHrL4KF8l3Vle3sCr0AvjyF
 uv69SUclDXhhX9wplJjXva6szvSvR2/OqNuX/37Oj3Ggfp4aHnJ1GUpPNfWmv9CdL+yj
 S81+8WuKWQVvn8MDVdPVG60HUd0aqEEJHLAo6Zz9+srfrDDNyDZqZoUrdZHq2AlB4RtU
 5ou3Em/relw/n3/aKp6FV99djrOtmFzCUeZ3ObM90STPTZ5MUwOcJVIe5LLaFlA3zKqk
 eJzg==
X-Forwarded-Encrypted: i=1;
 AJvYcCW5QBzkClc0xT1LnbponZOmannOx1ASkbX8vFTwH8n4hjH7l3h+HapWpSGUU77ToGmmXP/bDS6qRc146g2MRjU7VI/W8hY=
X-Gm-Message-State: AOJu0YzllrEomX6dRwf7jg77bvN3QIwv4nszSaf3Zr7OJTmpEbIiIzrZ
 EekXvre13VRa9hYnaG5Bqbico2UFGHThtbwgckW9QPwsxSwe+CoGb7utKA5ba72rxexaKzE3J59
 5VdZmqA72ysdthSs9vDpHT59KmD+dM1M1
X-Google-Smtp-Source: AGHT+IFkH5Ag4EHMaMsttpuzzMS5IPajXRoYv3E7hq4XuBMkCeS8jRG0GiRfzcMH4+25ibq4/OaMOFDptdG3MbI1y3o=
X-Received: by 2002:a50:99d0:0:b0:572:3fe4:18b5 with SMTP id
 4fb4d7f45d1cf-576f5c0969dmr2597475a12.32.1716225968663; Mon, 20 May 2024
 10:26:08 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 20 May 2024 17:26:08 +0000
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <877cfowvoa.5.fsf@HIDDEN>
References: <877cfowvoa.5.fsf@HIDDEN>
MIME-Version: 1.0
Date: Mon, 20 May 2024 17:26:08 +0000
Message-ID: <CADwFkmkTe+ih9dPEfzHXSEbn4ep+J9p2GSgtxksQfA=d-phCQQ@HIDDEN>
Subject: Re: bug#71078: rgrep accepts wildcard, then throws it away
To: Dan Jacobson <jidanni@HIDDEN>, 71078 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 71078
Cc: Eli Zaretskii <eliz@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Dan Jacobson <jidanni@HIDDEN> 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 gav=
e
> 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=E2=80=99s=
 name.
    Non-nil and non-t means also require confirmation after completion.

I think "require existing directory=E2=80=99s 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@HIDDEN:
bug#71078; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 May 2024 11:49:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 20 07:49:13 2024
Received: from localhost ([127.0.0.1]:42245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s91Vx-0003go-BW
	for submit <at> debbugs.gnu.org; Mon, 20 May 2024 07:49:13 -0400
Received: from lists.gnu.org ([209.51.188.17]:35782)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jidanni@HIDDEN>) id 1s91Vt-0003gi-2S
 for submit <at> debbugs.gnu.org; Mon, 20 May 2024 07:49:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jidanni@HIDDEN>)
 id 1s91Vn-0004WG-Bf
 for bug-gnu-emacs@HIDDEN; Mon, 20 May 2024 07:49:03 -0400
Received: from poodle.tulip.relay.mailchannels.net ([23.83.218.249])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jidanni@HIDDEN>)
 id 1s91Vl-0007Y0-L6
 for bug-gnu-emacs@HIDDEN; Mon, 20 May 2024 07:49:03 -0400
X-Sender-Id: dreamhost|x-authsender|jidanni@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id B4DB0940FB5
 for <bug-gnu-emacs@HIDDEN>; Mon, 20 May 2024 11:48:57 +0000 (UTC)
Received: from pdx1-sub0-mail-a235.dreamhost.com (unknown [127.0.0.6])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 594AF9424FC
 for <bug-gnu-emacs@HIDDEN>; Mon, 20 May 2024 11:48:57 +0000 (UTC)
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1716205737; a=rsa-sha256;
 cv=none;
 b=Fw3jYukF8orIIDEltBgEZ/XnKW15HWfDHh3Lp3rylyhb3XTm2X0rNDnq+Der8hn2Ygjze3
 3PW17+Ik/B61+Wt0Kj8O5Ema0njBRv2HgSo34k3QGC4TAumIKDyPdkaDahtZl/eVsuUwHL
 J1qkFo6hNci7p/hVK7tWZC6BYzxgnGcSuROPvFqkuU/7FKbae1Elr0dxxjJHV/wyQbi0Wc
 o9Lsxykn9kziUKFB82Z6M40ab++NA8xe9Ue1Lqwrw09m7wTthK2y6OOv6BKCfSyUhS2pqM
 yd4WihnboNGEiOfu3j7EmRDnOCWH+P6r987c+95BG9rG1+M+Bcc65xsIqOvlQA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1716205737;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 dkim-signature; bh=MVDrDiqS9FN2KBBVFW5zlK9odCQXR1I7yaa/UglA6uM=;
 b=WAypORI+FS0+GXEiowezNpUtAHaMmO2dhb2a3KEcLhd3M5vmOVt8kE2AS3KtU409e8GOzJ
 eJFr2CIisgJ2k3TKWx3YDL8gX/2hy3odKGJo7ctpOSZK0lLKLjW0xdcyTF2DDAKAhMf1HA
 pa54DgiMgb/ucocjWM3CuNxm0lJognaYrgzCY5f/+H47PfXUEwmz9qINWAUml1iYF5Isyn
 7FZy/XdbWMYQMafsdlHfb0Zz+5vxrDgJ4CJF48346rRcqzNkRuGsNV/LS69zpc07ZFmbsa
 /r0NrbHwdDGmPAAKhwVHzyWAlnWWMcoumy3Or2+dNR9ZKjuBgC3GpRQLJBQlug==
ARC-Authentication-Results: i=1; rspamd-5d55749bb4-pwdvj;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=jidanni@HIDDEN
X-Sender-Id: dreamhost|x-authsender|jidanni@HIDDEN
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jidanni@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Spot-Decisive: 6703ce30201239d4_1716205737580_1764310000
X-MC-Loop-Signature: 1716205737579:3673119419
X-MC-Ingress-Time: 1716205737579
Received: from pdx1-sub0-mail-a235.dreamhost.com (pop.dreamhost.com
 [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384)
 by 100.97.253.158 (trex/6.9.2); Mon, 20 May 2024 11:48:57 +0000
Received: from jidanni.org (1-165-194-175.dynamic-ip.hinet.net [1.165.194.175])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 (Authenticated sender: jidanni@HIDDEN)
 by pdx1-sub0-mail-a235.dreamhost.com (Postfix) with ESMTPSA id 4VjbST1j0ZzLZ
 for <bug-gnu-emacs@HIDDEN>; Mon, 20 May 2024 04:48:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jidanni.org;
 s=dreamhost; t=1716205737;
 bh=MVDrDiqS9FN2KBBVFW5zlK9odCQXR1I7yaa/UglA6uM=;
 h=From:To:Subject:Date:Content-Type;
 b=ppprpteqOLwvzWSA+oEfltH503TE2s8ikhhPDA8dtaIt4oFhoJlnH86rnzaRHgGct
 6oealRi+VmbIsVq4HkNKyxGekK01epuJPO78Sx89x+qUBGtmuS57/h7oiIyr+0142m
 HXZaa8NUYxlMsdygBbDp5D5BegX1Sic8NlYDjGnVhUQb7uo5zh/V28RH87pjDnvw06
 lh7yxMkFwpEnAgX0n6NrerISiOh4xEltgzdyLs7E/7gXj+Jz+JaDp7eoera7pVS1DG
 mUeq3olWfz8h/p93GtVU0JKBQyXFfu/Kch5XfQDwz+wYALia3DeNL/J12dU5bRtE/3
 bHH9olRWz1ReA==
Received: from jidanni by jidanni.org with local (Exim 4.97)
 (envelope-from <jidanni@HIDDEN>) id 1s91Ve-000000003uC-2lfk
 for bug-gnu-emacs@HIDDEN; Mon, 20 May 2024 19:48:54 +0800
From: Dan Jacobson <jidanni@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: rgrep accepts wildcard, then throws it away
Date: Mon, 20 May 2024 19:48:53 +0800
Message-ID: <877cfowvoa.5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=23.83.218.249; envelope-from=jidanni@HIDDEN;
 helo=poodle.tulip.relay.mailchannels.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

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"




Acknowledgement sent to Dan Jacobson <jidanni@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#71078; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 1 Mar 2025 02:30:02 UTC

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