improve infinite recursion debugging, fix infinite recursion bug
Matt S Trout [Thu, 18 Apr 2019 18:34:52 +0000 (18:34 +0000)]
lib/SQL/Abstract/Clauses.pm
t/01generate.t

index 4379c6c..5fd0fdd 100644 (file)
@@ -48,13 +48,13 @@ sub register_defaults {
   $self->{expand_clause}{'insert.target'} = '_expand_insert_clause_target';
   $self->{expand_clause}{'insert.fields'} = sub {
     return +{ -row => [
-      shift->_expand_maybe_list_expr($_[2], -ident)
+      $_[0]->_expand_maybe_list_expr($_[2], -ident)
     ] } if ref($_[2]) eq 'ARRAY';
     return $_[2]; # should maybe still expand somewhat?
   };
   $self->{expand_clause}{'insert.values'} = '_expand_insert_clause_values';
   $self->{expand_clause}{'insert.returning'} = sub {
-    shift->_expand_maybe_list_expr(@_, -ident);
+    $_[0]->_expand_maybe_list_expr($_[2], -ident);
   };
   $self->{render_clause}{'insert.fields'} = sub {
     return $_[0]->render_aqt($_[2]);
index 87bce6a..16f4d0d 100644 (file)
@@ -863,7 +863,13 @@ for my $t (@tests) {
     }
     else {
       lives_ok(sub {
-        alarm(5); local $SIG{ALRM} = sub { die "Timed out" };
+        alarm(1); local $SIG{ALRM} = sub {
+          no warnings 'redefine';
+          my $orig = Carp->can('caller_info');
+          local *Carp::caller_info = sub { return if $_[0] > 20; &$orig };
+          print STDERR "ARGH ($SQL::Abstract::Default_Scalar_To): ".Carp::longmess();
+          die "timed out";
+        };
         warnings_like(
           sub { $cref->() },
           $t->{warns} || [],