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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32327 invoked from network); 13 May 2021 21:37:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 May 2021 21:37:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1620941878; b=skNfVRTtsO+pwiBLm4H4JLxF8gGMl18vQH1XWAhkl5lHtBjcw2NXWOIuQNOgfvATcZASmOlzWi QKiHFj7Q4ab6rePOFhyEZrG6k8pQJRXDAjzgFj4cpm/JSuP6cZVpJYItUPLwF7VbZIvqRDoD7C fNOATI7UpnEW0rcDTbogmYXP6eINiiLXPYfbVmuHen4JEsqAhirkl1lWx3MCjEebbFgfMuukF6 Y0TJZxvWB1xL53H87yy4Yi8zenDiykzgxkcg+r+DF0mOr3Jr2CCJRjbpUY2pCYx9gMYtlNZoWb ksenMZYcEkX2YLxOcp7avUxwknfBNm/JlDfWh3bst3Qbyw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f41.google.com) smtp.remote-ip=209.85.210.41; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 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-20200801; t=1620941878; bh=sUxpoiAUlFvslfvJR17BCokpK1U/59vzQdz/AbFDfFA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=lqSBeut6f0tA1DatJHxCBXhnVs+FqZs+TyLqoFmbS0SZ3kEknyAFwXJaWRRj9IWJaFhHyC7+rM SK4VXg/q2z4j1HDhpKRzBFSRR39j6Y7O0YdSRbyRcvMNvXMmXKGgNYnIO5GR2SkzxRfXayJbr4 rwtteKPt8YmOfxTBa/ccX9AXz8u+Ms+j3KWqpyNa6K2kOJyfsXkMYaalxx6H/1n3K/VPe5Fhg/ IzedK9/2zy4QudtRtVqnNZjqiYOnRVCPbrilq0dzjA1za48URkNMLmUPJQHQMEmlVCREWhLvis lryYDgAe8wRzVbVzETCMyCw7B3g8LC80EIrv5hDTkENM/Q==; 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-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=iEifYZt7q8aSL6ZbVJnR6X4arbbCDdHqQA2Z8ruoYr8=; b=f6hqGyj8ZWZXJAmh3VBDjlAumB FB4cQBpqPRaoF5Zfpm3vFy+63TFQfUwUzddSbooEtdIB7UTDxDAlhCxkfE2LKOznfckS7ntzls6/S 9ScCvl6eswRHqDPBBwl2s5TBN3/PanUiKUIj8/lYLG9vqzUghL4Qnza+2ud3Bf8UJU9dQog92XkoU lFGQ91M5XEkTBN7UfkNENLRYSXniA6Ja+Xy7ESORD5gfPRXzdZ6lGoKU011zyIDbA4XKlrXUInvOH dXR8G/HifmkIBYydJebALQ0JbnMUYLFoAHpocRooM/QFeZMBwMk6PX10XnHF0XTtPcDVkbE7QONNn fxU7Q5Sg==; Received: from authenticated user by zero.zsh.org with local id 1lhJ1q-000Bo5-3t; Thu, 13 May 2021 21:37:58 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f41.google.com) smtp.remote-ip=209.85.210.41; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ot1-f41.google.com ([209.85.210.41]:37741) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lhJ1C-000B7q-FO; Thu, 13 May 2021 21:37:19 +0000 Received: by mail-ot1-f41.google.com with SMTP id v19-20020a0568301413b0290304f00e3d88so3695716otp.4 for ; Thu, 13 May 2021 14:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iEifYZt7q8aSL6ZbVJnR6X4arbbCDdHqQA2Z8ruoYr8=; b=l5C19sw8V3/wHe5N4tqu6d0qbK5OK2PLop3GuQTmUBpB7ip7BY3Hi9e3eyHiu8fOMZ OgbfKDG5T6P92Aeh58lur3ZeNpNLT3wcH4ilnqtKZXpVr51QsTB/NFqH73rQAiLHdg9M R/LgXM1w1X4Vy4n3PcTGELH1x0ezM2Cg6ZweH8N/i4NdSE4EV5kJAZ0a6btq7OF5NAhC Nn8uSym1op9WnukYlDMOJKT4FFRltzY+NS42ubI7qOgRRkhFjz+sKZnZx7cpeljMC+7i Ju05qaLZBZlnBTB6aIP3BQdtKPN/XiTKEdjkDDPslbgZjcIRbti6ruVlGsjYt4olj+Df Dekg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iEifYZt7q8aSL6ZbVJnR6X4arbbCDdHqQA2Z8ruoYr8=; b=kfZIb+cLgl3Dn/OLxvZQ1IIceC5nPZXCMAv4s5Ug/iwTkNLXDaCdrC+fMbTydBTMvG xIBfq1RjgoYEETDrysKR2bkQ57FC7detMNxO3CL3SADHdDeJloYv5DYu8iO89TTfCuWV cdDffnKRFCUPxV/U++CJrmdqHsegr+sb3+YLvYPbAWR9aVGNVx/yG9hLb6qbg1nsI7Vn gQcXFm+gs7a+Y/SqbRu/hHWuR2bGIbDy6/vZTF7KjPa5QXzzrd5uNZPW2DfMJelbOVn+ bRb70bNwaYdvsy73ZX9Y1bTGrVNTpBMbj1/ialWCNyX+eW6zmF3tRGRLvNJOLaypbQwy dhOA== X-Gm-Message-State: AOAM530Bj4FtVcX+heIszHkk4oLGtm5VRXDN52xtGZyaFnYElETyL5bi gwxKqLkWyFRgJhpqfsLOpcR6AW/N4w117HgAIxDiBQ== X-Google-Smtp-Source: ABdhPJzIQJSESEBKk4TxeZc9IbNwq1n+YCoC5RQbT0MobQW2dLLsbugaVPIjXO3+5WQZM40n7hfI1SswBC/7SUVNmDI= X-Received: by 2002:a9d:f66:: with SMTP id 93mr36893832ott.229.1620941836913; Thu, 13 May 2021 14:37:16 -0700 (PDT) MIME-Version: 1.0 References: <20210513101751.j5vo2dbrd5uzwju4@jo-so.de> <119769213.82300.1620922030356@mail2.virginmedia.com> <0890fd16e2f7d0a8d40f621022ad541ab1c1a9ee.camel@ntlworld.com> In-Reply-To: <0890fd16e2f7d0a8d40f621022ad541ab1c1a9ee.camel@ntlworld.com> From: Bart Schaefer Date: Thu, 13 May 2021 14:37:05 -0700 Message-ID: Subject: Re: Zsh spins in endless loop with SIGHUP + read in zshexit To: Peter Stephenson Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26740 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Thu, May 13, 2021 at 11:44 AM Peter Stephenson wrote: > > I haven't looked for cases where we're disobeying "exit" from shell code > owing to the same logic So besides the one discussed already in this thread, we have: 1) ${unset?error message} 2) return at top level (bin_break + BIN_RETURN) 3) exit (bin_break + BIN_EXIT) 3a) in a shell function (ZEXIT_DEFERRED) 3b) at top level (ZEXIT_NORMAL) 4) doshfunc() when not already in an exit trap 5) loop() when (3a) has previously happened 6) init_misc() for "zsh -c somecommand" 7) zsh_main() at end of input (can be canceled by ignoreeof) 8) zpty module at the end of the child thread 9) signal handling for HUP PIPE ALRM and if not interactive INT (3a) uses zexit in a comma expression, I'm surprised that doesn't produce a warning for a void function. That is the only instance of DEFERRED. The only time zexit() fails to _exit() is when called recursively, which I believe can only happen in a trap. Possible "dangerous" cases when used in a trap: (1) could unexpectedly proceed beyond the parameter expansion into the subsequent shell code. (2,3) and by extension (4) when used in combination with an "always" block (this is not clear-cut) would continue the shell code. (8) would continue into the pty master code if a new zpty were opened. I haven't tested whether any of these things actually DO fail to _exit(), just source code examination of what comes downstream in each circumstance. When there is no "always", I believe 2 and 3 correctly end processing of the current function scope.