From unknown Thu Jun 19 14:19:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#68864 <68864@debbugs.gnu.org> To: bug#68864 <68864@debbugs.gnu.org> Subject: Status: 30.0.50; project-find-regexp fails on Alpine Reply-To: bug#68864 <68864@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:19:48 +0000 retitle 68864 30.0.50; project-find-regexp fails on Alpine reassign 68864 emacs submitter 68864 john muhl severity 68864 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 31 22:38:53 2024 Received: (at submit) by debbugs.gnu.org; 1 Feb 2024 03:38:53 +0000 Received: from localhost ([127.0.0.1]:39439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVNue-0000Is-M1 for submit@debbugs.gnu.org; Wed, 31 Jan 2024 22:38:53 -0500 Received: from lists.gnu.org ([2001:470:142::17]:55630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVNuc-0000If-NB for submit@debbugs.gnu.org; Wed, 31 Jan 2024 22:38:51 -0500 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 1rVNuM-0000PA-Rp for bug-gnu-emacs@gnu.org; Wed, 31 Jan 2024 22:38:35 -0500 Received: from out-175.mta1.migadu.com ([2001:41d0:203:375::af]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVNuK-00082V-Ja for bug-gnu-emacs@gnu.org; Wed, 31 Jan 2024 22:38:34 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; s=key1; t=1706758706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=4Ngjqz/IONjLltnZ0bEwPRBg2W73JGNi1l53EQPVblE=; b=TxhpcUoazDDBZetW9T48tIlvS7tOMkEAsWwFheRBEIJbEVrU85YiAlu6A0dM+7/2dYYehZ 8rUd4M4ox98yX5kWl2tuJDepQ5xsexinVPSE0DeEnBPuPLoAjZNBe2nGYHgR66jI1EbpYD G++6GFiztXIUDPsXSHjOi4x7LG1lSkI= From: john muhl To: bug-gnu-emacs@gnu.org Subject: 30.0.50; project-find-regexp fails on Alpine Date: Wed, 31 Jan 2024 21:38:22 -0600 Message-ID: <87eddw3lch.fsf@pub.pink> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:203:375::af; envelope-from=jm@pub.pink; helo=out-175.mta1.migadu.com 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) 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")) user-error("Search failed with status %d: %s" 123 "grep: unrecognized option: null") xref-matches-in-files("test" ("/home/build/emacs/.clang-format" ...)) project--find-regexp-in-files("test" ("/home/build/emacs/.clang-format" ...)) apply(project--find-regexp-in-files ("test" ("/home/build/emacs/.clang-format" ...)) #f(compiled-function (&rest args2) #)() xref--show-xref-buffer(#f(compiled-function (&rest args2) #) ((window . #) (display-action) (auto-jump))) xref--show-xrefs(#f(compiled-function (&rest args2) #) nil) xref-show-xrefs(#f(compiled-function (&rest args2) #) nil) project-find-regexp("test") eval((project-find-regexp "test") t) #f(compiled-function () #)() #f(compiled-function () #)() handler-bind-1(#f(compiled-function () #) (error) eval-expression--debug) eval-expression((project-find-regexp "test") nil nil 127) funcall-interactively(eval-expression (project-find-regexp "test") nil nil 127) call-interactively(eval-expression nil nil) command-execute(eval-expression) In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-musl) of 2024-02-01 built on build Repository revision: cd2c45a3890601e1bc498c81e64791fead6efc86 Repository branch: master System Description: Alpine Linux edge Configured using: 'configure --without-all --without-x' Configured features: GMP PDUMPER Important settings: value of $LC_COLLATE: C value of $LANG: C.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dnd dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-fns radix-tree cl-print debug backtrace help-mode find-func files-x vc-git diff-mode easy-mmode vc-dispatcher cl-seq grep compile text-property-search comint regexp-opt ansi-osc ansi-color tool-bar xref ring project cl-loaddefs cl-lib term/tmux term/xterm xterm byte-opt gv bytecomp byte-compile rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote multi-tty make-network-process emacs) Memory information: ((conses 16 85101 9311) (symbols 48 7887 0) (strings 32 28128 1973) (string-bytes 1 941684) (vectors 16 11619) (vector-slots 8 103879 5456) (floats 8 34 13825) (intervals 56 1202 24) (buffers 976 14)) From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 05:04:44 2024 Received: (at 68864) by debbugs.gnu.org; 1 Feb 2024 10:04:44 +0000 Received: from localhost ([127.0.0.1]:40259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVTw4-0005Lu-1K for submit@debbugs.gnu.org; Thu, 01 Feb 2024 05:04:44 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVTw0-0005Lb-Fa for 68864@debbugs.gnu.org; Thu, 01 Feb 2024 05:04:42 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 046BE5C015B; Thu, 1 Feb 2024 05:04:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 01 Feb 2024 05:04:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1706781865; x=1706868265; bh=zAxQMubAPRQMV/o/14L8XVdcnI38NNSQp+6fQL/gPm4=; b= GW/ABrfB8o8DMiCDT4oK1JrxfqIhcCDDj2hYdeTMrh2AMVJPHgmhQgKp5qw9H/7J KZzS64rHsUFvlPHf9uoOQ1H6F/pTlf9sYY+OTiZPJwCHt+CaqSPkE+X+vVCrbcgZ NEeKaO0HDmdvF9+i9gLLJa7n+/aKIhzWBg4gfq0Ub/bNAtg8P0D/DDV7BgE/mmxq wGStHxD2MnNvlEZBz2pXruT0cXVYrfVQBU6R+lq0T3VZCzlAHgQqFOeHijUGTl0O PLXCpIz1CudMC8KY3poPYfPmyEfM6QD/ukmHym4KUYne025Xme/a183QbITNPWbD iR1ndh6fbu8/nnlvtQp3Yw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706781865; x= 1706868265; bh=zAxQMubAPRQMV/o/14L8XVdcnI38NNSQp+6fQL/gPm4=; b=k sSyZeYctZi32KuDZgu89ka9OK9mTX7maDunNdmsgvv10VWKcisBp9JSFf4CBJ+yF rkEas4+ZkfkANXMRgoJCZJY3x1MBtwLBuviBq3OSmYi3jOcUk15elbljIDXXETkB b4hZfRH8W1bY3987Xq5+k9w0n3RfA5T4lo8AJ3t/NEa791b8IumFcgFnsH/XU8XR VnHkp4s8DCHScYUHlqI5MIYHnXYZ8PZTTCobCH6oaCCyNaUD1IIukpwDhFijVIxH LFgC5RCUD4jyY48QK8a80akJzDFMtBw9yw6/hb6rUso0g1TaOW2MuUMW5Fe0IDAn VpkmMf2WTOrMe2laUk0tg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfeduuddguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeegheekgeeuteeugffggfefffetkeevteevtedugfdtffethfdtjedvtdfgfeev geenucffohhmrghinhepsghogihmrghtrhhigidrihhnfhhopdhophgvnhgsshgurdhorh hgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughm ihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Feb 2024 05:04:23 -0500 (EST) Message-ID: <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> Date: Thu, 1 Feb 2024 12:04:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#68864: 30.0.50; project-find-regexp fails on Alpine Content-Language: en-US To: john muhl , 68864@debbugs.gnu.org References: <87eddw3lch.fsf@pub.pink> From: Dmitry Gutov In-Reply-To: <87eddw3lch.fsf@pub.pink> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 68864 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 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. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 14:22:59 2024 Received: (at 68864) by debbugs.gnu.org; 1 Feb 2024 19:22:59 +0000 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 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 References: <87eddw3lch.fsf@pub.pink> <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> 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. From: john muhl To: Dmitry Gutov Subject: Re: bug#68864: 30.0.50; project-find-regexp fails on Alpine Date: Thu, 01 Feb 2024 11:13:56 -0600 In-reply-to: <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> Message-ID: <87o7d0vvk8.fsf@pub.pink> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 68864 Cc: 68864@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) 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). From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 15:55:24 2024 Received: (at 68864) by debbugs.gnu.org; 1 Feb 2024 20:55:24 +0000 Received: from localhost ([127.0.0.1]:43220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVe5j-0002vq-OT for submit@debbugs.gnu.org; Thu, 01 Feb 2024 15:55:24 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:44939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVe5b-0002vB-C2 for 68864@debbugs.gnu.org; Thu, 01 Feb 2024 15:55:22 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id CE6D23200AC1; Thu, 1 Feb 2024 15:54:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 01 Feb 2024 15:54:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1706820896; x=1706907296; bh=hNey51hfmTn8TpKfOK7twkjNiYY6deQBrWxycs0yL4U=; b= ObFKq/dmy29FY7c/mT/MHfTzvKeEoAZV6aLlzn6pbUyyDLYe/ZT7DcjZE0nGLv1G +JddScb2v5z4XRqV/vIZC/MBwoUEmHAYt/iqTuwQqMWLURlChgZAHGPMxboKvKM2 23cmXeOaJetp3udQtxFnYasOzQV80ueNUF/FjUrUM3BBaACmASpeRYyMLDmEEek/ eao+PwVv368c4vClk3GqBqk3vnYCaHj3WUwK1wixJ2yPBhxZK+Uv21tQkQeSTTkX WZnHBOmgVw478o0pfPiVdIEUmaYvUvba74M5Mq6oIWjIEo9UETiRBYZz39ZMlEPc TfVI/pZoc4lYkTYbmDSujw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706820896; x= 1706907296; bh=hNey51hfmTn8TpKfOK7twkjNiYY6deQBrWxycs0yL4U=; b=P vDni73o4lLxsDr5H0nGkUPGh4k2ZEgggqO3x1J0No7ivi21kC6j/i7J1eFXBBdlW 31TRAfjb4TN7FztjcQHJ1caWvT3z6wSxf8bnw142JfJJ7iuXbXd8wehekbo9kt8b jABlTbObVgiABYkIS8puBr9BvyPG/G4dSBgt1l6pEzmoGeIoLO5U6bJzSBYkx2S0 rXLnXtqtjFu5xhMrg4vABAIzPw4brmqq53RgcX/lOdm+zuVL6rV6s4QvQOhe+1nj IPnodme8qyHg+PDUMa+TNYcBaYhHASrblkBQZfi8dgaraq8f13vs9oVpRBATnoUM CdaJO8D3cCG0mjDmjyIiA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfeduuddgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpeeigfehjefhheekgfehtdeljeeiveefteegveekuefgvdeivdejveefgfdu vdfhieenucffohhmrghinhepsghogihmrghtrhhigidrihhnfhhopdhophgvnhgsshgurd horhhgpdgsuhhshigsohigrdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Feb 2024 15:54:54 -0500 (EST) Message-ID: Date: Thu, 1 Feb 2024 22:54:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#68864: 30.0.50; project-find-regexp fails on Alpine Content-Language: en-US To: john muhl References: <87eddw3lch.fsf@pub.pink> <74014cf8-3299-44ad-85bd-e9f9981c66e7@gutov.dev> <87o7d0vvk8.fsf@pub.pink> From: Dmitry Gutov In-Reply-To: <87o7d0vvk8.fsf@pub.pink> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 68864 Cc: 68864@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 01/02/2024 19:13, john muhl wrote: > 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] … > > https://git.busybox.net/busybox/tree/findutils/grep.c#n85 That's... unexpected. > I couldn’t get busybox to compile with the EXTRA_COMPAT option > so can’t 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). That would slow down the loading of xref.el, which seems unfortunate, even if it's only by 0.05s (just measured on my machine; on many others it will be more). What we could do, I suppose, is check whether grep-use-null-filename-separator is set to some explicit value (not 'auto-detect'), and if so, apply it. That would work if xref.el is loaded late, or if you customized the variable explicitly. I was also thinking of adding another template parameter like , but it would be used for 'grep'--would seem odd. We also could just remove "--null" inside xref-matches-in-files from grep's command line if the variable is set to this or that. It would be unfortunate to encounter some false positives, though (though I can't imagine them now).