Skip to content
Permalink
Browse files

Apply bandaid to missing VMOD symbol errors

The VCL compilation error message when a VMOD symbol does not exist
simply disappeared. When I figured how to bring it back I was lucky
my test case exhibited another quirk for the following case:

    new foo = bar.foo()

Where bar is a successfully imported VMOD, and foo is the missing
constructor. For some reason instance symbols are created with VCL
low and high values, so the missing foo constructor ended up being
confused with the existing foo instance.

The regression I initially hunted down (the lack of error message
in the first place) was introduced by 340abd0. I suggest we
don't give VMOD-induced symbols a VCL low/high since by definition
they are not tied to a VCL version (even though they may do so at
run time) and use that criteria to filter out the spurious error
message:

> Symbol not found: 'directors.foo' (Only available when 4.0 <= VCL
> syntax <= 4.0)

If there is no proper low or high (and 4.0 is legit) then we don't
print the "Only available when" part? For now I needed the bandaid.

Refs 340abd0
  • Loading branch information...
Dridi committed Nov 8, 2019
1 parent bd3b87b commit 46a6a3af681644f43e2e813ee68f8bd53b4cd1bb
Showing with 17 additions and 1 deletion.
  1. +13 −0 bin/varnishtest/tests/v00016.vtc
  2. +4 −1 lib/libvcc/vcc_symb.c
@@ -117,6 +117,19 @@ varnish v1 -syntax 4.0 -errvcl {Undefined acl foo} {
}
}

# NB: The line break in -errvcl is here on purpose, it prevents
# a spurious "Only available when" addition to be missed when the
# foo constructor could be confused with the foo instance name.
varnish v1 -syntax 4.0 -errvcl {Symbol not found: 'directors.foo'
At:} {
import directors;
backend b { .host = "127.0.0.1"; }

sub vcl_init {
new foo = directors.foo();
}
}

# 'foo' overloaded
varnish v1 -syntax 4.0 -errvcl {Symbol not found: 'foo'} {
backend b { .host = "127.0.0.1"; }
@@ -275,6 +275,8 @@ VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind,
break;
tn = tn1;
}
if (sym != NULL && sym->kind == SYM_VMOD && e == SYMTAB_PARTIAL)
e = SYMTAB_EXISTING;
if (sym != NULL && e == SYMTAB_PARTIAL) {
st = st2;
tn = tn2;
@@ -294,7 +296,8 @@ VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind,
VSB_printf(tl->sb, "%.*s", PF(tn1));
VSB_cat(tl->sb, "'");
sym = vcc_sym_in_tab(tl, st, kind, VCL_LOW, VCL_HIGH);
if (sym != NULL) {
if (sym != NULL && sym->kind != SYM_OBJECT &&
sym->kind != SYM_INSTANCE) { /* XXX: too specific */
VSB_cat(tl->sb, " (Only available when");
if (sym->lorev >= VCL_LOW)
VSB_printf(tl->sb, " %.1f <=", .1 * sym->lorev);

0 comments on commit 46a6a3a

Please sign in to comment.
You can’t perform that action at this time.