From nobody Thu May 1 19:51:41 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZpPnp4cYpz5vfHY; Thu, 01 May 2025 19:51:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZpPnn6H1gz46kT; Thu, 01 May 2025 19:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746129101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dREhGKBiKMhQ33Fb6JToT9vDtzTPJzghR7ttIwBniaM=; b=UFmwpfVvCXtGXVouAJt8DpWmT42J+DCHA2O1TREa3wBp5ZoYTCiOFrUUmyuXom9cyomlaf 01TuxeKYZ+dYPlFJbpjNGS+LiIM0UOdFO+7LLoMpeHPWPEsNj+2kCaTZPAet1GoWNcn27e pXuvNx12FOGmuYc/7LGg0wqdvQR4cnailMWZSijCYUQpV99qcr0SwSht3ElZbaYAArTJH1 JMKEs+qBqEhf8xsHwBSe/rlCT62kXOKI2uUacEihKbBT4zzhCjGzakTSFaZ+JgAN+hTojO NGaG5yxxs5QECekZCqM35BtZ6arZUYwx0GE+jfGuF+5kXev0rIcy2n2bATN7fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746129101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dREhGKBiKMhQ33Fb6JToT9vDtzTPJzghR7ttIwBniaM=; b=PS42jDeWonHkP6hiIsgMJAfzSEEjYEgVQqaEp1PV0YPgGgQI+VkCQXZVyTtsjo48vjOctA TcIdUP1iLCTo/pujvXhFRGvlLPh1kaLuzelPYne9B/nPYwarSdwvMERkF7fd11aEJi2VSa Y7IFw8D24SOQN6jYjJU5i4bId4rVdMqpH4pLDZTwb9MNYVe8UK3BwhRog6J0oBOMau/QN2 Z7KAFT91+HrUS9aIBvNIcgBDSj2aNNNmTf4gAc9HucOkaExkCGvOLACJzlZNZoBLtWz6Za 13BIIt3ukhlS6sBTv/hdW4vCcBv0Pq+Uwu2Z0isMNCKbvnMJRZW7iCuGrNllRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746129101; a=rsa-sha256; cv=none; b=OrTV6EGL7CVhbqZkNasDWuFRdXEktEEeeLs5UyEB1bWl9FVagnTxP/C9HUhzSsO12AQT2s 76t1I0B2mSRFmRWGVhgx3lWgYxP+tB3Entu0KIve81I+kI5w90VtByZysG03hurUyZLDm4 pYz6vjxL+gHB3k21yFghfFWsefhfLMFbmBZkubIB6xm5zwK52tAVp3rcN6MvO6q6NEMCRA BCUvQQBMSC5gLPRzH5gNzx6czG4VE4Nf24L5oDrUOnDODSNn5VqQrvgxpdbzWwXitQVI1n flpRD9y2M4YhOa2btgFl56HKTwoYY4RwHJhir/hV8C14xDNyf/BKv7/6ME02DQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZpPnn4xthzjHm; Thu, 01 May 2025 19:51:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 541Jpf42068650; Thu, 1 May 2025 19:51:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 541Jpfh1068647; Thu, 1 May 2025 19:51:41 GMT (envelope-from git) Date: Thu, 1 May 2025 19:51:41 GMT Message-Id: <202505011951.541Jpfh1068647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 1ee62f354ab0 - stable/14 - ps(1): Make '-a' and '-A' always show all processes List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1ee62f354ab02e25b8c13b8df331d947aa50dff8 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1ee62f354ab02e25b8c13b8df331d947aa50dff8 commit 1ee62f354ab02e25b8c13b8df331d947aa50dff8 Author: Olivier Certner AuthorDate: 2025-03-14 21:42:08 +0000 Commit: Olivier Certner CommitDate: 2025-05-01 19:37:05 +0000 ps(1): Make '-a' and '-A' always show all processes When combined with other options affecting the selection of processes, except for '-X' and '-x', option '-a' would have no effect (and '-A' would reduce to just '-x'). This was in contradiction with the rule applying to all other selection options stating that one process is listed as soon as any of these options has been specified and selects it, which is both mandated by POSIX and arguably a natural expectation. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49617 (code) Differential Revision: https://reviews.freebsd.org/D49618 (manual page) (cherry picked from commit 93a94ce731a89b5643021b486da599e7963da232) --- bin/ps/ps.1 | 25 +++---------------------- bin/ps/ps.c | 9 ++++++++- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index d823df48c093..0a6a5555ba35 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -80,7 +80,7 @@ and .Fl x options. Except for options -.Fl A , a , X , +.Fl X and .Fl x , as soon as one of them appears, it inhibits the default process selection, i.e., @@ -215,11 +215,6 @@ see and .Fl x .Pc . -Currently, this option has no effect if any other option selecting processes to -display is present, except for -.Fl X -and -.Fl x . If the .Va security.bsd.see_other_uids sysctl is set to zero, this option is honored only if the real user ID of the @@ -965,13 +960,13 @@ which is the current behavior of option .Pc . .Pp However, options -.Fl G , l , o , p , +.Fl A , a , G , l , o , p , and .Fl t behave as prescribed by .St -p1003.1-2024 . Options -.Fl A , a , f , U , +.Fl f , U , and .Fl w currently do not, but may be changed to in the future. @@ -1021,20 +1016,6 @@ implementation (for other BSDs, illumos or Linux) behaves like this. For all these reasons, the behavior is expected to be changed soon to using the effective user ID instead. .Pp -The -.Fl a -option has no effect if other options affecting the selection of processes are -used, except for (non-)filters -.Fl X -and -.Fl x. -Option -.Fl A -has the same restriction. -This idiosyncrasy is both in contradiction with -.St -p1003.1-2024 -and arguably with common sense, and is expected to be removed soon. -.Pp .Nm ps currently does not correctly limit the ouput width, and in most cases does not limit it at all when it should. diff --git a/bin/ps/ps.c b/bin/ps/ps.c index db339a765987..ebfc3f0bb1e1 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -528,7 +528,14 @@ main(int argc, char *argv[]) free(keywords_info); keywords_info = NULL; - if (!all && nselectors == 0) { + if (all) + /* + * We have to display all processes, regardless of other + * options. + */ + nselectors = 0; + else if (nselectors == 0) { + /* Default is to request our processes only. */ uidlist.l.ptr = malloc(sizeof(uid_t)); if (uidlist.l.ptr == NULL) xo_errx(1, "malloc failed");