On 2023-07-29 00:07:37, Jamie Landeg-Jones wrote:
I have a program that produces a list of PIDS, that are supplied via '-p' to /bin/ps and are sorted with '-d'.
What language is it written in? What is the use case?
After a late upgrade on a particular machine, I've just been bitten by the modifications to "ps" to unconditionaly add recurive descendancy PID lookups to the '-d' option when a pid is specified.
I understand that the behavioral change affected programs/scripts in a way that requires adjustment and I do try to limit that as much as possible. But this feature was a needed one and I thought it should "just work" when -d was combined with -p, as opposed to adding a new flag to the program. Now that you've corrected my thinking, I plan to revert that change and re-introduce the feature as a separate option, see https://reviews.freebsd.org/D41231 for review.
There is nothing in the man pages or docs to suggest that this should be a thing, but there you go.
I intend to revert the change so there's no plan to update this in the manual page.
Rather than just patch it out, Would a patch to allow the previous behaviour as an option (even if the option isn't default) be accepted?
Feel free to discuss D41231 or provide an other patch.
In addition, there is a bug in that ps now goes into a memory-sucking endless-loop if you do: ps -dp0
Thanks for this report, it was an oversight of the corner case that the parent PID of the PID 0 is also 0.
The manual page is no longer accurate either: '-d' says "Note that this option has no effect if the “command” column is not the last column displayed." That is no longer true, it doesn't matter what column is displayed last, if you use '-p', '-d' now completely changes the output title: ps: extend the non-standard option -d (tree view) to work with -p https://cgit.freebsd.org/src/commit/bin/ps/ps.c?id=ca8c0d5e811048ad67d0955642c5b486e9c0f3d2 author: Piotr Pawel Stefaniak <ps...@freebsd.org> 2020-05-07 16:56:18 +0000 commit: ca8c0d5e811048ad67d0955642c5b486e9c0f3d2 (patch) tree: 374be17aead18daf2e3c7477a4573f60ce62d8f0 /bin/ps/ps.c
My plan is to revert that. Piotr