Re: problem with ls, not show a correct list

From: Nilton José Rizzo <rizzo_at_i805.com.br>
Date: Sun, 09 Apr 2017 13:31:48 -0300
Em 2017-04-09 00:26, Andrey Chernov escreveu:
> On 07.04.2017 23:20, Nilton José Rizzo wrote:
>> Em 2017-04-07 05:51, Toomas Soome escreveu:
>>>> On 7. apr 2017, at 11:29, Andrey Chernov <ache_at_freebsd.org> wrote:
>>>> 
>>>>>  Hi Allan, the ls show all files without case match
>>>>> 
>>>>> ls [a-z]*
>>>>> 
>>>>> show all files beginning with a and A  like this [aA-zZ]*
>>>> 
>>>> No, last "Z" is not included.
>> 
>> 
>>    Look this, it's a great error!!!!
> 
> I see no error. You do not include Z into [a-z] expression above, so 
> why
> you expect it is unknown.
> 
>> I lower- equal a upper-case why Z not show in this list?
> 
> No, it is not case-equal sorting. As I already mention, it is
> dictionaries sorting, letters considered first, their case - next (and
> maybe many other factors for non-ASCII - next).
> 
>> image when a admin use like thinks some rm -rf /*/[A-Z]*
> 
> Admin should either run C or US-ASCII locale or do not use a-z ranges
> without knowing sorting on his locale.
> 
> I see no errors in your sh examples.

    try this

         ls [a-b,k-m]

    in sh using the locale setting to pt_BR.UTF-8

      it's not work


# locale
LANG=pt_BR.UTF-8
LC_CTYPE="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_ALL=
# ls [[:lower:]][a-c,k-m]*
aa
# ls
a       b       d       f       j       m       p       t       x
A       B       D       g       k       M       q       u       y
aa      c       e       h       K       n       r       v       z
Aa      C       E       i       l       o       s       w       Z
#


     It's not show the correct list, this commant MUST BE SHOW like a C 
locale



# locale
LANG=C
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
# ls [a-c,k-m]*
a       aa      b       c       k       l       m
# ls [[:lower:]][a-c,k-m]*
aa
#

   When I try to use the poor workaround [[:lower:]] or [[:upper:]]
this have too different behavior.  The list replacement not work 
properly


    Note, I know that Unicode have some differents, but when tha basic 
list replacement
and other basic default behavior must be preserved.



> 
> In general it was decided (not by me) to use CLDR collation since it is
> able to stable sort all Unicode chars.
> 

   It's a great problema yes!, the default shell in FreeBSD to user root
in fresh new installation is csh, look the passwd file

root:*:0:0::0:0:Charlie &:/root:/bin/csh

    and it's will be great problem because all man pages with
trate a list substitution not say anything about this.



> 
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to 
> "freebsd-current-unsubscribe_at_freebsd.org"

-- 
********************************************************
* Nilton José Rizzo     Sistema de Informação    UFRRJ *
* http://cursos.ufrrj.br/grad/sistemas/                *
* lattes:http://lattes.cnpq.br/0079460703536198        *
********************************************************
Received on Sun Apr 09 2017 - 14:32:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:11 UTC