bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 5.3-alpha: the `jobs' builtin prints foreground dead jobs with funct


From: Chet Ramey
Subject: Re: 5.3-alpha: the `jobs' builtin prints foreground dead jobs with function substitutions
Date: Tue, 30 Apr 2024 10:29:43 -0400
User-agent: Mozilla Thunderbird

On 4/29/24 6:29 PM, Robert Elz wrote:
     Date:        Mon, 29 Apr 2024 16:07:26 -0400
     From:        Chet Ramey <chet.ramey@case.edu>
     Message-ID:  <11d627e9-174c-40a8-b827-0a2678d580d1@case.edu>

   | So the question is what exactly constitutes a foreground job whose status
   | has "not been reported."

I doubt it is stated anywhere, but I would treat any job whose status has
been collected in $? as having been reported.

That's an interpretation. I might buy it if the DESCRIPTION didn't say

"When jobs reports the termination status of a job, the shell shall remove
the job from the background jobs list ..."

which implies that it's `jobs' doing the reporting. That appears in a few
other places:

"If the asynchronous AND-OR list became a background job: the jobs utility
reports the termination status of that job."

and the descriptions of wait() and waitpid(). So I think "reported by the
shell" implies that it's `jobs' doing it.

So does bash in general, if one does

        ls; jobs

The jobs command doesn't report ls as being done, yet that status hasn't
been reported to the user any other way previously - $? was set however.

That's where I'm going with this: trying to figure out a general rule that
everyone can agree on for which jobs `jobs' should *not* report on, either
because they're already reaped and removed from the jobs list (as above)
or because the shell wouldn't notify the user about their status at job
termination (like it would if the job were terminated by a signal).

I don't see any reason there should be any difference for a process that
was run in one of the new non-forking command substitution type things, nor
when jobs is run from one of those.

The difference is that the jobs are still in the jobs list here (for
various reasons, you don't want the jobs list to change during nofork
comsubs). I can work around this case, but I'm still interested in what
people think the general rule should be.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]