On 12/23/22 09:49, Thorsten Glaser wrote:
Donald Buczek dixit:
To be fair, this daemon doesn't use /proc/pid/stat for that, but /proc/pid/comm
Yes, and that’s proper. The field in /proc/pid/stat is size-limited
and so not necessarily distinct.
No, it is the process name itself, which is siz
Donald Buczek dixit:
> To be fair, this daemon doesn't use /proc/pid/stat for that, but
> /proc/pid/comm
Yes, and that’s proper. The field in /proc/pid/stat is size-limited
and so not necessarily distinct.
> As /proc/pid/stat is also used in many places, it could as well use
> that to avoid cod
On 12/22/22 21:28, Thorsten Glaser wrote:
Donald Buczek dixit:
No, Escaping would break existing programs which parse the line by
searching for the ')' from the right.
Huh? No!
The format is "(" + string + ") " after all, and only the string
part would get escaped.
The only visible change w
Donald Buczek dixit:
>No, Escaping would break existing programs which parse the line by
>searching for the ')' from the right.
Huh? No!
The format is "(" + string + ") " after all, and only the string
part would get escaped.
The only visible change would be that programs containing a
whitespac
On 12/22/22 1:53 AM, Thorsten Glaser wrote:
> On Sat, 26 Nov 2022, Alexey Dobriyan wrote:
>
>> /proc never escaped "comm" field of /proc/*/stat.
>
> Yes, that’s precisely the bug.
>
>> To parse /proc/*/stat reliably, search for '(' from the beginning, then
>> for ')' backwards. Everything in bet
On Sat, 26 Nov 2022, Alexey Dobriyan wrote:
>/proc never escaped "comm" field of /proc/*/stat.
Yes, that’s precisely the bug.
>To parse /proc/*/stat reliably, search for '(' from the beginning, then
>for ')' backwards. Everything in between parenthesis is "comm".
That’s not guaranteed to stay r
Dixi quod…
>The effect is that /proc/[pid]/stat cannot be parsed the way it is
>documented, as it does not escape embedded whitespace characters;
… nor parenthesēs:
tglase@x61w:~ $ ./mk\)sh -c 'echo $$; sleep 10' &
[1] 13375
tglase@x61w:~ $ 13375
tglase@x61w:~ $ cat /proc/13375/stat
13375 (mk)sh
Package: src:linux
Version: 5.10.149-2
Severity: normal
Tags: upstream
X-Debbugs-Cc: t...@mirbsd.de, adobri...@gmail.com
tglase@x61w:~ $ cp /bin/mksh mk\ sh
tglase@x61w:~ $ ./mk\ sh -c 'echo $$; sleep 10' &
[1] 12862
tglase@x61w:~ $ 12862
cat /proc/12862/stat
12862 (mk sh) S 12649 12862 12649 3483
8 matches
Mail list logo