From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25383 invoked from network); 20 Oct 2022 16:27:22 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Oct 2022 16:27:22 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666283242; b=DPs6hwGeNbeVYFd+Xtm5gpVro4zHhf2euyBtNTjpmt1wdOVhsX3Il+JYh5sRMIABwHoaTWendH /+6Fp+c7iIgxaQpN2tPv3gOCnqKsUKZq5CSevkZBMtMYRS+ACiM09tdL2kMYugFYtulvRzo/6k Wk3cu6GlV+RBGH7a0iQRt9S+xChZcBygnGTGCZwSAAuNdhpthumoiC7dr5BeB7e2Mc3v4XMFTD Dce/2X8vu0KErxuJ59CWmLzz87igyfqBDH+pKZPoHs/SVIIuMnEYc5ccMTjd0q7RSRBNavZGPp 4q6cn5gILav+C9esbC3wxtoaJrGBkntzDaVxRqoHt5xOYg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666283242; bh=ru24gYOi9XU1bzBqO5vYx4uh8qbbRAhWGgv3AIYccKg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject: References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature: DKIM-Signature; b=NdyjB7TRUFbuB7EMvchAtPgEqO2MZEu1zLkI5CqY6L3kOd25Zg86YxqHSj+pfKkLAIkqDmAcL5 0OU2qCAhmZeo48FIENcrbpiJ4N9ZyC3WX5ZpcArzrcXHaFCLjd2ws+uHIGKwvSRZYfFLpveSZH yfhkpniT21yaG60SxRXo2iSrPTQueZ0GjS6+zTwyYsvMpq1yjZqi3Ud7INczNO+Ff3qB5Ywh8U HhWPnTJcOtPr7TCv+4gcHstjazvmYutGBiHiG2eAH+uwiVKaHCOtVao4mA/PdpeWO8w0710x3H GVPk5gNxbSYd3l9lOnI2UBIGLecu1hJVoTzDpaU5VHArog==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From: Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=mLghseqfxjYjy1m/u/p+dkNlm453gL4Wf5FtO/sp6x4=; b=f+O003z/f7DAUAmLfGh74/htqM Rub1mbDfZgWhXvgGGVieyh3XsqeVjFhNOMzPlJ++ZOH3E+afZTz4gpYG+W6jsb7Ci9tq3fDDKYupk UoH095eyy+MIBAdBITOZIadTawma5uzSY9emC5q1eJQHCmCJiT4TjNH7HYmzUXZJHawjN1i5/rV0h qpowvzHG9hFlt9IBWzhUpM2btD3gU6+QmsHS2kNgEcg+zDFSc70qzcDOzAF/zao/BfHNT3h4ovzOG uE6tHO5GQlE95goeiCoaPiS0pFhT8xapGGcmAVtgI7bbWOTS7AfCtJxkVYWQz9iWquQP0XftRDO9W kj/Au0bw==; Received: by zero.zsh.org with local id 1olYO8-0000xv-5U; Thu, 20 Oct 2022 16:27:20 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:35732) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1olYNV-0000a8-4n; Thu, 20 Oct 2022 16:26:42 +0000 Received: from [212.54.57.81] (helo=smtp2.tb.ukmail.iss.as9143.net) by smtpq2.tb.ukmail.iss.as9143.net with esmtp (Exim 4.90_1) (envelope-from ) id 1olYNU-000428-QL for zsh-workers@zsh.org; Thu, 20 Oct 2022 18:26:40 +0200 Received: from oxbe20.tb.ukmail.iss.as9143.net ([172.25.160.151]) by smtp2.tb.ukmail.iss.as9143.net with ESMTP id lYNUo5XxzmIDmlYNUo4fbZ; Thu, 20 Oct 2022 18:26:40 +0200 X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-workers@zsh.org X-SourceIP: 172.25.160.151 X-CNFS-Analysis: v=2.4 cv=LoCBd1Rc c=1 sm=1 tr=0 ts=635176c0 cx=a_exe a=Ip+kZtMD4PYul4iMASbA3A==:117 a=1DWFKdCB1IcA:10 a=IkcTkHD0fZMA:10 a=ZjyAdWuDOD4A:10 a=q2GGsy2AAAAA:8 a=3SYhmQqkFn1zbi8vhugA:9 a=QEXdDO2ut3YA:10 a=z9dJwno5l634igLiVhy-:22 X-Authenticated-Sender: p.w.stephenson@ntlworld.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com; s=meg.feb2017; t=1666283200; bh=ru24gYOi9XU1bzBqO5vYx4uh8qbbRAhWGgv3AIYccKg=; h=Date:From:To:In-Reply-To:References:Subject; b=LZNl+t54DPVOfeF7RfdWBfR/3B9Of3lG+SIMschaWJfwfmbcDTjTAyeWsgiQxecZP oekZX1SkiR0PlxMI7k0vLCxD3WWYkpDV9+zLgJM9mzL7eEDG0WRJuBewxir+U61gZn Nk3pGKz6pEgrOcBxKrs2w2kpqrrnUhw1Z1ZcpNlvaVqXO6XsIDmSLro8GeLDltD0/z MuDdrCL5evvsvtMKUPk2s4JhEilElccQ1RnVfVbEq+euYeID4NME3IICrfXNgUNmiO FJHPChAJZpcGNG8Glha82dx5LdvUKf89O7exCzBpjv9zVkwAdQVeSWWZD/U8iVz0ws mfKyDGABkxAew== Date: Thu, 20 Oct 2022 17:26:40 +0100 (BST) From: Peter Stephenson To: zsh-workers@zsh.org Message-ID: <1094839952.3286480.1666283200511@mail.virginmedia.com> In-Reply-To: References: Subject: Re: problem with 'ls | less' shell function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer X-Originating-IP: 147.161.224.167 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4xfDX0JaPQBjZoBmRACcYn+vs7lMYGR+sD0VGTIU2rOJu5l4vxhB+T0pVX86u9lK0U/MVFOOGn/4Ky/YLZvEDJ5t5BO7EL/taF5WBbsO7WFwvxH79PFeEJ eGfnC/UuwMiSK6aI0P6NiYWCivB+WfjNBjLnZeWhDliSjOl2SFrpHICUt5ro1sdo9387ix5OQ6iWBzhH61osJgMxpgcDy9ySc8pCaa7QvZu5WHW/66h40TJQ X-Seq: 50798 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > On 20/10/2022 01:10 Bart Schaefer wrote: > > > On Wed, Oct 19, 2022 at 1:28 AM wrote: > > > > I think what happens is that zsh fails to correctly set the foreground > > process group in `fg`. `less` is not in the foreground pgrp that's why > > it immediately gets suspended by SIGTTIN after it receives SIGCONT. > > First sentence partly wrong, second sentence right. > > When a shell function is suspended with ^Z, the parent shell forks > again to create a process for the shell function, but doesn't change > the process group of the pipeline. When "fg" brings the shell > function process back, that process is made group leader, but it then > needs to reset the group leader again to the pid of its own foreground > job, which it does not ... or, conversely, upon suspend the parent > shell needs to avoid changing the group leader of the new process. > > At this point I'm not sure which of those needs to happen or where. > It's all in or around the call to addproc() at exec.c line 1734. I'd be quite surprised if you didn't need to be looking at this comment at line 1872. This isn't necessarily the same thing but must surely be related... /* * At this point, we used to attach this process * to the process group of list_pipe_job (the * new superjob) any time that was still available. * That caused problems in at least two * cases because this forked shell was then * suspended with the right hand side of the * pipeline, and the SIGSTOP below suspended * it a second time when it was continued. * * It's therefore not clear entirely why you'd ever * do anything other than the following, but no * doubt we'll find out... */ pws