[master] 903ea6039 Revert "vcc: Add missing ERRCHK to vcc_expr5()"

Nils Goroll nils.goroll at uplex.de
Thu Jun 3 06:46:20 UTC 2021


I should have added the test case straight away, but I wrongly assumed the case
would be obvious

I noticed it working on #3622 where it happens with acls being evaluated as an
expression, but there is also a case without that PR:


commit 581c5b48b13192e4d1ed8935e79cdd10aeab3516
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Jun 3 08:44:58 2021 +0200

    vtc for dridi

diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 47b899585..a12f3295e 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -42,6 +42,14 @@ varnish v1 -errvcl {Symbol 'acl' type (reserved) can not be
used in expression.}
        sub vcl_recv { call acl; }
 }

+varnish v1 -errvcl {Symbols named 'vcl_*' are reserved.} {
+       import debug;
+
+       sub vcl_recv {
+               debug.test_probe(vcl_sub1, vcl_sub2);
+       }
+}
+
 varnish v1 -errvcl {Operator * not possible on type STRING.} {
        sub vcl_recv {
                set req.http.foo = "bla" * "foo";

I think we should emit a proper error here rather than failing an assertion:


**   top   === varnish v1 -errvcl {Symbols named 'vcl_*' are reserved.} {
**** v1    CLI TX|vcl.inline vcl7 << %XJEIFLH|)Xspa8P
**** v1    CLI TX|vcl 4.1;
**** v1    CLI TX|
**** v1    CLI TX|\timport debug;
**** v1    CLI TX|
**** v1    CLI TX|\tsub vcl_recv {
**** v1    CLI TX|\t\tdebug.test_probe(vcl_sub1, vcl_sub2);
**** v1    CLI TX|\t}
**** v1    CLI TX|
**** v1    CLI TX|%XJEIFLH|)Xspa8P
**** dT    0.491
***  v1    debug|Could not delete 'vcl_vcl7.1622702730.393641/vgc.sym': No such
file or directory
***  v1    CLI RX  106
**** v1    CLI RX|Message from VCC-compiler:
**** v1    CLI RX|Assert error in vcc_expr5(), vcc_expr.c line 748:
**** v1    CLI RX|  Condition((sym) != 0) not true.
**** v1    CLI RX|Running VCC-compiler failed, signal 6
**** v1    CLI RX|VCL compilation failed
**   v1    VCL compilation failed (as expected)
---- v1    Did not find expected string: ("Symbols named 'vcl_*' are reserved.")




On 03/06/2021 08:28, Dridi Boukelmoune wrote:
> 
> commit 903ea60399cf4480e8d1550323bab6bbada67d51
> Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
> Date:   Thu Jun 3 08:19:57 2021 +0200
> 
>     Revert "vcc: Add missing ERRCHK to vcc_expr5()"
>     
>     This reverts commit 2bc56a4b789fb770548aa6d528c8c8d6d296d4a1.
>     
>     We already assert that sym is not null, and we certainly don't expect a
>     reserved symbol to have slipped through since we already attempted the
>     least specific symnbol lookup.
>     
>     This is not a case where we expect to fail because of user input.
> 
> diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
> index b41395aff..55d311ea8 100644
> --- a/lib/libvcc/vcc_expr.c
> +++ b/lib/libvcc/vcc_expr.c
> @@ -745,7 +745,6 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
>  		if (sym == NULL && fmt->global_pfx != NULL && t1->tok != '.') {
>  			sym = VCC_SymbolGet(tl, SYM_MAIN, SYM_NONE,
>  			    SYMTAB_CREATE, XREF_REF);
> -			ERRCHK(tl);
>  			AN(sym);
>  			VCC_GlobalSymbol(sym, fmt);
>  		}
> _______________________________________________
> varnish-commit mailing list
> varnish-commit at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
> 


-- 

** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstraße 32
22301 Hamburg

tel +49 40 28805731
mob +49 170 2723133
fax +49 40 42949753

xmpp://slink@jabber.int.uplex.de/

http://uplex.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-commit/attachments/20210603/a6f78ce8/attachment.bin>


More information about the varnish-commit mailing list