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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10016 invoked from network); 20 Oct 2022 00:12:03 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Oct 2022 00:12:03 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666224723; b=FK/4Bndr288FPYYvy0MZd2XwjA9T+BpZ9t+W+C617KPj1sw76q9DNRkYyT11cIK6SoMyi5vUQU Cdg12Pd3QHncNNx1jiq/VRpUVp3qyFqj2atfMC/akoUdZnXqjdypmwa4jvbOuz5oPEjCooB+YQ Ds5XI5Ipf1ZKvzB31PSWZGuGbtYcq7QxMYm96Ddvl1qitZZ3k7M1ylvNlc66zcXJbSshWJLJmr //E+F4cBeqboDEhzyjcva70o7akVCkX/bpDhbFrJCbXAraGanzBxa7mJcPKhCgE49ojs9+38jy b4uKHFm9c/mJ9Gs5k8gz8psVqy5DqZTxs8M3oWyWJRglww==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666224723; bh=4GB41gSqSaLo6236OE/nkJjpkupBPRSoB8Ruh4TLpWw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=baCMTF8/K7sOTj9eHfR6eYRq4iaBO2j61QP1Zhs68hEEn7tk0fhiUmW0o+uxq65Ycv+tfhc8Re c9FfFjFU7NMY/Z7dLO9JsLmwPxi+nIOVHSfzv5t9t2VuWyMgOX8Oxy6qJ8h4C+i4K9qt8LL+wt o+TxKFO7QGLHYNSvuUKGLWoxZ996EJT/sUfgHxfGyYs7Zfa/tgVuG1BsFXClevLBbbX7QcTAwO 5Tum583kjwsC137/CNsiC0g7gILyw5/17uwweD+X+9TREHhBlITScN+oYoLQyhocdibkD4yLub q0S0/7phA7faCr/YXWbK5ACxHcsEzG2oltp/a0NtyoAzHQ==; 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-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Z7v4CKQKikTAuSRLgJIj2CPLkYguIAiccoFviF/tlWA=; b=TfAz++ft40vKMW9aZZLjFEtEDc +yT90R6Gj0HeCleNZN42VwCJkvP4a2pJKy24rAzRyhG9B60/bj/yT9hSx/IU2bGzRXq2HyHMCpINT f6WaN1FKPILLBsi4whpoq1w3tYII3CgcxrbRqIEbeAvn7e5kpiy8Sj1c5NGF7ITWPjKh8dZcvDypV 49sjtDTkivVEp+gospBT1czydRWUEAzXGqTUobFe/T3NaZyc6SzMtzLGI6ZTh6GeaaWJnVCXlrWaC SlsYtNhzowPxzNflB6xznlqrTVBy/91jvgTJD/tF47hCxuFk2uz9km9zyUW2ObLcEeOHVgpi9uqHB g6LG/3zA==; Received: by zero.zsh.org with local id 1olJAH-0003Bx-Bx; Thu, 20 Oct 2022 00:12:01 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f50.google.com ([209.85.218.50]:45003) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1olJ9K-0002rL-Dx; Thu, 20 Oct 2022 00:11:03 +0000 Received: by mail-ej1-f50.google.com with SMTP id w18so43656851ejq.11 for ; Wed, 19 Oct 2022 17:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=Z7v4CKQKikTAuSRLgJIj2CPLkYguIAiccoFviF/tlWA=; b=RcjtqptC5RUedaaFdmBS6FXfjw3hurTtIGpYKEny8P0KA+nlL61wA2r5RKnxSckFbS AdWDPR6WwvgO1lN+w6khO0hvrImvUUbBs5T4MxRMckqpxbahNMM45xZRm2NhDnVYiUVd dWmyC34BO087b32ST5DfuqD9+rycHAOrn8EEY6pY/RpxjMPKCtQ100Rng18zgRncGsog 0J1IVW84Jy3Ki52Qem6GxSD1hBXX7E7NY837/xM38LM43QTI2lRpNEEzzEwRJBVODxr1 gGnEcKBcflDyCSA3Ggrk5a/E5dJb8S2PfYVLD5E+VjMKWJ/7Hm4mVrUduzm1LteJoONd e3kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z7v4CKQKikTAuSRLgJIj2CPLkYguIAiccoFviF/tlWA=; b=aklw+ldnBaAzk3xSpJm1HFyGr7ZBWh56npF4KX7tfBgglqeJc8wmJH9JMbz7uCr0Nz mXRei4dvAkCRcXNY2l4EtSzL/AlaP4jfvmdUt5b9KEm4ObHny48C5DAD7LCn/5HOh9Bg VfkF2EmjyZzxnrwMUR/hBg5C0us/PDsdiNpR1bhALlWGTgMX6LzdxmOcomGQG9WHzfRt nS52AMZmAQk3JlzPtgKvnDJ/e4pO4m0SUcc37JhJO8QQmap4lkRIcsBJhK21IwH2OzNt GhtVMKEAClAmkTyCTZM14tFSUl/IkR26F3aZnkELv3B2/F1aWMP0N3pLRV0j2kcJA94y iHJw== X-Gm-Message-State: ACrzQf2bVSweV9OgmKnZXvfVNCPISac8taLFnfti3kSrDl94sJEdy315 0cF/dgTeySVlNfi66Dby7RNcghUjuF04BrWo5DuOKI/0OAk= X-Google-Smtp-Source: AMsMyM4F0+bHt2RFqPtTaKSatT2smZ/UzyAjQDP8Nv7DSTHqcy9t+X7TmoA4urCvRHHCXq//PXDR3ZEqbSs9EkOxXog= X-Received: by 2002:a17:907:2cd9:b0:78d:9f4c:9cff with SMTP id hg25-20020a1709072cd900b0078d9f4c9cffmr8827725ejc.345.1666224661815; Wed, 19 Oct 2022 17:11:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Wed, 19 Oct 2022 17:10:50 -0700 Message-ID: Subject: Re: problem with 'ls | less' shell function To: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 50797 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 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.