Subject: bug#75379: 30.0.93; project-find-regexp expects "C" or "en" locale

From: Dmitry Gutov <[email-masked]>
Date: Mon, 6 Jan 2025 22:33:21 +0200

On 06/01/2025 19:36, Juri Linkov wrote:
> Indeed, "Binary file matches" is a very important message that
> helps not to miss any matches in a text file that happens
> to accidentally contain a NUL byte.  This saved me many times
> while using rgrep.  'project-find-regexp' could do the same,
> and show the same messages in the*xref* output buffer.
> 
> So to not mess with translations, a simpler solution would be
> just to copy all unhandled messages from grep/ripgrep output
> to the xref buffer as is.

Good point, maybe we could show different messages this way.

But I think what I was trying to do there is distinguish between Grep 
succeeding and ending up with an error (which we should report with 
user-error), and the process exit status wasn't enough for that.

Indeed, here's a command to try:

   git ls-files -z | xargs -0 grep gtags

In the Emacs repository (among others) it exits with the status 123, 
apparently one or more of the Grep sub-invocations ended up with 
non-zero status (likely 1, indicating "no matches"). Even though the 
combined search finds a bunch of results, that doesn't change xargs's 
exit status. And we can't special-case the status 123 because "if any 
invocation of the command exited with status 1-125" covers both Grep 
calls that found nothing and Grep calls which were done with 
unrecognized flags (Grep exit status 2, IIUC).

Also, when we know the format of come messages we can parse the file 
name out of them  and create a button in the output buffer. Simply 
copying any unhandled messages removes that possibility.