Bug 286599 - ps(1) with -J <jail> broken sometime between b095a41a3a2a & 4fa275a5f357
Summary: ps(1) with -J <jail> broken sometime between b095a41a3a2a & 4fa275a5f357
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Olivier Certner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-05 10:43 UTC by Dave Cottlehuber
Modified: 2025-05-05 12:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Cottlehuber freebsd_committer freebsd_triage 2025-05-05 10:43:01 UTC
On latest CURRENT, built 4fa275a5f357 `ps auxwwd -J <jid>` doesn't filter by jid or jail name as it used to. 

wintermute /u/src> doas jexec mu ps auxwwd | wc -l
       7
dch@wintermute /u/src> doas ps auxwwd -J 9 | wc -l
     210
dch@wintermute /u/src> doas ps auxwwd -J mu | wc -l
     210

dch@wintermute /u/src> jls
   JID  IP Address      Hostname                      Path
     1  100.64.66.115   ci                            /jails/instances/14.2-RELEASE-amd64-amd64/ci
     2  100.64.24.38    jenkins                       /jails/instances/14.2-RELEASE-amd64-amd64/jenkins
     3  100.64.68.238   postgresql                    /jails/instances/14.2-RELEASE-amd64-amd64/postgresql
     4  100.64.24.38    eden                          /jails/instances/14.2-RELEASE-amd64-amd64/eden
     5  100.64.0.4      indie                         /jails/instances/14.2-RELEASE-amd64-amd64/indie
     7  100.64.75.29    picard                        /jails/instances/14.2-RELEASE-amd64-amd64/picard
     9  100.64.54.195   mu                            /jails/instances/14.2-RELEASE-amd64-amd64/mu
Comment 1 Olivier Certner freebsd_committer freebsd_triage 2025-05-05 12:28:48 UTC
Hey Dave,

There is indeed an on-purpose change in behavior, both to become standard compliant and also for consistency.  See commit message of https://cgit.freebsd.org/src/commit/?id=93a94ce731a89b and also the updated manual page.  In a nutshell, once a process is selected by any option, it will be listed regardless of the other options (except for -X/-x, which work as a (non-)filter; in more formal words, the processes selected by each option form a set, and all these sets are unioned/ORed to obtain the final process list).

If you want to list processes only from a specific jail, then you simply don't need '-a'.  Just remove it from your command-line and you should get the expected result.  '-J' is not a filter (and AFAICT nothing hints it was intended to be one, both in the code and the documentation).

Thanks and regards.