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 3416 invoked from network); 25 Oct 2020 20:57:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2020 20:57:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1603659427; b=Qpahtk4Ln6Ta1k9DoS1HlYq7C+d8y9kXvUIYHyp7JOL4pe+czqoena5YRS5ArEKlHjmy30Ib0v o7hboFehzFK1WbIFXhSuVRNNe0unTDmtLkkAe73WwycZukkD+ZdjEqqGG3gE89SbjQAm3r5sSJ YXrQIFbctk9wTvrsCH/ETGWaeGWU4ib2mb/Nnmji8HoBMIwNsO8cb/IZnf2EQ/rFnBh7qxQZmO DAxjbyB9Zr6+dWJap2A/cl6YKQno0aNQIM526k3ZlRofWymVCNDlgqo9m/VpQ2wmiKS8RVUk1t 8pjSksRjlYXn81TVuy5GCZPjRVoCkpaGpcf9M8uprZLLGw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f179.google.com) smtp.remote-ip=209.85.167.179; 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=1603659427; bh=O4RLnBKwgYGvw/2P4qPK4ue6V5eyllZpMpCTQ4owdFs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=vBGsnj7Cjo65sq0ad0ja8DzX8eV8+HCcPVmwfTHL4yKlTIUZj4i/DrDdRe7qOgC0p24+CtFz58 PdjVYP7LxIZwh7tV7MuoN2llnSZE1bSpiQgMuluEY4npblsh2B+QDRmdP6FgVEPIRbypHXk6SN mTOICyaAN2LVHXV7ta9H9bejC6tohg29gkg8ZpH+hVKLg3gboDyL1KnsNOVAs57G9jcLlQBT0F xffmC3KoinMAoHDPR9G4ckcB+UdXteBb+RywYj05o8QnfQ1hm1oJyXoL8FpS8rWsf0byZEXQHD EklcO/aK5yFA+p2QJRbwKkS3CRDr2JtxBzDMinbXrtPjKg==; 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: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=NtFhdDAgs8GdxCsW1M5TxyT6Fm1MriDlX7DS0Lgf9Nw=; b=hra5fKmI/AHsZoQGun99q0Z7T2 YX+oeAQUO0qCu/892xJSvuPxibt3I6BWhAdM2ZOz3Aidp0nrgIpYED0wCKtWs5fKnwjg7j7YOY6q8 KCqM9yd0v/GDAY0C46CUycYx1begb2EpWp4BY8X2VMQAxwSbgIXAuqVScP2qwRyuXxvcABBPJNbY8 yKRueNVrfgqpDRvGSxMABaKDwMGQt6S6ezgJLXY+fA4JT8kro3ckocET9clV241rpXE7crG+79Gs2 l4ockbpahj1NHvGBpXFx5z+G0GXmsZHhSUHNOdlL35cS1XrXBHsGIx7Dd4Y1zFafobzo5pvGi3uTl Q/cGP/EQ==; Received: from authenticated user by zero.zsh.org with local id 1kWn4d-000C3b-0G; Sun, 25 Oct 2020 20:57:07 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f179.google.com) smtp.remote-ip=209.85.167.179; 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-oi1-f179.google.com ([209.85.167.179]:35982) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kWn4L-000Bv5-PQ; Sun, 25 Oct 2020 20:56:51 +0000 Received: by mail-oi1-f179.google.com with SMTP id y186so1424862oia.3 for ; Sun, 25 Oct 2020 13:56:49 -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:content-transfer-encoding; bh=NtFhdDAgs8GdxCsW1M5TxyT6Fm1MriDlX7DS0Lgf9Nw=; b=R/Ip3Rul8GVd8vYu03ejvObjtodEmXR/OFuhzlgzWKo6q57RjhFSMumh0LcQccOrZu lXyyoQ7VpX3u34lv6aVlSpQXy9GmPU8kqeOzvmRFrU8CzebDEUFBz96WSw+Jlho+JVdR H7dd585vX/opmy4EjsN7QVCFl6J+LRdnQ8vIMmoxQilQei69lFlMwuIdhU4sB3EQQ4KS A+2wEiyAOezWA6svEQrscqO0CAjVJtykj0gJIdr6ydmpowSOq2JaIv3dEY+36wA/eXm3 WfNX2DXhdxslvyPNuB4/FA3rH7vmJb/ibuXX3CivOVR+rbRTUvN8pIXtYjiy+0Z02oYZ KU5g== 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:content-transfer-encoding; bh=NtFhdDAgs8GdxCsW1M5TxyT6Fm1MriDlX7DS0Lgf9Nw=; b=DsD9EthOgxpRoADSN8+lAi6S2Zh/78zT2CDGbgXYXjR807OKlciQz780WrXZ2EmFEq QheAC8R6h18lrDQMFaC8yazxGLyFlv5lR02WEf51+6UQS7I8T7TxGmRFf3jyZJP458nw f1Hu+m3SI3ViW35rKj2bsdCPj1OwcqXjVilfaXncujsblqf3It2TYjMPs/s4qp+8jQ/s sj5VB5Q5yAQOUuWupxWMhcs/8Pq+kpdX2LBCzRSwojbnepaL67euuUpSpxDm+4CKcLBe nu621DlALojl+aWnRiYhWI8kroMixHOiEGIYUqEYKegcO5JoyVRgAf1AuhIzQ6AL27wI PETw== X-Gm-Message-State: AOAM5314bHjWRhBYA2Z9qRZZjcK3T5mm6kZA9XHAxYKX42mcQ3R+S7EA 1TNk6G8serOp14Wm60R8iN5rflpFKWsSDWQNlkPiuXPpgoyKpA== X-Google-Smtp-Source: ABdhPJyjJyu0bcdZE02Ys+pwRg1pO1pik2CsOtM2yeGStF6A3YNPsec4YT2hJ4DUDFMpj9AzScqYn1x7VSV19B7Kuc8= X-Received: by 2002:aca:aacf:: with SMTP id t198mr9979747oie.132.1603659408336; Sun, 25 Oct 2020 13:56:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 25 Oct 2020 13:56:37 -0700 Message-ID: Subject: Re: exit does not exit in traps triggered within functions To: =?UTF-8?Q?Micha=C3=ABl_Cadilhac?= Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 47501 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: Archived-At: This was previously discussed in the thread "Bug with traps and exit" which started in January 2019 and proceeded sporadically through January 2020. There was discussion of regression tests but no patch proposed, as far as I can tell. On Sun, Oct 25, 2020 at 1:20 PM Micha=C3=ABl Cadilhac wrote: > > Hello, > > Users at Unix.StackExchange suggested that I forward a question of > mine appearing here [1], as a potential bug. > > Consider these two examples, the second contributed by St=C3=A9phane Chaz= elas: > > $ zsh -c 'trap "exit 1; echo X" TERM; f() { kill -TERM $$; echo Y; }; f' > Y > $ zsh -c 'trap "exit 1; echo X" EXIT; f() { exit; echo Y; }; f' > X > > In the first case, the exit in the trap causes the trap to end, but > f() continues executing=E2=80=94but does not return. The return value of= the > program is 1. > > In the second case, the exit in the trap does not cause the trap to > end immediately, the trap finishes and does not return, and the return > value of the program is 0. > > As far as I understand, the expected behavior, which BASH displays, is > for these two scripts to print nothing. > > Tested on zsh 5.5.1 and 5.8. > > Thanks. > > 1: https://unix.stackexchange.com/questions/616217/why-does-zsh-finish-ex= ecuting-a-function-after-exit-was-called-from-a-trap >