[master] 9849fd0 Fall out of compiled VCL code if any statement sets ctx->handling non-zero.

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 3 10:45:06 CET 2017


commit 9849fd067da128cb46cc8a35ec8312323e53cc25
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Feb 3 09:43:03 2017 +0000

    Fall out of compiled VCL code if any statement sets ctx->handling non-zero.
    
    Right now this only affects failures in vcl_init{}

diff --git a/bin/varnishtest/tests/m00022.vtc b/bin/varnishtest/tests/m00022.vtc
index 8b3a249..a9863d6 100644
--- a/bin/varnishtest/tests/m00022.vtc
+++ b/bin/varnishtest/tests/m00022.vtc
@@ -7,19 +7,33 @@ server s1 {
 
 varnish v1 -vcl+backend { } -start
 
+logexpect l1 -v v1 -g raw {
+	expect * 0	VCL_Log         "Should happen first"
+	expect 0 0	VCL_Log         "Should happen second"
+
+} -start
+
 varnish v1 -errvcl "Planned failure in vcl_init" {
 
 	import debug;
+	import std;
 
 	backend default {
 		.host = "${s1_addr}";
 	}
 
 	sub vcl_init {
+		std.log("Should happen first");
 		debug.init_fail();
+		std.log("Should not happen");
+	}
+	sub vcl_fini {
+		std.log("Should happen second");
 	}
 }
 
+logexpect l1 -wait
+
 varnish v1 -cliok "param.set nuke_limit 42"
 
 varnish v1 -errvcl "nuke_limit is not the answer." {
diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c
index 53bc29e..ff7334c 100644
--- a/lib/libvcc/vcc_parse.c
+++ b/lib/libvcc/vcc_parse.c
@@ -196,6 +196,7 @@ vcc_Compound(struct vcc *tl)
 			vcc_ErrWhere(tl, tl->t);
 			return;
 		}
+		Fb(tl, 1, "if (*ctx->handling) return(1);\n");
 	}
 }
 



More information about the varnish-commit mailing list