From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#71078: rgrep accepts wildcard, then throws it away Date: Mon, 20 May 2024 17:26:08 +0000 Message-ID: References: <877cfowvoa.5.fsf@jidanni.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5258"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier To: Dan Jacobson , 71078@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 20 19:33:23 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s96sz-00018b-Ur for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 May 2024 19:33:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s96sh-00079Q-Og; Mon, 20 May 2024 13:33:03 -0400 Original-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 ) id 1s96sd-00077Y-Ba for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 13:32:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s96sc-0000rm-4e for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 13:32:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s96sg-0004rM-CE for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 13:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 May 2024 17:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71078 X-GNU-PR-Package: emacs Original-Received: via spool by 71078-submit@debbugs.gnu.org id=B71078.171622637018672 (code B ref 71078); Mon, 20 May 2024 17:33:02 +0000 Original-Received: (at 71078) by debbugs.gnu.org; 20 May 2024 17:32:50 +0000 Original-Received: from localhost ([127.0.0.1]:43815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s96sU-0004r6-1N for submit@debbugs.gnu.org; Mon, 20 May 2024 13:32:50 -0400 Original-Received: from mail-wr1-f52.google.com ([209.85.221.52]:61814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s96sS-0004r0-2n for 71078@debbugs.gnu.org; Mon, 20 May 2024 13:32:49 -0400 Original-Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-354c5b7fafaso1344931f8f.3 for <71078@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) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 20 May 2024 17:26:08 +0000 In-Reply-To: <877cfowvoa.5.fsf@jidanni.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285486 Archived-At: Dan Jacobson 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.