Why is not wildcards unfolded as expected if LANG is ja_JP.UTF-8

Hajimu UMEMOTO ume at mahoroba.org
Sun Jun 24 17:56:45 UTC 2018


Hi,

>>>>> On Mon, 25 Jun 2018 00:54:42 +0900 (JST)
>>>>> Masachika ISHIZUKA <ish at amail.plala.or.jp> said:

ish>   I can't expand wildcards as expected if I use 'setenv LANG ja_JP.UTF-8'.
ish>   For example,

It seems to me as expected behavior.

ish> % ls
ish> a  A  b  B  c  C  d  D  e  E
ish> % setenv LANG ja_JP.UTF-8
ish> % ls [b-d]
ish> b  B  c  C  d                           <=== It's not good.
ish> % env LANG=ja_JP.UTF-8 ls [b-d]
ish> b       B       c       C       d	<=== It's not good.
ish> % env LANG=C ls [b-d]
ish> B       C       b       c       d	<=== It's not good.

Since the expansion of '[]' is done by the shell (tcsh) itself,
setting LANG by env(1) doesn't have an influence on the expansion.

ish>   This happens on 12-current and 11.2-RC3. I'm using tcsh but the same
ish> when changed to bash.

It's because the recent FreeBSD supports collation.
If you don't like the behavior, you may want to set LC_COLLATE to C.

% echo $LANG
ja_JP.UTF-8
% ls
a A b B c C d D e E
% env LANG=ja_JP.UTF-8 tcsh -c "ls [b-d]"
b	B	c	C	d
% env LANG=C tcsh -c "ls [b-d]"
b	c	d
% env LANG=ja_JP.UTF-8 LC_COLLATE=C tcsh -c "ls [b-d]"
b	c	d

Sincerely,

--
Hajimu UMEMOTO
ume at mahoroba.org  ume at FreeBSD.org
http://www.mahoroba.org/~ume/


More information about the freebsd-hackers mailing list