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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3383 invoked from network); 9 May 2020 15:25:12 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 9 May 2020 15:25:12 -0000 Received: (qmail 6035 invoked by alias); 9 May 2020 15:25:03 -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: 45798 Received: (qmail 11801 invoked by uid 1010); 9 May 2020 15:25:03 -0000 X-Qmail-Scanner-Diagnostics: from smtpq1.tb.ukmail.iss.as9143.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25801. spamassassin: 3.4.4. Clear:RC:0(212.54.57.96):SA:0(-2.7/5.0):. Processed in 3.810296 secs); 09 May 2020 15:25:03 -0000 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _mailcloud.virginmedia.com designates 212.54.57.96 as permitted sender) X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-workers@zsh.org X-SourceIP: 172.25.160.133 X-CNFS-Analysis: v=2.3 cv=FoieA1jq c=1 sm=1 tr=0 a=ShKnLeKYHz8gHcl3UCxcnw==:117 a=KEnZaF_ea6UA:10 a=IkcTkHD0fZMA:10 a=DoY9bV0jb9AA:10 a=Z9BaXwkc9B3biKbjtz0A:9 a=QEXdDO2ut3YA:10 X-Authenticated-Sender: p.w.stephenson@ntlworld.com Date: Sat, 9 May 2020 16:24:22 +0100 (BST) From: Peter Stephenson To: Zsh hackers list Message-ID: <1305621354.302160.1589037862169@mail2.virginmedia.com> In-Reply-To: <20200507212136.3ff1a843@tarpaulin.shahaf.local2> References: <20200507212136.3ff1a843@tarpaulin.shahaf.local2> Subject: Re: local_traps doesn't restore traps set from functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev69 X-Originating-IP: 165.225.81.56 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfJfFuathzV9OIHVBj9fKqi0j79Z+D9+MiLNbmNDXhOJZLwqeaurH89n1IfMlUlCwkqoFtVGCrWpz0FRm9A+ojR8CC84CWpDDrFjgKs0DRt8FLEDFQB1N mqA/2L5XG8C1mJISVbZyqb/mdpig3ZY30BS/NTZPbysoqVI3sfBYzQQ75IUvoRTiZlqOD6wwIBZwQ9fUhR/IwbdCbzAjEiz3d/Y= > On 07 May 2020 at 22:21 Daniel Shahaf wrote: > Roman Perepelitsa wrote on Wed, 06 May 2020 15:31 +0200: > > It appears that local_traps doesn't restore traps that were originally > > set from functions. > > Precisely. > > The following patch fixes it: OK, so the point here is that in this case the trap we're fiddling with is not going out of scope, nor having something else restored over it, it just happens to have been created inside a function. At this point, that fact becomes irrelevant, so we simply massage the information to make it behave as if it had been created at the current (new) function depth. That seems fine --- my only comment would be it would probably be sensible to insert some edited version of the previous paragraph as I for one am almost certain to wonder what's going on if I encounter this code in the future. cheers pws