Re: pmap: German umlauts are shown as question marks

"Craig Small" <[email protected]> ("csmall") Thu, 7 Nov 2024 19:50:46 +1100
Newsgroups gmane.linux.procps.devel
Message-ID <CALy8Cw67BPAoR8=CuXBaMqQTOxtwPwgo4shta42y0HQUEG5VGg@mail.gmail.com>
--000000000000ad3f1c06264ebb13
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Should this string be parsed as a wide string and use iswprint() instead?

On Tue, 5 Nov 2024 at 23:09, Dr. Werner Fink <[email protected]> wrote:

> On 2024/11/05 11:53:33 +0100, Dr. Werner Fink wrote:
> > On 2024/11/05 09:23:16 +0100, Daniel Hofstetter wrote:
> > > Hi,
> > >
> > > I noticed that if I have a binary with German umlauts, the umlauts ar=
e
> > > shown correctly in the first line but not in the memory map. There,
> > > they are shown as question marks:
> > >
> > > $ pmap 19508
> > > 19508:   ./target/debug/hello_=C3=A4=C3=B6=C3=BC
> > > 00005db66dc51000     20K r---- hello_??????
> > > 00005db66dc56000    264K r-x-- hello_??????
> > > 00005db66dc98000     52K r---- hello_??????
> > > 00005db66dca5000     12K r---- hello_??????
> > > 00005db66dca8000      4K rw--- hello_??????
> >
> > There are two places where isprint(3) is checking the bytes of the
> remaining
> > path in /proc/<pid>/maps ... UTF-8 encoding are multibyte characters
> means
> > such multibyte characters are mapped to `?' for each byte.
> >
>
> A dirty hack for checking for (multi)byte characters with mblen(3)
> ... strlen(3) usage could be optimized indeed.
>
> --
>   "Having a smoking section in a restaurant is like having
>           a peeing section in a swimming pool." -- Edward Burr
>

--000000000000ad3f1c06264ebb13
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Should this string be parsed as a wide string and use iswp=
rint() instead?<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" cl=
ass=3D"gmail_attr">On Tue, 5 Nov 2024 at 23:09, Dr. Werner Fink &lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex">On 2024/11/05 11:53:33 +0100, Dr. =
Werner Fink wrote:<br>
&gt; On 2024/11/05 09:23:16 +0100, Daniel Hofstetter wrote:<br>
&gt; &gt; Hi,<br>
&gt; &gt; <br>
&gt; &gt; I noticed that if I have a binary with German umlauts, the umlaut=
s are<br>
&gt; &gt; shown correctly in the first line but not in the memory map. Ther=
e,<br>
&gt; &gt; they are shown as question marks:<br>
&gt; &gt; <br>
&gt; &gt; $ pmap 19508<br>
&gt; &gt; 19508:=C2=A0 =C2=A0./target/debug/hello_=C3=A4=C3=B6=C3=BC<br>
&gt; &gt; 00005db66dc51000=C2=A0 =C2=A0 =C2=A020K r---- hello_??????<br>
&gt; &gt; 00005db66dc56000=C2=A0 =C2=A0 264K r-x-- hello_??????<br>
&gt; &gt; 00005db66dc98000=C2=A0 =C2=A0 =C2=A052K r---- hello_??????<br>
&gt; &gt; 00005db66dca5000=C2=A0 =C2=A0 =C2=A012K r---- hello_??????<br>
&gt; &gt; 00005db66dca8000=C2=A0 =C2=A0 =C2=A0 4K rw--- hello_??????<br>
&gt; <br>
&gt; There are two places where isprint(3) is checking the bytes of the rem=
aining<br>
&gt; path in /proc/&lt;pid&gt;/maps ... UTF-8 encoding are multibyte charac=
ters means<br>
&gt; such multibyte characters are mapped to `?&#39; for each byte.<br>
&gt; <br>
<br>
A dirty hack for checking for (multi)byte characters with mblen(3)<br>
... strlen(3) usage could be optimized indeed.<br>
<br>
-- <br>
=C2=A0 &quot;Having a smoking section in a restaurant is like having<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 a peeing section in a swimming pool.&quo=
t; -- Edward Burr<br>
</blockquote></div>

--000000000000ad3f1c06264ebb13--