Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Mar 2024 17:55:34 +0000
From:      =?UTF-8?Q?=CF=86__Dh=C3=A9nin_Jean-Jacques?= <dhenin@gmail.com>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        questions@freebsd.org
Subject:   Re: 'ls' name and 'ls | grep name' different
Message-ID:  <v1-338bYKl3g2M9RTCwW-72f45c9a14eeedcfac379e880024265b@gmail.com>
In-Reply-To: <50b7db9d-0829-4db2-9bc4-c8e84b54060b@FreeBSD.org>
References:  <CAL5CjnxBw2M-Zp=gSTNJyOZrDeeke9vQ0fzTNX5peJd33n2_xQ@mail.gmail.com> <CAHu1Y72GQMZd-xWtW2wvp6QFYcdAzj3nEbvwHySwGA8ZO%2BCVuA@mail.gmail.com> <50b7db9d-0829-4db2-9bc4-c8e84b54060b@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
----_NmP-a10823fa44109986-Part_1
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

et voila=C2=A0::; ls 1989*1989 Amn=C3=A9sia.mp4:; LANG=3Dfr_FR.UTF-8:; ls =
1989*1989
Amn??sia.mp4


Le=C2=A0sam. 9 mars 2024 =C3=A0=C2=A017:41, Kyle =
Evans <kevans@freebsd.org> a =C3=A9crit=C2=A0:
On 3/9/24 10:37, Michael =
Sierchio wrote:
>=20
>=20
> On Sat, Mar 9, 2024 at 11:19 AM =CF=86 =
Dh=C3=A9nin Jean-Jacques <dhenin@gmail.com =20
> <mailto:dhenin@gmail.com>>=
 wrote:
>=20
>=C2=A0 =C2=A0 =C2=A0Bonjour,
>=20
>=C2=A0 =C2=A0 =C2=A0I =
explain=C2=A0 it as simple as possible:
>=20
>=C2=A0 =C2=A0 =C2=A0:; =
=C2=A0set | egrep 'LC_A|LANG'
>=C2=A0 =C2=A0 =C2=A0GDM_LANG=3Dfr_FR.UTF-8
>=C2=A0 =C2=A0 =C2=A0LANG=3Dfr_FR.UTF-8
>=C2=A0 =C2=A0 =C2=A0LC_ALL=3Dfr_FR=
.UTF-8
>=C2=A0 =C2=A0 =C2=A0SLIM_LANG=3Dfr_FR.UTF-8
>=20
>=C2=A0 =C2=A0 =C2=A0:; =C2=A0ls -i =C2=A01989* ; ls -i | grep 1989 ; =
=C2=A0ls -ib =C2=A01989* ; ls -ib |
>=C2=A0 =C2=A0 =C2=A0grep 1989
>=C2=A0 =C2=A0 =C2=A09920 1989 Amn*??*sia.mp4
>=C2=A0 =C2=A0 =C2=A0 =
=C2=A09920 1989 Amn*=C3=A9*sia.mp4
>=C2=A0 =C2=A0 =C2=A09920 1989 =
Amn\303\251sia.mp4
>=C2=A0 =C2=A0 =C2=A0 =C2=A09920 1989 Amn\303\251sia.mp4
>=20
>=20
> Bonjour J-J =E2=80=93
>=20
> It's not that the pipe modifies =
the stream, it's that 'ls' has decided=20
> that 'e-accent-aigu' is =
unprintable in the current locale.
>=20
> Try ls -B and then investigate =
the locale.
>=20
> *-B*=C2=A0 =C2=A0 =C2=A0 =C2=A0Force=C2=A0 =
printing=C2=A0 =C2=A0 of=C2=A0 non-printable=C2=A0 characters=C2=A0 =
(as=C2=A0 defined by
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/ctype/(3)=C2=A0 <
https://man.freebsd.org/cgi/man.cgi?query=3Dctype&sektion=3D3&a
propos=3D0&manpath=3DFreeBSD+14.0-RELEASE+and+Ports>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 and current locale
settings) in file=C2=A0 names=C2=A0 as *\*/xxx/,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 where/xxx/=C2=A0 is =
the=C2=A0 =C2=A0 =C2=A0 =C2=A0numeric value of the character in
octal.=C2=A0 This
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 option =
is not defined in IEEE Std 1003.1-2008 ("POSIX.1")
>=20

ls(1) notably does toggle this behavior on by default only if stdout is=20
a tty requiring the above noted flag, and leaves it disabled if it's =
piping:

https://cgit.freebsd.org/src/tree/bin/ls/ls.c#n241

This gives grep the chance to just let it render.

Thanks,

Kyle Evans


--
---------------------------------------------------------=F0=9F=93=9E 06 89=
 66 51 35
