GNU bug report logs - #75379
30.0.93; project-find-regexp expects "C" or "en" locale

Previous Next

Package: emacs;

Reported by: Matthias Meulien <orontee <at> gmail.com>

Date: Sun, 5 Jan 2025 10:36:01 UTC

Severity: normal

Found in version 30.0.93

Full log


Message #8 received at 75379 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Matthias Meulien <orontee <at> gmail.com>, 75379 <at> debbugs.gnu.org
Subject: Re: bug#75379: 30.0.93; project-find-regexp expects "C" or "en" locale
Date: Sun, 5 Jan 2025 20:03:34 +0200
Hi!

On 05/01/2025 12:35, Matthias Meulien wrote:
> 1. Make sure you have a Git repository with binary files containing say
>    the "copyright" word; One can clone
> https://github.com/orontee/lesmotsdugene/ <https://github.com/orontee/ 
> lesmotsdugene/> for example.
> 
> 2. Start Emacs using a locale different from "C" or other English based
> locales, for example "fr_FR.UTF8":
> 
>     LANG=fr_FR.UTF8 emacs -Q
> 
> 3. Then call `project-find-regexp' in the the Git repository identified
>    in step 1, and search for the word "copyright"; There's no results but
>    the following error message:
> 
>    xref-matches-in-files: Search failed with status 0: grep: content/ 
> images/planche_1.png : fichiers binaires correspondent
> 
> If Emacs is started with "C" locale, then there are results!

Thanks for the detailed report.

> The problem comes from `xref-matches-in-files', precisely this block
> where `grep' output has been hardcoded even if depending on the locale:
> 
>    (when (and (/= (point-min) (point-max))
>                     (not (looking-at grep-re))
>                     ;; TODO: Show these matches as well somehow?
>                     ;; Matching both Grep's and Ripgrep 13's messages.
>                     (not (looking-at ".*[bB]inary file.* matches")))
>            (user-error "Search failed with status %d: %s" status
>                        (buffer-substring (point-min) (line-end-position))))
> 
> As quick fix one cas use:
> 
> (map-do (lambda (key val)
>   (map-put xref-search-program-alist
>    key (concat "LANG=C " val)))
> xref-search-program-alist)

Overriding the language seems indeed the way to go here.

About using LANG specifically, any chance that it might interfere with 
the system's configured encoding, e.g. UTF-8 vs other? In your example, 
does searching for accented characters work as well?

IIUC we can try LC_MESSAGES as the more specialized var. Does 
LC_MESSAGES=en work as well?




This bug report was last modified 160 days ago.

Previous Next


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