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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2410 invoked from network); 14 Jun 2021 19:19:26 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Jun 2021 19:19:26 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1623698366; b=AiTW4qni7ZhNeI+Ptr5ctijiTS3mcKDd0+5CQ5sxqY1qMjVdMFchDhn9kdhwKipeSvVVwvV7Jq 2Sas6GrfML96V1r9KBRlD9MJTRgA314TDiYYe5nor6H3M0/Kg3z9OmdOhKbe/1di+M0J/5tUlJ w4mMr1Q24zdgEvjeFfOp6wSA4vGpR5Gtc3Lfec3EyzbpPTw9AV8dTlOevmMuweDznmjHoYZ5nf nrRK5/mFWqHwg3yb164GZlwY3LhGw8sRO1Qin2gpsoOpAJgyQC75SAfRqQ+2snC+Tafoa5Qel/ Q0b4/OaJZucC4SbhJFco+L3uoGVoqrEqMTiAeJobRzz0zA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (know-smtprelay-omc-8.server.virginmedia.net) smtp.remote-ip=80.0.253.72; 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-20200801; t=1623698366; bh=HuMtbF8mUGNdMqlmdI30FVFcU+DFqrlm4XaxZjtqzJo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=w6/s+3Jm3iWYnRK+5q7AXPKIg4gXZ5RJzQwEWsYkIQGJNaS/K+apM91/GH1nBm89suJP9mRI2m FTP1kU8EWK4jjJXgz5Lo3Q4RvXpgxa6QxF1h9KU+NVYAHdzbPg6LvwkO8MZa2Mt0tzYqQvlqot j4L1iHr1biguQ71H9YQpIoOiwxa9FNvpfdpfxVdMS7Yg1jOv9WTUZEVkqMSKY0oBkQ7hP6EIBD 1hEeg8ZXy8lZgEBcIm6wxpCTR2XRTbof03VvbqT8SzKZrfzU7+h7L6hn6KLBt3JESBBGFoBSEk XHJnfzbEzKaoJCSqhAF2PoCOaafSZX2PNYWU8ukFI0gjSA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Mg5plLQjXodEnEToSs69EM7za0yDMtf6EtgW5qTVotg=; b=iULVIPZ2VBsADnAIDuN5Aqu8hu odeRxhAInzh9P0QDuC8u3YMl6HB+DS6KadwI6XifFxw+veLybKuGDsRO4/X7pCxcbqInNFj4jNCVt K8ppOLJvhMO+7LRzXVGBfijK8slYFjOZubly4uXhsq0kROFJsPsgWndD9YVxzR/8E/P1F0/vsmcqZ XTUIjSBAWmVBmGJCIMMYEKINeV+5ShitsljsFPx39zHjf47owm9cBKDSjBToIOvWNDP5KuO5tcv3F SMHCEmyvHWmbHqjmKEI0XKO5cET1jRHg7SPlnmJtCEYRLd8g/S2V8hLfMtyHjK6U8nmPKiQfqWjvK 1xuWIasw==; Received: from authenticated user by zero.zsh.org with local id 1lss7K-000Gb3-1b; Mon, 14 Jun 2021 19:19:26 +0000 Authentication-Results: zsh.org; iprev=pass (know-smtprelay-omc-8.server.virginmedia.net) smtp.remote-ip=80.0.253.72; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from know-smtprelay-omc-8.server.virginmedia.net ([80.0.253.72]:52199) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lss74-000GHq-UY; Mon, 14 Jun 2021 19:19:11 +0000 Received: from pws-Zeus ([86.7.189.51]) by cmsmtp with ESMTPA id ss73luzu6QAbnss74lx2Zp; Mon, 14 Jun 2021 20:19:10 +0100 X-Originating-IP: [86.7.189.51] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.3 cv=W6IWqyek c=1 sm=1 tr=0 cx=a_exe a=mDzK/eG20+r+ucIvzJc7BQ==:117 a=mDzK/eG20+r+ucIvzJc7BQ==:17 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=HYshxDoSAAAA:8 a=viSe9S4IfXKkOJm6LVwA:9 a=QEXdDO2ut3YA:10 a=elyKgWIyZ5oA:10 a=Plg5eiIisSYA:10 a=na7qQM7zoEAPfvOk0o6d:22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1623698350; bh=Mg5plLQjXodEnEToSs69EM7za0yDMtf6EtgW5qTVotg=; h=Subject:From:To:Date:In-Reply-To:References; b=tPqaQdf8rlp4PGME94xqtFAd3ATGaJkjyqP/ct8rAHtY45jpqjhsNoJQOGdAk3c8G 3SNISLmiJQcn6QelTQDYDOlUDj2/vfxWEgY4/NbjfFBhyNYKLx4uo1qOSS2x/1t+Sd VefHYKfYr325Xo6M2a+zBs3ofy8mHBnt+AOmvQSbwNZBZ4MIPtoyaRL/o2DsztscmY 8019jynPp/qbBmXNgv25sj14YoxPZ6xMYitI53dF653l3BjY8zFJITFi5NbNU1HXmy kS0VJ17+MD2OMZ6fc+PLMJLIQOzXb4+GYeaPvT1L6IXkpigW7bItHoaiC44yZLL6RV AMQfaf1kHHjmQ== Message-ID: <823a57a39d8873ce30d2806d95a1c540cf0fe2f2.camel@ntlworld.com> Subject: Re: [PATCH] Do not send duplicate signals when MONITOR is set From: Peter Stephenson To: zsh-workers@zsh.org Date: Mon, 14 Jun 2021 20:19:09 +0100 In-Reply-To: References: <20210607172753.222432-1-epaulson10@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfL+jeNsK01hlfDeUtHmWFti2o/k9To6mmoN+Z/nnx25xQguPnHElLy3C4/lOZkV++meKE8Kc0F6jP4PMgaw1V2oTHGCnES5SXcLfWpdjyBMvpB9/4A/C GJEJas2vXDryVb/xRD5QMIqPtKHuQ0/UnRWJ4ypx+Vp0eqNXgfnIh1Jv X-Seq: 49079 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 Mon, 2021-06-07 at 11:45 -0700, Bart Schaefer wrote: > On Mon, Jun 7, 2021 at 10:28 AM Erik Paulson wrote: > > > > I run emacs as a daemon and use the emacsclient program to connect to > > it. I noticed that when I suspended the emacsclient program and > > resumed it in zsh, the program would sporadically crash. After digging > > into the code, I realized that emacsclient was receiving two SIGCONTs, > > which caused it to send a malformed command to the daemon. > > > > I found that this return used to be present, but was removed in > > https://www.zsh.org/mla/workers/2018/msg01338.html while addressing > > another emacs issue. > > I don't think it was removed ... similar code was added in two > separate places, but the "return" was only added in one of those. > > Your patch adds that return in the second case. > > The difference is that in the first case, the SIGCONT is received by a > job that is marked STAT_SUPERJOB and in the second case it's received > by a different job. > > I believe this means that in the former case the superjob is in the > foreground and in the second case, it isn't -- rather one of its > subjobs is. In the first instance zsh sends the signal to all the > subjobs and then to the process group. In the second case it sends > the signal to the process group first and then falls into the loop > sending the signal to any subjobs that still appear to be stopped. > > In any case I think a potential problem with placing an unconditional > "return" where your patch does, is that signals other than SIGCONT > probably still need to be delivered to the subjobs. PWS, any input > here? Hmm, it's not clear to me in what cases you'd need to deliver both killpg() to the group leader and then kill to the processes. You might hope if the shell was doing the right thing the first would be enough. But there might be special cases. I would hazard that as SIGCONT is probably the most difficult case --- the only one where you specifically want the process to be running afterwards --- if this patch improves things there, it's prohably not doing a lot of harm in most cases. It's not impossible there are some oddities where process groups aren't set up quite how you want that this might affect, but I doubt we're going to spot them just by staring. pws