From: Ian Jackson Subject: Re: [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning Date: Thu, 17 Dec 2015 18:38:56 +0000 Message-ID: <22131.320.250211.170343@mariner.uk.xensource.com> References: <1450371968-27997-1-git-send-email-ian.jackson@eu.citrix.com> <1450371968-27997-6-git-send-email-ian.jackson@eu.citrix.com> <1450373473.4053.147.camel@citrix.com> <22130.62853.68527.604758@mariner.uk.xensource.com> <1450375801.1617.86.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9dSB-0006rI-NN for xen-devel@lists.xenproject.org; Thu, 17 Dec 2015 18:39:03 +0000 In-Reply-To: <1450375801.1617.86.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning"): > On Thu, 2015-12-17 at 17:48 +0000, Ian Jackson wrote: > > Why would `return' be better ? It would still generate the same > > warning. Leaving the loop via `last' seems less heavyweight than > > using `return' and less likely to produce bugs in future patches whose > > authors don't spot the non-local exit. > > I think I'm probably confused about the scope of the eval vs > {last,return} etc. In any case, that's no reason to block this patch > AFAICT: Acked-by: Ian Campbell Thanks. FYI, it's (eliding lots) like this: sub db_retry ($$$;$$) { for (;;) { $pre->(); eval { $r= &$body; if ($db_retry_stop) { no warnings qw(exiting); last if $db_retry_stop eq 'abort'; next; } $dbh->commit(); }; last if !length $@; } return $r; } The warning from perl is because when `last if $db_retry_stop' happens, `last' exits the eval in order to exit the outer for (;;) loop. The same would apply for the `next'. If there were any callers of db_retry_retry, they would trigger the `next', which would exit the eval in order to restart the outer for. Both of these are intentional. Perl thinks they might not be. Thanks for all the acks. I'll maybe push this at some point, or combine it with something else. It's not urgent. Ian.