[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning



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 <ian.campbell@xxxxxxxxxx>

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.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.