zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Wesley Schwengle <wesleys@opperschaap.net>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH v2] Fix jobs -p to be POSIX compliant
Date: Sat, 20 Jan 2024 13:14:08 -0800	[thread overview]
Message-ID: <CAH+w=7Z4r726Ph8E3ESWQurq3TcDUUbt+_86D3Uzs90D-5EZEw@mail.gmail.com> (raw)
In-Reply-To: <20240120123054.290214-1-wesleys@opperschaap.net>

On Sat, Jan 20, 2024 at 4:31 AM Wesley Schwengle
<wesleys@opperschaap.net> wrote:
>
> POSIX says that with "jobs -p", only the PID is output, whereas zsh
> outputs full information.
>
> There is discussion in the bug regarding POSIX_BUILTINS and refers to
> workers/21366. The latter is interesting because it refers to setopt
> long_list_jobs. I would want to argue that jobs -p should only show the
> PID regardless of that setting and POSIX_BUILTINS. jobs has the -l
> option, where the full line is displayed. From that point it doesn't
> make a whole lot of sense to have jobs -p do the same thing.

This is not correct.  As you noted later, "jobs -p" lists information
about process group leaders only, whereas "jobs -l" lists all jobs.
This differs mainly when there's a pipeline:

% sleep 30 | sleep 20 | sleep 10 &
[1] 67157 67158 67159
% jobs -p
[1]  + 67157 running    sleep 30 |
             running    sleep 20 | sleep 10
% jobs -l
[1]  + 67157 running    sleep 30 |
       67158 running    sleep 20 |
       67159 running    sleep 10
%

> Than there is the issue where its argued that zsh shows the group pid
> and not the actual pid of the process that is running. I looked at the
> output of bash and with this patch zsh and bash act similar.

More relevant is how they compare without the patch.

If we really wanted to make this POSIX compliant, we should arrange
that "jobs -lp" shows "more information" only about process group
leaders (currently -l simply overrides -p) and add "jobs -n" to
produce the notifications that are suppressed by "setopt no_notify"
(setopt long_list_jobs would apply here).

However, I'm generally not in favor of changing longstanding zsh
behavior for POSIX compliance without some kind of additional
conditions, such as [[ -o POSIX_JOBS ]] in this case.


      reply	other threads:[~2024-01-20 21:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 23:22 [PATCH] " Wesley Schwengle
2024-01-20 12:30 ` [PATCH v2] " Wesley Schwengle
2024-01-20 21:14   ` Bart Schaefer [this message]

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='CAH+w=7Z4r726Ph8E3ESWQurq3TcDUUbt+_86D3Uzs90D-5EZEw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=wesleys@opperschaap.net \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).