Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: killing suspended jobs makes zsh hang after 47d1215



On Jun 12,  6:02pm, Peter Stephenson wrote:
}
} Hmm... the original bug was if the (original) job had gone completely.
} With the change, the test now covers running and stopped (but still
} recognised by the system, i.e. not terminated) jobs.  What else is
} there?

WIFSIGNALED()?  WIFCONTINUED()?

There's this hunk & comment in Src/jobs.c:

#ifndef WIFCONTINUED
            else if (sig == SIGCONT) {
                Job jn;
                Process pn;
                /* With WIFCONTINUED we find this out properly */
                if (findproc(pid, &jn, &pn, 0)) {
                    if (WIFSTOPPED(pn->status))
                        pn->status = SP_RUNNING;
                }
            }
#endif

But WIFCONTINUED() is tested only in update_job() which in turn is
called only when findproc() finds something (Src/signals.c):

        if (findproc(pid, &jn, &pn, 0)) {
#if defined(HAVE_WAIT3) && defined(HAVE_GETRUSAGE)
            struct timezone dummy_tz;
            gettimeofday(&pn->endtime, &dummy_tz);
            pn->status = status;
            pn->ti = ru;
#else
            update_process(pn, status);
#endif
            update_job(jn);
        } else if (findproc(pid, &jn, &pn, 1)) {
            pn->status = status;
            update_job(jn);

We were collectively wrong about SP_RUNNING; perhaps its the case that
there's a single state this ought to be avoiding, rather than a list of
them that it should be accepting.



Messages sorted by: Reverse Date, Date, Thread, Author