#346162 zsh: jobs -p is not POSIX-compliant

Package:
zsh
Source:
zsh
Description:
shell with lots of features
Submitter:
Vincent Lefevre
Date:
2024-01-11 02:45:02 UTC
Severity:
normal
#346162#5
Date:
2006-01-06 03:16:51 UTC
From:
To:
POSIX says that with "jobs -p", only the PID is output, whereas zsh
outputs full information.

See http://www.opengroup.org/onlinepubs/009695399/utilities/jobs.html

STDOUT

    If the -p option is specified, the output shall consist of one
    line for each process ID:

    "%d\n", <process ID>

#346162#8
Date:
2006-04-02 16:50:58 UTC
From:
To:
Another option, on for sh emulation?
#346162#9
Date:
2006-04-03 04:54:37 UTC
From:
To:
On Apr 2, 12:50pm, Clint Adams wrote:
}
} Another option, on for sh emulation?

I keep wanting to make POSIX_BUILTINS responsible for this sort of thing,
but it has a more specific meaning than that.  Possibly this should just
be another one of those things that checks the internal "emulation" mode,
rather than having an option to turn it on/off at will.

This is tangentially related to users/8989 and workers/21366 from last
year.  I never committed 21366.

} On Fri, Jan 06, 2006 at 04:16:51AM +0100, Vincent Lefevre wrote:
} > Package: zsh
} > Version: 4.3.0-dev-2-1
} > Severity: normal
} >
} > POSIX says that with "jobs -p", only the PID is output, whereas zsh
} > outputs full information.

It's actually worse than that.  "jobs -p" in zsh predates the POSIX spec,
as far as I know ... and zsh's "jobs -p" outputs process *group* numbers,
that is, the PID of the group leader only, not individual process IDs.

#346162#16
Date:
2024-01-11 02:40:46 UTC
From:
To:
I see that this bug report hasn't received activity since 2006. I am still experiencing this issue in 2024 with zsh 5.9, where jobs -p is outputting more than just the PIDs.
I think the most optimal solution is for zsh to update the output of jobs -p to be POSIX-compliant and match bash.
However, if the zsh developers do not want to break compatibility, another option is to add a new flag that has the correct behavior. For example, a capitalized version, -P.

Thanks,Aaron Franke