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 27764 invoked from network); 9 May 2020 14:15:40 -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 14:15:40 -0000 Received: (qmail 28771 invoked by alias); 9 May 2020 14:15:28 -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: 45797 Received: (qmail 12636 invoked by uid 1010); 9 May 2020 14:15:28 -0000 X-Qmail-Scanner-Diagnostics: from out5-smtp.messagingengine.com 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(66.111.4.29):SA:0(-1.1/5.0):. Processed in 5.337577 secs); 09 May 2020 14:15:28 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkeehgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkjghfofggtgfgsehtjedttdertddvnecuhfhrohhmpeffrghnihgv lhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenuc ggtffrrghtthgvrhhnpeefudetgeevhedvhfetveetvdduleduieejueduueejjedtteeu tdejhfdtgfeiteenucfkphepuddtledrieeirdduhedrvdefleenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhh rghhrghfrdhnrghmvg X-ME-Proxy: Date: Sat, 9 May 2020 14:14:42 +0000 From: Daniel Shahaf To: Roman Perepelitsa Cc: Zsh hackers list Subject: Re: local_traps doesn't restore traps set from functions Message-ID: <20200509141442.6b8d0ce3@tarpaulin.shahaf.local2> In-Reply-To: References: <20200507212136.3ff1a843@tarpaulin.shahaf.local2> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Roman Perepelitsa wrote on Fri, 08 May 2020 08:51 +0200: > On Thu, May 7, 2020 at 11:21 PM Daniel Shahaf wrote: > > > > The following patch fixes it: > > Thanks for the patch. I confirm that it works. I've tried a handful of > different combinations of traps and all work as expected. > Thanks for testing. > One stylistic suggestion for the patch: replace sigtrapped[i] fixup with this: > > sigtrapped[i] -= 1 << ZSIG_SHIFT; > > It'll align the code with the preceding comment to the point of making > the comment superfluous. I also find it easier to understand although > that may be subjective. Good point, thanks. Perhaps it'd be clearer if I wrapped the first disjunct by a macro, so it'd have a name and a doc string: /* ... */ static unsigned int low_N_bits_of(unsigned arg, unsigned char N) { return arg & ((1u << N)-1u); } (Function, rather than macro, for type safety in case the arguments are passed in the wrong order.) Cheers, Daniel