From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 16d06e07 for ; Thu, 30 Jan 2020 14:02:06 +0000 (UTC) Received: (qmail 27020 invoked by alias); 30 Jan 2020 14:02:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45361 Received: (qmail 4469 invoked by uid 1010); 30 Jan 2020 14:02:01 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25703. spamassassin: 3.4.2. Clear:RC:0(37.59.109.123):SA:0(-1.9/5.0):. Processed in 1.583 secs); 30 Jan 2020 14:02:01 -0000 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) Subject: Re: Bug with traps and exit To: zsh-workers@zsh.org References: <3859b4bf-08ba-62d5-f00a-3ec4e67caf95@inlv.org> From: Martijn Dekker Message-ID: <67fe10ef-275c-8724-1fc1-d6738fa5c0a4@inlv.org> Date: Thu, 30 Jan 2020 15:01:23 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Another variant. Strangely, this one is not detected when tried from within a loop. ====begin test script==== test_BUG_TRAPFNEXI() { { test_result=$( my_pid=$(zsh -c 'echo "$PPID"') test_fn() { kill -s ALRM "$my_pid" print "stillhere" } trap "print 'trap'; exit" ALRM test_fn ); } if [[ ${test_result} == $'trap\nstillhere' ]]; then print "bug found" else print "bug NOT found" return 1 fi } test_BUG_TRAPFNEXI while :; do test_BUG_TRAPFNEXI break done test_BUG_TRAPFNEXI ====end test script==== Output, as of zsh 5.1: bug found bug NOT found bug found The second line (the "NOT found" one) was when the bug test was tried within a dummy loop. - Martijn -- modernish -- harness the shell https://github.com/modernish/modernish