(V)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Dh=C3=A9nin Jean-Jacques
( ..)=C2=A0=C2=A0=C2=A0=C2=A0 48, rue de la Justice 78300 Poissy
c(')(')=C2=A0 dhenin@gmail.com
--------------------------------------------=
-------------
----_NmP-a10823fa44109986-Part_1
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr" gmail_original=3D"1"><br></div><div =
gmail_original=3D"1">et voila=C2=A0:=C2=A0</div><div =
gmail_original=3D"1">:; ls 1989*<div>1989 Amn=C3=A9sia.mp4</div><div>:; =
LANG=3Dfr_FR.UTF-8</div><div>:; ls 1989*</div><div>1989 Amn??sia.=
mp4</div><div><br></div><div><br></div></div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">Le=C2=A0sam. 9 =
mars 2024 =C3=A0=C2=A017:41, Kyle Evans &lt;kevans@freebsd.org&gt; a =
=C3=A9crit=C2=A0:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">On 3/9/24 10:37, Michael Sierchio wrote:<br> &gt; =
<br> &gt; <br> &gt; On Sat, Mar 9, 2024 at 11:19 AM =CF=86 Dh=C3=A9nin =
Jean-Jacques &lt;<a href=3D"mailto:dhenin@gmail.com" =
target=3D"_blank">dhenin@gmail.com</a> <br> &gt; &lt;mailto:<a =
href=3D"mailto:dhenin@gmail.com" target=3D"_blank">dhenin@gmail.=
com</a>&gt;&gt; wrote:<br> &gt; <br> &gt;=C2=A0 =C2=A0 =C2=A0Bonjour,<br> =
&gt; <br> &gt;=C2=A0 =C2=A0 =C2=A0I explain=C2=A0 it as simple as =
possible:<br> &gt; <br> &gt;=C2=A0 =C2=A0 =C2=A0:; =C2=A0set | egrep =
'LC_A|LANG'<br> &gt;=C2=A0 =C2=A0 =C2=A0GDM_LANG=3Dfr_FR.UTF-8<br> =
&gt;=C2=A0 =C2=A0 =C2=A0LANG=3Dfr_FR.UTF-8<br> &gt;=C2=A0 =C2=A0 =
=C2=A0LC_ALL=3Dfr_FR.UTF-8<br> &gt;=C2=A0 =C2=A0 =C2=A0SLIM_LANG=3Dfr_FR.=
UTF-8<br> &gt; <br> &gt;=C2=A0 =C2=A0 =C2=A0:; =C2=A0ls -i =C2=A01989* ; ls=
 -i | grep 1989 ; =C2=A0ls -ib =C2=A01989* ; ls -ib |<br> &gt;=C2=A0 =C2=A0=
 =C2=A0grep 1989<br> &gt;=C2=A0 =C2=A0 =C2=A09920 1989 Amn*??*sia.mp4<br> =
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A09920 1989 Amn*=C3=A9*sia.mp4<br> &gt;=C2=A0 =
=C2=A0 =C2=A09920 1989 Amn\303\251sia.mp4<br> &gt;=C2=A0 =C2=A0 =C2=A0 =
=C2=A09920 1989 Amn\303\251sia.mp4<br> &gt; <br> &gt; <br> &gt; Bonjour J-J=
 =E2=80=93<br> &gt; <br> &gt; It's not that the pipe modifies the stream, =
it's that 'ls' has decided <br> &gt; that 'e-accent-aigu' is unprintable in=
 the current locale.<br> &gt; <br> &gt; Try ls -B and then investigate the =
locale.<br> &gt; <br> &gt; *-B*=C2=A0 =C2=A0 =C2=A0 =C2=A0Force=C2=A0 =
printing=C2=A0 =C2=A0 of=C2=A0 non-printable=C2=A0 characters=C2=A0 =
(as=C2=A0 defined by<br> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0/ctype/(3)=C2=A0 =
&lt;<a href=3D"https://man.freebsd.org/cgi/man.cgi?query=3Dctype&amp;sektio=
n=3D3&amp;apropos=3D0&amp;manpath=3DFreeBSD+14.0-RELEASE+and+Ports" =
rel=3D"noreferrer" target=3D"_blank">https://man.freebsd.org/cgi/m<wbr>an.=
cgi?query=3Dctype&amp;sektion=3D3&amp;a<wbr>propos=3D0&amp;manpath=3DFreeBS=
D+14.0-<wbr>RELEASE+and+Ports</a>&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 and =
current locale settings) in file=C2=A0 names=C2=A0 as *\*/xxx/,<br> =
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 where/xxx/=C2=A0 is =
the=C2=A0 =C2=A0 =C2=A0 =C2=A0numeric value of the character in octal.=
=C2=A0 This<br> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 option=
 is not defined in IEEE Std 1003.1-2008 (&quot;POSIX.1&quot;)<br> &gt; <br>=
 <br> ls(1) notably does toggle this behavior on by default only if stdout =
is <br> a tty requiring the above noted flag, and leaves it disabled if =
it's piping:<br> <br> <a href=3D"https://cgit.freebsd.=
org/src/tree/bin/ls/ls.c#n241" rel=3D"noreferrer" target=3D"_blank">https:/=
/cgit.freebsd.org/src/t<wbr>ree/bin/ls/ls.c#n241</a><br> <br> This gives =
grep the chance to just let it render.<br> <br> Thanks,<br> <br> Kyle =
Evans<br> <br> </blockquote></div><div data-from-addr=3D"" =
content=3D"mixmax-signature"><div><br></div>--<br><div =
class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div =
dir=3D"ltr"><div>---------------------------------------------------------<=
/div><div>=F0=9F=93=9E 06 89 66 51 35<br>(V)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
Dh=C3=A9nin Jean-Jacques<br>( ..)=C2=A0=C2=A0=C2=A0=C2=A0 48, rue de la =
Justice 78300 Poissy<br>c(')(')=C2=A0 <a href=3D"mailto:dhenin@gmail.com" =
target=3D"_blank">dhenin@gmail.com</a></div><div>--------------------------=
-------------------------------<br></div></div></div></div></div><img =
align=3D"left" width=3D"0" height=3D"0" style=3D"border:0;width:0px;height:=
0px" src=3D"https://user.mxhickory.com/api/track/v2/338bYKl3g2M9RTCwW/i02bj=
5CbpFWbnBkbp5WZoRmI/IyZy9mLkNnYlVmcmB0cu9Wa0NXZ1FnI/?sc=3Dfalse" =
alt=3D"">=20
----_NmP-a10823fa44109986-Part_1--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v1-338bYKl3g2M9RTCwW-72f45c9a14eeedcfac379e880024265b>