Subject: bug#69718: 29.2; grep japanese-iso-8bit-unix string fails with "grep: illegal byte sequence"

From: Akira Shirai <[email-masked]>
Date: Wed, 13 Mar 2024 00:42:22 +0900

On japanese-iso-8bit-unix (= eucJP), この辞書は is 0xa4b3 0xa4ce 0xbcad 0xbdf1 0xa4cf,
and 0xa4b3 0xa4ce 0xbcad 0xbdf1 0xa4cf is illegal byte sequence on UTF-8.

On UTF-8 mode, macOS grep signals "grep: illegal byte sequence" error for the byte sequence,
but LANG=C mode or LANG is not specified, macOS grep accepts the byte sequence.
| % cd ~/emacs-29.2/leim/SKK-DIC
| 
| % LANG=en_US.UTF-8 grep --color=auto -nH --null -e `echo この辞書は | iconv -f utf-8 -t eucJP` SKK-JISYO.L | iconv -f eucJP -t utf-8
| grep: illegal byte sequence
| 
| % LANG=C           grep --color=auto -nH --null -e `echo この辞書は | iconv -f utf-8 -t eucJP` SKK-JISYO.L | iconv -f eucJP -t utf-8
| SKK-JISYO.L35:;; この辞書は、SKK 原作者の佐藤雅彦先生が、第 1 版作成のために東北大学
|  
| % LANG=            grep --color=auto -nH --null -e `echo この辞書は | iconv -f utf-8 -t eucJP` SKK-JISYO.L | iconv -f eucJP -t utf-8
| SKK-JISYO.L35:;; この辞書は、SKK 原作者の佐藤雅彦先生が、第 1 版作成のために東北大学

emacs-29.1 executes /usr/bin/grep without LANG,
but emacs-29.2 seems to execute /usr/bin/grep with LANG=en_US.UTF-8.

I wonder /usr/bin/grep should be invoked in non UTF-8 mode, because emacs might pass non UTF-8 byte sequence to /usr/bin/grep.

> 2024/03/11 22:15、Eli Zaretskii <[email-masked]>のメール:
> 
>> Cc: [email-masked]
>> Date: Mon, 11 Mar 2024 14:50:31 +0200
>> From: Eli Zaretskii <[email-masked]>
>> 
>> We made a change in msterm.m between Emacs 29.1 and Emacs 29.2, which
>                      ^^^^^^^^
> Sorry, that was supposed to be nsterm.m.