Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Fix %- (prevjob) picking wrong job after resuming
- X-seq: zsh-workers 54234
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Mikel Ward <mikel@xxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Fix %- (prevjob) picking wrong job after resuming
- Date: Sun, 22 Mar 2026 11:31:31 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Bkr7Y5Ff8V04TyVbr0NGx87gbU17jIdj9Xxns3cigi4=; fh=cvHf9CR5irZSFywgrLDud5YDiu/XxebPBo4fJAuWAVc=; b=J7UXO1QAUzGf9RV9APbbpUXBSNEHSaLUKBLsWsPzGpXmkOTg5O4Lny+EPv9okXhwxq OihyGSqu7v6+gAONEz3+2fJXojMd8FvookCNlCCvd1fi1saBoeffGW3aWwPXuavY6JLl NJAmniyKgM1M1NLWZntrJgPgWSLuY703pNKpwl3dxtRmmma2zZcV3yJKOn/HzCfn/Iux 9W60bzXxiuCuvycZuO6g9PPSQrEzZc8xy8HR2TpW8XeDOnCghDohn2XsMJNd/32TDb5S w4IX7+KH21kpc69UpG1Jd0k3tBvqDLzcgv4kUPRjKCWWHHM3hYmmspexbp76k+7CoTg4 2SaA==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1774204303; cv=none; d=google.com; s=arc-20240605; b=AnEBtC2rIEFqI2gS7LEksNhBca8SKX5NBYDdqY2xIJeUyUu6fBOFV3sSgDJ3u4HuT/ KTzzsOSFaEuH0ri9lN7bKrB0FVzX8psFdkFjLbqgaxClule0Pi43O1N2ypWGIG/qnM4L M5dAXEjUy2fJJ557Q5Ykvw7jfOJ3dC4gKMM9XkDwXO3qGBm1DZsWqEmKm8eZwhq+A7VV EfflkPo348pGRmsFc5QPwzkXYywBVTjBbJ4N0saRPFmydSOOumZ47CoKOOyYJLaN9nyL MRV2chem8tOyiRmgmTeuB9xsgrxYfyLcS57OoLwCfT77YgiKP3p3irR3fV29AEQkeNf0 8i0A==
- Archived-at: <https://zsh.org/workers/54234>
- In-reply-to: <20260322100811.1015536-1-mikel@mikelward.com>
- List-id: <zsh-workers.zsh.org>
- References: <20260322100811.1015536-1-mikel@mikelward.com>
This looks pretty reasonable. One question:
On Sun, Mar 22, 2026 at 3:08 AM Mikel Ward <mikel@xxxxxxxxxxxxx> wrote:
>
> diff --git a/Src/jobs.c b/Src/jobs.c
> index 4905ae925..e32e35bdc 100644
> --- a/Src/jobs.c
> +++ b/Src/jobs.c
> @@ -523,6 +523,11 @@ update_job(Job jn)
> * fg/bg is the superjob) a SIGCONT if we need it.
> */
> sjn->stat |= STAT_CHANGED | STAT_STOPPED;
> + if ((sjn->stat & (STAT_DONE | STAT_STOPPED)) ==
> + STAT_STOPPED) {
Since STAT_STOPPED has just been OR'd into sjn->stat,
(sjn->stat & (STAT_DONE | STAT_STOPPED)) == STAT_STOPPED
is equivalent to
(!(sjn->stat & STAT_DONE)). Is the latter a clearer expression of the
intent of this test?
> + prevjob = curjob;
> + curjob = i;
> + }
> if (isset(NOTIFY) && (sjn->stat & STAT_LOCKED) &&
> !(sjn->stat & STAT_NOPRINT)) {
> /*
Messages sorted by:
Reverse Date,
Date,
Thread,
Author