From: Thorsten Glaser <tg@mirbsd.de>
To: Donald Buczek <buczek@molgen.mpg.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	linux-fsdevel@vger.kernel.org, 1024811@bugs.debian.org
Subject: Re: Re: Bug#1024811: linux: /proc/[pid]/stat unparsable
Date: Thu, 22 Dec 2022 20:28:05 +0000 (UTC)	[thread overview]
Message-ID: <Pine.BSM.4.64L.2212222023170.29938@herc.mirbsd.org> (raw)
In-Reply-To: <a721c273-9724-a652-1888-9c5d5ece7661@molgen.mpg.de>
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
whitespace character (and, ideally, a ‘(’) in their name would
be escaped, which are these that are currently broken anyway.
And perhaps backslashes, if you decide to encode unambiguous,
but given the field length limit, I don’t think that was ever
a goal (both because I suspect this file was intended to be
used to get a quick overview and therefore deliberately shortens
and because the full info is available elsewhere), so no need to
encode unambiguously.
>If some documentation suggests, that you can just parse it with scanf,
>the documentation should be corrected/improved instead.
No. Someone recently did a survey, and most code in existence splits
by whitespace. Fix the kernel bug instead.
>Are you referring to proc(5) "The fields, in order, with their proper
>scanf(3) format specifiers, are listed below" [1] or something else?
Yes.
>The referenced manual page is wrong in regard to the length, too. There
>is no 16 character limit to the field, because it can contain a
>workqueue task name, too:
Probably used to be cut off after 16. Go fix that in the manpage
then. But do fix the encoding kernel-side.
>In fact, if you start escaping now you might also break programs which
>rely on the current 64 character limit.
Just cut off at the end then, like I suspect was done at 16 bytes
initially.
Or strip whitespace and closing parenthesis if present instead
of encoding them, or replace them with a question mark.
bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
next prev parent reply	other threads:[~2022-12-22 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166939644927.12906.17757536147994071219.reportbug@x61w.mirbsd.org>
2022-11-25 17:24 ` Bug#1024811: linux: /proc/[pid]/stat unparsable Thorsten Glaser
     [not found] ` <Y4Hshbyk9TEsSQsm@p183>
2022-12-22  0:53   ` Thorsten Glaser
2022-12-22 13:45     ` Donald Buczek
2022-12-22 20:28       ` Thorsten Glaser [this message]
2022-12-23  8:42         ` Donald Buczek
2022-12-23  8:49           ` Thorsten Glaser
2022-12-23  9:11             ` Donald Buczek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=Pine.BSM.4.64L.2212222023170.29938@herc.mirbsd.org \
    --to=tg@mirbsd.de \
    --cc=1024811@bugs.debian.org \
    --cc=adobriyan@gmail.com \
    --cc=buczek@molgen.mpg.de \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).