From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68864: 30.0.50; project-find-regexp fails on Alpine Date: Thu, 01 Feb 2024 11:13:56 -0600 Message-ID: <87o7d0vvk8.fsf@pub.pink> References: <87eddw3lch.fsf@pub.pink> <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> Reply-To: john muhl 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="34287"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68864@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 01 20:23:16 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 1rVcea-0008j0-6R for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Feb 2024 20:23:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVceI-000140-MQ; Thu, 01 Feb 2024 14:23:02 -0500 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 1rVceC-00011k-A9 for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2024 14:22:53 -0500 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 1rVceB-0000hM-UX for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2024 14:22:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rVceL-0000NF-SY for bug-gnu-emacs@gnu.org; Thu, 01 Feb 2024 14:23:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Feb 2024 19:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68864 X-GNU-PR-Package: emacs Original-Received: via spool by 68864-submit@debbugs.gnu.org id=B68864.17068153791429 (code B ref 68864); Thu, 01 Feb 2024 19:23:01 +0000 Original-Received: (at 68864) by debbugs.gnu.org; 1 Feb 2024 19:22:59 +0000 Original-Received: from localhost ([127.0.0.1]:43161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVceI-0000My-Sm for submit@debbugs.gnu.org; Thu, 01 Feb 2024 14:22:59 -0500 Original-Received: from out-170.mta0.migadu.com ([91.218.175.170]:47027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVceC-0000Mc-VQ for 68864@debbugs.gnu.org; Thu, 01 Feb 2024 14:22:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; s=key1; t=1706815356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G31u68W9EnsjRhq7OhZ+t59d7YvGHpNcp6Q3rj3nku4=; b=XvZ7h8U2IkqHQZKzaYZN+FWXS0WLGSCHcYKTuhyiLEFleUsODp9qWmVCch4HVSjjUP+q0y lUDCaF0GwakzHo9032/8PY9fQQP0WU6kCk0gap7Fh2TgVvxLz0bzFgb8HS+LyIQDsRDoQv 5OLl5F4kMSUEK7WxQqN4TV5e3X/Yv24= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> X-Migadu-Flow: FLOW_OUT 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:279304 Archived-At: Dmitry Gutov writes: > On 01/02/2024 05:38, john muhl via Bug reports for GNU Emacs, the > Swiss army knife of text editors wrote: >> The grep on Alpine does not support the --null option. >> $ grep --null test * >> grep: unrecognized option: null >> BusyBox v1.36.1 (2024-01-16 17:10:30 UTC) multi-call binary. >> To reproduce: >> emacs -Q >> M-: (project-find-regexp "test") >> Debugger entered--Lisp error: (user-error "Search failed with status >> 123: grep: unrecognized option: null") >> signal(user-error ("Search failed with status 123: grep: unrecognized= option: null")) > > Hi! > > That's a problem: apparently it does indeed not support --null or -Z: > https://boxmatrix.info/wiki/Property:grep > > There is another flag we could use, which seems to have a similar > enough effect: -z. But from what I can tell, it would make OpenBSD > unsupported: https://man.openbsd.org/grep Even -z is a compile time option: $ busybox grep -h BusyBox v1.36.1 (2024-01-16 17:10:30 UTC) multi-call binary. Usage: grep [-HhnlLoqvsrRiwFE] [-m N] [-A|B|C N] =E2=80=A6 https://git.busybox.net/busybox/tree/findutils/grep.c#n85 I couldn=E2=80=99t get busybox to compile with the EXTRA_COMPAT option so can=E2=80=99t say if it helps or not. > Perhaps it would be best to just file a feature request for busybox's > support for --null/-Z. Better ideas welcome. > > In the meantime, you can customize the entry for 'grep' in > xref-search-program-alist to use -z. Would it be possible to have xref check grep-use-null-filename-separator and only use --null when available? I tried with this crude patch and the results look good enough: --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1855,7 +1855,11 @@ xref-search-program-alist `((grep . ;; '-s' because 'git ls-files' can output broken symlinks. - ,(concat "xargs -0 " xargs-max-chars "grep --null -snHE -e ")) + ,(concat "xargs -0 " xargs-max-chars "grep " + (when (and (grep-compute-defaults) + grep-use-null-filename-separator) + " --null") + " -snHE -e ")) (ripgrep . ;; '!*/' is there to filter out dirs (e.g. submodules).