[Toybox] [PATCH] Revert "Fix "ps -T 1234" to show thread belonging to that PID."

enh enh at google.com
Wed Jan 24 08:42:49 PST 2018


random example on my laptop:

/tmp/toybox$ ./toybox ps -AT
...
244083 244083 ?      00:17:32 chrome
244083 244084 ?      00:14:38 chrome
244083 244085 ?      00:14:38 chrome
244083 244086 ?      00:14:38 chrome
244083 244088 ?      00:14:38 chrome
244083 244089 ?      00:14:38 chrome
244083 244090 ?      00:14:38 chrome
244083 244091 ?      00:14:38 chrome
244083 244092 ?      00:14:38 chrome
244083 244093 ?      00:14:38 chrome
244083 244095 ?      00:14:38 chrome
244083 244096 ?      00:14:38 chrome
244083 244105 ?      00:14:38 chrome
244083 245518 ?      00:14:38 chrome
244083 223425 ?      00:14:38 chrome
244430 244430 ?      00:00:38 chrome
244430 244431 ?      00:00:22 chrome
244430 244432 ?      00:00:22 chrome
244430 244433 ?      00:00:22 chrome
244430 244435 ?      00:00:22 chrome
244430 244436 ?      00:00:22 chrome
244430 244437 ?      00:00:22 chrome
244430 244438 ?      00:00:22 chrome
244430 244439 ?      00:00:22 chrome
244430 244440 ?      00:00:22 chrome
244430 244441 ?      00:00:22 chrome
244430 244442 ?      00:00:22 chrome
244430 244444 ?      00:00:22 chrome
244430 245519 ?      00:00:22 chrome
244430 90655 ?       00:00:22 chrome

/tmp/toybox$ git revert 416397e14858c75a9bf20d05f7729595e03943df
[master 0e3dbdb] Revert "Fix "ps -T 1234" to show thread belonging to that PID."
 1 file changed, 2 insertions(+), 5 deletions(-)

(rebuild)

/tmp/toybox$ ./toybox ps -AT
...
244083 244083 ?      00:17:32 chrome
244083 244084 ?      00:00:00 TaskSchedulerSe
244083 244085 ?      00:00:01 TaskSchedulerRe
244083 244086 ?      00:00:01 TaskSchedulerRe
244083 244088 ?      00:00:01 TaskSchedulerRe
244083 244089 ?      00:02:26 Chrome_ChildIOT
244083 244090 ?      00:00:00 GpuMemoryThread
244083 244091 ?      00:00:00 File
244083 244092 ?      00:00:04 Compositor
244083 244093 ?      00:00:04 CompositorTileW
244083 244095 ?      00:00:04 CompositorTileW
244083 244096 ?      00:00:00 CompositorTileW
244083 244105 ?      00:00:00 ScriptStreamerT
244083 245518 ?      00:00:00 MemoryInfra
244083 223425 ?      00:00:00 TaskSchedulerRe
244430 244430 ?      00:00:38 chrome
244430 244431 ?      00:00:00 TaskSchedulerSe
244430 244432 ?      00:00:01 TaskSchedulerRe
244430 244433 ?      00:00:01 TaskSchedulerRe
244430 244435 ?      00:00:01 TaskSchedulerRe
244430 244436 ?      00:00:03 Chrome_ChildIOT
244430 244437 ?      00:00:00 GpuMemoryThread
244430 244438 ?      00:00:00 File
244430 244439 ?      00:00:02 Compositor
244430 244440 ?      00:00:00 CompositorTileW
244430 244441 ?      00:00:00 CompositorTileW
244430 244442 ?      00:00:00 CompositorTileW
244430 244444 ?      00:00:00 ScriptStreamerT
244430 245519 ?      00:00:00 MemoryInfra
244430 90655 ?       00:00:01 TaskSchedulerRe

On Wed, Jan 24, 2018 at 8:40 AM, enh <enh at google.com> wrote:
> On Wed, Jan 24, 2018 at 8:18 AM, Rob Landley <rob at landley.net> wrote:
>> On 01/23/2018 05:13 PM, enh wrote:
>>> This reverts commit 416397e14858c75a9bf20d05f7729595e03943df.
>>>
>>> Reason: this breaks -AT while not actually fixing the -T PID problem.
>>>
>>> Previously just the -T PID case was showing the same information (most
>>> obviously COMMAND) for each thread. With this patch, -AT now has the
>>> same bug.
>>
>> Ok, obviously I don't understand the use case. What's the behavior
>> that's wrong, so I can fix it?
>
> with this patch we get the right number of *lines* of output, but the
> data is wrong. it seems like it's the same data repeated N times. like
> i said, this is most obvious in the case of something like COMMAND ---
> all threads get the same name.
>
>> What that change did was make this match (2273 is the PID of the parent
>> chromium-browser process):
>>
>>   $ ./ps -T 2273 | wc -l
>>   37
>>   $ ps -T 2273 | wc -l
>>   37
>>
>> I.E. show the same number of lines out output when doing ps -T $PID on a
>> process with a lot of threads. Before that:
>>
>>   $ git checkout 416397e14858c75^1
>>   $ ./ps -T 2273 | wc -l
>>   2
>>
>> I.E. just header and the parent process, no threads.
>>
>> You want it to go _back_ to this old behavior, the new one where it
>> matches the other ps is wrong?
>
> having -AT broken breaks bug reports, because ps -AT is part of every
> bug report. i need to revert this today, because bug reports must
> work.
>
> having -T PID broken only hurts command-line users.
>
>> I see that in "ps -A 2273", the -A overrides the specific PID. I hadn't
>> noticed that before. Is this the regression? You want -A to override
>> PIDs listed on the command line?
>
> don't care. (ideally seems like that's an error, but procps seems to
> agree that "-A wins", which i suppose makes a kind of sense given that
> multiple -p filters are ORed together.)
>
>> Confused,
>>
>> Rob
>> _______________________________________________
>> Toybox mailing list
>> Toybox at lists.landley.net
>> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list