From phk at FreeBSD.org Mon Jul 4 10:11:08 2022 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 4 Jul 2022 10:11:08 +0000 (UTC) Subject: [master] 7ae7f9a06 Add a "-a" append flag to filewrite Message-ID: <20220704101108.9D3E91116C1@lists.varnish-cache.org> commit 7ae7f9a0613eba366d1a008f566f0cdf71db5693 Author: Poul-Henning Kamp Date: Mon Jul 4 10:10:07 2022 +0000 Add a "-a" append flag to filewrite diff --git a/bin/varnishtest/vtc_misc.c b/bin/varnishtest/vtc_misc.c index 345170b89..8c90cf438 100644 --- a/bin/varnishtest/vtc_misc.c +++ b/bin/varnishtest/vtc_misc.c @@ -250,7 +250,9 @@ cmd_shell(CMD_ARGS) * * Write strings to file * - * filewrite /somefile "Hello" " " "World\n" + * filewrite [-a] /somefile "Hello" " " "World\n" + * + * The -a flag opens the file in append mode. * */ @@ -259,14 +261,19 @@ cmd_filewrite(CMD_ARGS) { FILE *fo; int n; + const char *mode = "w"; (void)priv; if (av == NULL) return; + if (av[1] != NULL && !strcmp(av[1], "-a")) { + av++; + mode = "a"; + } if (av[1] == NULL) vtc_fatal(vl, "Need filename"); - fo = fopen(av[1], "w"); + fo = fopen(av[1], mode); if (fo == NULL) vtc_fatal(vl, "Cannot open %s: %s", av[1], strerror(errno)); for (n = 2; av[n] != NULL; n++) From phk at FreeBSD.org Mon Jul 4 10:11:08 2022 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 4 Jul 2022 10:11:08 +0000 (UTC) Subject: [master] 59b85155f Polish diagnostic, and complete coverage testing of vcc_vmod.c Message-ID: <20220704101108.B4CA41116C3@lists.varnish-cache.org> commit 59b85155f311945a6c0e9617a2b99a5e29cf6d09 Author: Poul-Henning Kamp Date: Mon Jul 4 10:10:39 2022 +0000 Polish diagnostic, and complete coverage testing of vcc_vmod.c diff --git a/bin/varnishtest/tests/m00003.vtc b/bin/varnishtest/tests/m00003.vtc index e03d34ef4..41155b926 100644 --- a/bin/varnishtest/tests/m00003.vtc +++ b/bin/varnishtest/tests/m00003.vtc @@ -59,4 +59,103 @@ varnish v1 -errvcl {Not string[2]} { import wrong; } filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" "[[\"$VBLA\"]]" "\x03" varnish v1 -errvcl {Not $VMOD[3]} { import wrong; } +filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" +filewrite -a ${tmpdir}/libvmod_wrong.so { + [ + [ + "$VMOD", + "1.0", + "wrong", + "Vmod_vmod_wrong_Func", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + 0, + 0 + ] + ] +} +filewrite -a ${tmpdir}/libvmod_wrong.so "\x03" +varnish v1 -errvcl {Incompatible VMOD wrong} { import wrong; } + +filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" +filewrite -a ${tmpdir}/libvmod_wrong.so { + [ + [ + "$VMOD", + "1.0", + "wrong", + "Vmod_vmod_wrong_Func", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + 1, + 0 + ] + ] +} +filewrite -a ${tmpdir}/libvmod_wrong.so "\x03" +varnish v1 -errvcl {VMOD wants ABI version 1.0} { import wrong; } + +############################################################# +# NB: in the tests below "15" should track VRT_MAJOR_VERSION + +filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" +filewrite -a ${tmpdir}/libvmod_wrong.so { + [ + [ + "$VMOD", + "1.0", + "wrong", + "Vmod_vmod_wrong_Func", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + 15, + 0 + ], [ + "$FOOBAR" + ] + ] +} +filewrite -a ${tmpdir}/libvmod_wrong.so "\x03" +varnish v1 -errvcl {Unknown metadata stanza.} { import wrong; } + +filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" +filewrite -a ${tmpdir}/libvmod_wrong.so { + [ + [ + "$VMOD", + "1.0", + "wrong", + "Vmod_vmod_wrong_Func", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + 15, + 0 + ] + ] +} +filewrite -a ${tmpdir}/libvmod_wrong.so "\x03" +varnish v1 -errvcl {Bad cproto stanza} { import wrong; } + +filewrite ${tmpdir}/libvmod_wrong.so "VMOD_JSON_SPEC\x02" +filewrite -a ${tmpdir}/libvmod_wrong.so { + [ + [ + "$VMOD", + "1.0", + "wrong", + "Vmod_vmod_wrong_Func", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + 15, + 0 + ], [ + "$CPROTO" + ], [ + "$VMOD" + ] + ] +} +filewrite -a ${tmpdir}/libvmod_wrong.so "\x03" +varnish v1 -errvcl {Bad vmod stanza} { import wrong; } + shell "rm -f ${tmpdir}/libvmod_wrong.so" diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index 0fa316eef..755f44fa5 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -226,7 +226,7 @@ vcc_ParseJSON(const struct vcc *tl, const char *jsn, struct vmod_import *vim) if (!strcmp(vv3->value, "$" #UU)) {vim->n_##ll++; continue;} STANZA_TBL #undef STANZA - return ("Unknown entry"); + return ("Unknown metadata stanza."); } if (vim->n_cproto != 1) return ("Bad cproto stanza(s)"); From phk at FreeBSD.org Mon Jul 4 11:17:05 2022 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 4 Jul 2022 11:17:05 +0000 (UTC) Subject: [master] fcb823b02 Fix vmodtool.py to work without $ABI Message-ID: <20220704111705.B23811137D2@lists.varnish-cache.org> commit fcb823b02cd89595c1fabe3e550eba062fbcd586 Author: Poul-Henning Kamp Date: Mon Jul 4 11:16:35 2022 +0000 Fix vmodtool.py to work without $ABI diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index 755f44fa5..a0ecfe96a 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -88,7 +88,7 @@ vcc_path_open(void *priv, const char *fn) AN(vim->json); f = fopen(fn, "rb"); - if (f == NULL) { + if (f == NULL) { vim->err = strerror(errno); return (-1); } diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 4f051282f..5001522be 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -223,7 +223,7 @@ def err(txt, warn=True): ####################################################################### -class CType(object): +class CType(): def __init__(self, wl, enums): self.nm = None self.defval = None @@ -321,7 +321,7 @@ class arg(CType): ####################################################################### -class ProtoType(object): +class ProtoType(): def __init__(self, st, retval=True, prefix=""): self.st = st self.obj = None @@ -506,7 +506,7 @@ class ProtoType(object): ####################################################################### -class Stanza(object): +class Stanza(): ''' Base class for all $-Stanzas ''' @@ -631,22 +631,17 @@ class ABIStanza(Stanza): def parse(self): if len(self.toks) != 2: self.syntax() - valid = { + self.vcc.strict_abi = { 'strict': True, 'vrt': False, - } - self.vcc.strict_abi = valid.get(self.toks[1]) + }.get(self.toks[1]) if self.vcc.strict_abi is None: err("Valid ABI types are 'strict' or 'vrt', got '%s'\n" % self.toks[1]) - if self.vcc.strict_abi: - self.vcc.vrt_major = "0" - self.vcc.vrt_minor = "0" - else: + self.vcc.contents.append(self) + if not self.vcc.strict_abi: self.vcc.vrt_major = "VRT_MAJOR_VERSION" self.vcc.vrt_minor = "VRT_MINOR_VERSION" - self.vcc.contents.append(self) - class PrefixStanza(Stanza): @@ -903,7 +898,7 @@ DISPATCH = { } -class vcc(object): +class vcc(): ''' Processing context for a single .vcc file ''' @@ -917,6 +912,8 @@ class vcc(object): self.copyright = "" self.enums = {} self.strict_abi = True + self.vrt_major = "0" + self.vrt_minor = "0" self.auto_synopsis = True self.modname = None self.csn = None From phk at FreeBSD.org Mon Jul 4 12:05:06 2022 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 4 Jul 2022 12:05:06 +0000 (UTC) Subject: [master] ac82a96a1 Also fix "$ABI vrt", and make sure it stays fixed. Message-ID: <20220704120506.CC7ED114DE2@lists.varnish-cache.org> commit ac82a96a1f9cb734b2a575aad250014a14ded501 Author: Poul-Henning Kamp Date: Mon Jul 4 12:04:21 2022 +0000 Also fix "$ABI vrt", and make sure it stays fixed. diff --git a/bin/varnishtest/tests/m00003.vtc b/bin/varnishtest/tests/m00003.vtc index 41155b926..c02d80071 100644 --- a/bin/varnishtest/tests/m00003.vtc +++ b/bin/varnishtest/tests/m00003.vtc @@ -69,8 +69,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so { "Vmod_vmod_wrong_Func", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", - 0, - 0 + "0", + "0U" ] ] } @@ -87,8 +87,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so { "Vmod_vmod_wrong_Func", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", - 1, - 0 + "1U", + "0" ] ] } @@ -108,8 +108,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so { "Vmod_vmod_wrong_Func", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", - 15, - 0 + "15", + "0" ], [ "$FOOBAR" ] @@ -128,8 +128,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so { "Vmod_vmod_wrong_Func", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", - 15, - 0 + "15", + "0" ] ] } @@ -146,8 +146,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so { "Vmod_vmod_wrong_Func", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", - 15, - 0 + "15", + "0" ], [ "$CPROTO" ], [ diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index a0ecfe96a..bb244ef99 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -131,6 +131,7 @@ vcc_ParseJSON(const struct vcc *tl, const char *jsn, struct vmod_import *vim) { const struct vjsn_val *vv, *vv2, *vv3; const char *err; + char *p; vim->vj = vjsn_parse(jsn, &err); if (err != NULL) @@ -180,13 +181,15 @@ vcc_ParseJSON(const struct vcc *tl, const char *jsn, struct vmod_import *vim) vv3 = VTAILQ_NEXT(vv3, list); AN(vv3); - assert(vjsn_is_number(vv3)); - vim->major = atoi(vv3->value); + assert(vjsn_is_string(vv3)); + vim->major = strtoul(vv3->value, &p, 10); + assert(p == NULL || *p == '\0' || *p == 'U'); vv3 = VTAILQ_NEXT(vv3, list); AN(vv3); - assert(vjsn_is_number(vv3)); - vim->minor = atoi(vv3->value); + assert(vjsn_is_string(vv3)); + vim->minor = strtoul(vv3->value, &p, 10); + assert(p == NULL || *p == '\0' || *p == 'U'); if (!vcc_IdIs(vim->t_mod, vim->name)) { VSB_printf(tl->sb, "Wrong file for VMOD %.*s\n", diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 5001522be..da7157766 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -1100,7 +1100,9 @@ class vcc(): yield i + " " def json(self, fo, fnx): - fo.write('#define STRINGIFY(arg) #arg\n') + fo.write('#define STRINGIFY3(arg) #arg\n') + fo.write('#define STRINGIFY2(arg) STRINGIFY3(#arg)\n') + fo.write('#define STRINGIFY1(arg) STRINGIFY2(arg)\n') fo.write("\nstatic const char Vmod_Json[] = {\n") fo.write('\t"VMOD_JSON_SPEC\x02"\n') @@ -1114,8 +1116,8 @@ class vcc(): # Hand-munge the JSON to insert stuff only known by # the C-compiler at compile-time. fo.write(',"\n\t" \\"" VMOD_ABI_Version "\\", "\n') - fo.write('\t STRINGIFY(%s) ", "\n' % self.vrt_major) - fo.write('\t STRINGIFY(%s)\n' % self.vrt_minor) + fo.write('\t STRINGIFY1(%s) ", "\n' % self.vrt_major) + fo.write('\t STRINGIFY1(%s)\n' % self.vrt_minor) else: fo.write('"\n') fo.write('\t\"\\n\\x03\"\n};\n') diff --git a/vmod/vmod_debug.vcc b/vmod/vmod_debug.vcc index 2fb67e8ab..df8ba6247 100644 --- a/vmod/vmod_debug.vcc +++ b/vmod/vmod_debug.vcc @@ -27,8 +27,9 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# NB: We use this vmod to test "$ABI vrt" handling. -$ABI strict +$ABI vrt $Prefix xyzzy $Module debug 3 "Development, test and debug" $Synopsis auto diff --git a/vmod/vmod_vtc.vcc b/vmod/vmod_vtc.vcc index 52578e7b3..7ac3f6997 100644 --- a/vmod/vmod_vtc.vcc +++ b/vmod/vmod_vtc.vcc @@ -27,7 +27,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -$ABI strict +# NB: Default to strict $ABI handling, so that path is tested in vmodtool.py + $Module vtc 3 "Utility module for varnishtest" DESCRIPTION From nils.goroll at uplex.de Mon Jul 11 14:01:06 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Mon, 11 Jul 2022 14:01:06 +0000 (UTC) Subject: [master] d3abcede8 Improve VCL now documentation Message-ID: <20220711140106.C1C3610E1AC@lists.varnish-cache.org> commit d3abcede80622ab296fc77f349669c9d6d47278b Author: Nils Goroll Date: Tue Mar 16 14:53:14 2021 +0100 Improve VCL now documentation diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst index be15b6448..da3efa560 100644 --- a/doc/sphinx/reference/vcl_var.rst +++ b/doc/sphinx/reference/vcl_var.rst @@ -1417,6 +1417,15 @@ now When converted to STRING in expressions it returns a formatted timestamp like ``Tue, 20 Feb 2018 09:30:31 GMT`` + ``now`` remains stable for the duration of any built-in VCL + subroutine to make time-based calculations predictable and + avoid edge cases. + + In other words, even if considerable amounts of time are spent + in VCL, ``now`` will always represent the point in time when + the respective built-in VCL subroutine was entered. ``now`` is + thus not suitable for any kind of time measurements. See + :ref:`std.timestamp()` in :ref:`vmod_std(3)`. sess ~~~~ From nils.goroll at uplex.de Mon Jul 11 14:01:07 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Mon, 11 Jul 2022 14:01:07 +0000 (UTC) Subject: [master] 00bb0b2e4 Add std.now() and std.timed_call() Message-ID: <20220711140107.2B14710E1B2@lists.varnish-cache.org> commit 00bb0b2e4487400c47720c109de460543fa05193 Author: Nils Goroll Date: Tue Mar 16 15:14:57 2021 +0100 Add std.now() and std.timed_call() std.now() fills a gap left by the stable time of the now variable in VCL: Sometimes we need to know the current time after some longer processing in VCL. std.timed_call() is intended to measure longer operations in VCL. std.timestamp() exists already to add accurate measurements to the log. std.timed_call() is for cases where the duration is required in VCL, for example to enrich HTTP requests/responses. diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst index da3efa560..d97016976 100644 --- a/doc/sphinx/reference/vcl_var.rst +++ b/doc/sphinx/reference/vcl_var.rst @@ -1425,7 +1425,8 @@ now in VCL, ``now`` will always represent the point in time when the respective built-in VCL subroutine was entered. ``now`` is thus not suitable for any kind of time measurements. See - :ref:`std.timestamp()` in :ref:`vmod_std(3)`. + :ref:`std.timestamp()`, :ref:`std.now()` and + :ref:`std.timed_call()` in :ref:`vmod_std(3)`. sess ~~~~ diff --git a/vmod/tests/std_b00001.vtc b/vmod/tests/std_b00001.vtc index e0bc56023..6bba1c99f 100644 --- a/vmod/tests/std_b00001.vtc +++ b/vmod/tests/std_b00001.vtc @@ -1,4 +1,4 @@ -varnishtest "Test std.random()" +varnishtest "Test std.random(), std.now(), std.timed_call()" server s1 { rxreq @@ -6,14 +6,22 @@ server s1 { } -start varnish v1 -vcl+backend { + import vtc; import std; - sub vcl_deliver { + sub dice { set resp.http.rnd1 = std.random(0, 1); set resp.http.rnd2 = std.random(0, 10); set resp.http.rnd3 = std.random(8, 10); set resp.http.rnd4 = std.random(99, 100); } + + sub vcl_deliver { + set resp.http.t0 = std.integer(time=std.now()); + vtc.sleep(1s); + set resp.http.rolling-us = std.timed_call(dice) * 1000 * 1000; + set resp.http.t1 = std.integer(time=std.now()); + } } -start varnish v1 -cliok "debug.srandom" @@ -25,4 +33,6 @@ client c1 { expect resp.http.rnd2 == 0.390 expect resp.http.rnd3 == 8.585 expect resp.http.rnd4 == 99.636 + expect resp.http.t1 -gt resp.http.t0 + expect resp.http.rolling-us -gt 1 } -run diff --git a/vmod/vmod_std.c b/vmod/vmod_std.c index 8ce144eb9..78a288d57 100644 --- a/vmod/vmod_std.c +++ b/vmod/vmod_std.c @@ -370,3 +370,22 @@ vmod_ban_error(VRT_CTX) r = ""; return (r); } + +VCL_TIME v_matchproto_(td_std_now) +vmod_now(VRT_CTX) +{ + + (void) ctx; + return (VTIM_real()); +} + +VCL_DURATION v_matchproto_(td_std_timed_call) +vmod_timed_call(VRT_CTX, VCL_SUB sub) +{ + vtim_mono b; + + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + b = VTIM_mono(); + VRT_call(ctx, sub); + return (VTIM_mono() - b); +} diff --git a/vmod/vmod_std.vcc b/vmod/vmod_std.vcc index acd273c88..cef9590c4 100644 --- a/vmod/vmod_std.vcc +++ b/vmod/vmod_std.vcc @@ -659,6 +659,16 @@ Returns a textual error description of the last `std.ban()`_ call from the same task or the empty string if there either was no error or no `std.ban()`_ call. +$Function TIME now() + +Returns the current time. In contrast to the ``now`` built-in +variable, every call returns a new value. + +$Function DURATION timed_call(SUB) + +Call the given SUB and return a high precision measurement of the +execution time. + DEPRECATED functions ==================== From dridi.boukelmoune at gmail.com Tue Jul 19 06:52:06 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 19 Jul 2022 06:52:06 +0000 (UTC) Subject: [master] f89e900fa vtc: Skip tests when diff(1) or cmp(1) are missing Message-ID: <20220719065207.0094611D4EE@lists.varnish-cache.org> commit f89e900fa2f35ec04605c3245e2ea48e43f721d9 Author: Dridi Boukelmoune Date: Tue Jul 19 08:48:00 2022 +0200 vtc: Skip tests when diff(1) or cmp(1) are missing Some of the container images in our continuous integration are stripped of those commands. diff --git a/bin/varnishtest/tests/e00003.vtc b/bin/varnishtest/tests/e00003.vtc index 96bd91b32..e9906163e 100644 --- a/bin/varnishtest/tests/e00003.vtc +++ b/bin/varnishtest/tests/e00003.vtc @@ -1,5 +1,7 @@ varnishtest "ESI include" +feature cmd "command -v diff" + server s1 { rxreq expect req.http.esi0 == "foo" diff --git a/bin/varnishtest/tests/u00001.vtc b/bin/varnishtest/tests/u00001.vtc index d2e7e34ab..0b5bf125b 100644 --- a/bin/varnishtest/tests/u00001.vtc +++ b/bin/varnishtest/tests/u00001.vtc @@ -1,5 +1,6 @@ varnishtest "trivial run of varnishadm in script mode" +feature cmd "command -v diff" feature cmd "python3 -c 'import json'" varnish v1 -vcl {backend be none;} -start diff --git a/bin/varnishtest/tests/u00005.vtc b/bin/varnishtest/tests/u00005.vtc index 0ffe02465..7e22b22e3 100644 --- a/bin/varnishtest/tests/u00005.vtc +++ b/bin/varnishtest/tests/u00005.vtc @@ -1,5 +1,7 @@ varnishtest "varnishstat coverage" +feature cmd "command -v cmp" + server s1 { rxreq txresp From nils.goroll at uplex.de Wed Jul 20 15:29:06 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 20 Jul 2022 15:29:06 +0000 (UTC) Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument Message-ID: <20220720152906.18EBA109DE2@lists.varnish-cache.org> commit 5e5b442f53d27cfa6000f9bc7694fbce5a46af5c Author: Nils Goroll Date: Wed Jul 20 17:24:46 2022 +0200 VSLb() is not the choice for a single string argument spotted by gcc 9.4.0: error: format not a string literal and no format arguments [-Werror=format-security] diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index be3d56768..312ca0d01 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -976,7 +976,7 @@ VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize) CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (ctx->method != VCL_MET_RECV) { if (ctx->vsl != NULL) { - VSLb(ctx->vsl, SLT_VCL_Error, err); + VSLbs(ctx->vsl, SLT_VCL_Error, TOSTRAND(err)); } else { AN(ctx->msg); VSB_printf(ctx->msg, "%s\n", err); From dridi at varni.sh Wed Jul 20 15:31:11 2022 From: dridi at varni.sh (Dridi Boukelmoune) Date: Wed, 20 Jul 2022 15:31:11 +0000 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: <20220720152906.18EBA109DE2@lists.varnish-cache.org> References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> Message-ID: On Wed, Jul 20, 2022 at 3:29 PM Nils Goroll wrote: > > > commit 5e5b442f53d27cfa6000f9bc7694fbce5a46af5c > Author: Nils Goroll > Date: Wed Jul 20 17:24:46 2022 +0200 > > VSLb() is not the choice for a single string argument > > spotted by gcc 9.4.0: > > error: format not a string literal and no format arguments > [-Werror=format-security] > > diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c > index be3d56768..312ca0d01 100644 > --- a/bin/varnishd/cache/cache_vrt.c > +++ b/bin/varnishd/cache/cache_vrt.c > @@ -976,7 +976,7 @@ VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize) > CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); > if (ctx->method != VCL_MET_RECV) { > if (ctx->vsl != NULL) { > - VSLb(ctx->vsl, SLT_VCL_Error, err); > + VSLbs(ctx->vsl, SLT_VCL_Error, TOSTRAND(err)); Wouldn't this also work? VSLb(ctx->vsl, SLT_VCL_Error, "%s", err); > } else { > AN(ctx->msg); > VSB_printf(ctx->msg, "%s\n", err); > _______________________________________________ > varnish-commit mailing list > varnish-commit at varnish-cache.org > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit From nils.goroll at uplex.de Wed Jul 20 15:35:36 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Wed, 20 Jul 2022 17:35:36 +0200 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> Message-ID: On 20.07.22 17:31, Dridi Boukelmoune wrote: > Wouldn't this also work? > > VSLb(ctx->vsl, SLT_VCL_Error, "%s", err); Yes it should. But why not avoid an snprintf if we can? -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstra?e 32 22301 Hamburg tel +49 40 28805731 mob +49 170 2723133 fax +49 40 42949753 xmpp://slink at 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: From dridi at varni.sh Wed Jul 20 15:46:16 2022 From: dridi at varni.sh (Dridi Boukelmoune) Date: Wed, 20 Jul 2022 15:46:16 +0000 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> Message-ID: > On 20.07.22 17:31, Dridi Boukelmoune wrote: > > Wouldn't this also work? > > > > VSLb(ctx->vsl, SLT_VCL_Error, "%s", err); > > Yes it should. But why not avoid an snprintf if we can? Should we cook a coccinelle patch to move "%s" formats to strands counterparts? From phk at phk.freebsd.dk Wed Jul 20 15:58:07 2022 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Wed, 20 Jul 2022 15:58:07 +0000 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> Message-ID: <202207201558.26KFw7gN040129@critter.freebsd.dk> -------- Nils Goroll writes: > On 20.07.22 17:31, Dridi Boukelmoune wrote: > > Wouldn't this also work? > > > > VSLb(ctx->vsl, SLT_VCL_Error, "%s", err); > > Yes it should. But why not avoid an snprintf if we can? +0 At least on FreeBSD it is surprisingly cheap. In the normal case, for instance printf("%s", ...) it is free, because the compiler turns it into a fputs() instead. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From dridi at varni.sh Wed Jul 20 16:03:15 2022 From: dridi at varni.sh (Dridi Boukelmoune) Date: Wed, 20 Jul 2022 16:03:15 +0000 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: <202207201558.26KFw7gN040129@critter.freebsd.dk> References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> <202207201558.26KFw7gN040129@critter.freebsd.dk> Message-ID: > > Yes it should. But why not avoid an snprintf if we can? > > +0 > > At least on FreeBSD it is surprisingly cheap. In the normal > case, for instance printf("%s", ...) it is free, because the > compiler turns it into a fputs() instead. But that kind of optimization wouldn't happen for VSLb("%s") calls? That sounds like a very long shot. From phk at phk.freebsd.dk Wed Jul 20 17:29:44 2022 From: phk at phk.freebsd.dk (Poul-Henning Kamp) Date: Wed, 20 Jul 2022 17:29:44 +0000 Subject: [master] 5e5b442f5 VSLb() is not the choice for a single string argument In-Reply-To: References: <20220720152906.18EBA109DE2@lists.varnish-cache.org> <202207201558.26KFw7gN040129@critter.freebsd.dk> Message-ID: <202207201729.26KHTiKA040604@critter.freebsd.dk> -------- Dridi Boukelmoune writes: > > > Yes it should. But why not avoid an snprintf if we can? > > > > +0 > > > > At least on FreeBSD it is surprisingly cheap. In the normal > > case, for instance printf("%s", ...) it is free, because the > > compiler turns it into a fputs() instead. > > But that kind of optimization wouldn't happen for VSLb("%s") calls? > That sounds like a very long shot. I'd hope not :-) But "%s" is still surprisingly cheap, even when the compiler does not remove it. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk at FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From nils.goroll at uplex.de Tue Jul 26 10:00:12 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 26 Jul 2022 10:00:12 +0000 (UTC) Subject: [master] 3969a9c02 spatch to replace VSLb(..., "%s", s) with VSLbs(..., TOSTRAND(s)) Message-ID: <20220726100012.6B8D711BEC7@lists.varnish-cache.org> commit 3969a9c0241a7ba94e1360ad25f90bf908bf55f5 Author: Nils Goroll Date: Sun Jul 24 13:46:14 2022 +0200 spatch to replace VSLb(..., "%s", s) with VSLbs(..., TOSTRAND(s)) Added coccinelle patch and applied it. Indentation polished manually - can we teach spatch our cstyle? Ref 5e5b442f53d27cfa6000f9bc7694fbce5a46af5c diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index fde7e29a9..4dcf0d8fe 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -1140,7 +1140,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, bo->is_hitmiss = req->is_hitmiss; VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how); - VSLb(bo->vsl, SLT_VCL_use, "%s", VCL_Name(bo->vcl)); + VSLbs(bo->vsl, SLT_VCL_use, TOSTRAND(VCL_Name(bo->vcl))); VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how); THR_SetBusyobj(bo); diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 0fcb05739..a8bd61f5b 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -196,7 +196,7 @@ HSH_AddString(struct req *req, void *ctx, const char *str) AN(ctx); if (str != NULL) { VSHA256_Update(ctx, str, strlen(str)); - VSLb(req->vsl, SLT_Hash, "%s", str); + VSLbs(req->vsl, SLT_Hash, TOSTRAND(str)); } else VSHA256_Update(ctx, &str, 1); } diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 61849ab04..7d08808bb 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -415,7 +415,7 @@ http_PutField(struct http *to, int field, const char *string) p = WS_Copy(to->ws, string, -1); if (p == NULL) { http_fail(to); - VSLb(to->vsl, SLT_LostHeader, "%s", string); + VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(string)); return; } http_SetH(to, field, p); @@ -535,7 +535,8 @@ http_CollectHdrSep(struct http *hp, hdr_t hdr, const char *sep) x = Tlen(hp->hd[f]); if (b + x >= e) { http_fail(hp); - VSLb(hp->vsl, SLT_LostHeader, "%s", hdr + 1); + VSLbs(hp->vsl, SLT_LostHeader, + TOSTRAND(hdr + 1)); WS_Release(hp->ws, 0); return; } @@ -557,7 +558,7 @@ http_CollectHdrSep(struct http *hp, hdr_t hdr, const char *sep) if (b + lsep + x >= e) { http_fail(hp); - VSLb(hp->vsl, SLT_LostHeader, "%s", hdr + 1); + VSLbs(hp->vsl, SLT_LostHeader, TOSTRAND(hdr + 1)); WS_Release(hp->ws, 0); return; } @@ -1441,7 +1442,7 @@ http_CopyHome(const struct http *hp) p = WS_Copy(hp->ws, hp->hd[u].b, l + 1L); if (p == NULL) { http_fail(hp); - VSLb(hp->vsl, SLT_LostHeader, "%s", hp->hd[u].b); + VSLbs(hp->vsl, SLT_LostHeader, TOSTRAND(hp->hd[u].b)); return; } hp->hd[u].b = p; @@ -1457,7 +1458,7 @@ http_SetHeader(struct http *to, const char *header) CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); if (to->nhd >= to->shd) { - VSLb(to->vsl, SLT_LostHeader, "%s", header); + VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(header)); http_fail(to); return; } @@ -1511,14 +1512,14 @@ http_TimeHeader(struct http *to, const char *fmt, vtim_real now) CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); if (to->nhd >= to->shd) { - VSLb(to->vsl, SLT_LostHeader, "%s", fmt); + VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(fmt)); http_fail(to); return; } p = WS_Alloc(to->ws, strlen(fmt) + VTIM_FORMAT_SIZE); if (p == NULL) { http_fail(to); - VSLb(to->vsl, SLT_LostHeader, "%s", fmt); + VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(fmt)); return; } strcpy(p, fmt); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 81217159f..857b29cf8 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -1137,7 +1137,7 @@ CNT_Embark(struct worker *wrk, struct req *req) VCL_Refresh(&wrk->wpriv->vcl); req->vcl = wrk->wpriv->vcl; wrk->wpriv->vcl = NULL; - VSLb(req->vsl, SLT_VCL_use, "%s", VCL_Name(req->vcl)); + VSLbs(req->vsl, SLT_VCL_use, TOSTRAND(VCL_Name(req->vcl))); } AN(req->vcl); diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 312ca0d01..dff0692af 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -123,7 +123,7 @@ VPI_acl_log(VRT_CTX, const char *msg) CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(msg); if (ctx->vsl != NULL) - VSLb(ctx->vsl, SLT_VCL_acl, "%s", msg); + VSLbs(ctx->vsl, SLT_VCL_acl, TOSTRAND(msg)); else VSL(SLT_VCL_acl, 0, "%s", msg); } @@ -602,7 +602,7 @@ VRT_SetHdr(VRT_CTX, VCL_HEADER hs, const char *pfx, VCL_STRANDS s) if (u <= l) { WS_Release(hp->ws, 0); WS_MarkOverflow(hp->ws); - VSLb(ctx->vsl, SLT_LostHeader, "%s", hs->what + 1); + VSLbs(ctx->vsl, SLT_LostHeader, TOSTRAND(hs->what + 1)); return; } b = WS_Reservation(hp->ws); @@ -611,7 +611,8 @@ VRT_SetHdr(VRT_CTX, VCL_HEADER hs, const char *pfx, VCL_STRANDS s) if (p == NULL) { WS_Release(hp->ws, 0); WS_MarkOverflow(hp->ws); - VSLb(ctx->vsl, SLT_LostHeader, "%s", hs->what + 1); + VSLbs(ctx->vsl, SLT_LostHeader, + TOSTRAND(hs->what + 1)); return; } } else { diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c index ac6e9a9b9..becac9dc2 100644 --- a/bin/varnishd/cache/cache_vrt_filter.c +++ b/bin/varnishd/cache/cache_vrt_filter.c @@ -240,7 +240,7 @@ VCL_StackVFP(struct vfp_ctx *vc, const struct vcl *vcl, const char *fl) const struct vfilter *vp; AN(fl); - VSLb(vc->wrk->vsl, SLT_Filters, "%s", fl); + VSLbs(vc->wrk->vsl, SLT_Filters, TOSTRAND(fl)); while (1) { vp = vcl_filter_list_iter(1, &vrt_filters, &vcl->filters, &fl); @@ -260,7 +260,7 @@ VCL_StackVDP(struct req *req, const struct vcl *vcl, const char *fl) struct vrt_ctx ctx[1]; AN(fl); - VSLb(req->vsl, SLT_Filters, "%s", fl); + VSLbs(req->vsl, SLT_Filters, TOSTRAND(fl)); INIT_OBJ(ctx, VRT_CTX_MAGIC); VCL_Req2Ctx(ctx, req); diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c index 070822f36..a71edc9a3 100644 --- a/bin/varnishd/cache/cache_vrt_vcl.c +++ b/bin/varnishd/cache/cache_vrt_vcl.c @@ -555,9 +555,10 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo, wrk->cur_method = method; wrk->seen_methods |= method; AN(ctx.vsl); - VSLb(ctx.vsl, SLT_VCL_call, "%s", VCL_Method_Name(method)); + VSLbs(ctx.vsl, SLT_VCL_call, TOSTRAND(VCL_Method_Name(method))); func(&ctx, VSUB_STATIC, NULL); - VSLb(ctx.vsl, SLT_VCL_return, "%s", VCL_Return_Name(wrk->handling)); + VSLbs(ctx.vsl, SLT_VCL_return, + TOSTRAND(VCL_Return_Name(wrk->handling))); wrk->cur_method |= 1; // Magic marker if (wrk->handling == VCL_RET_FAIL) wrk->stats->vcl_fail++; diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 2db4f8efa..46c663eb7 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -72,7 +72,7 @@ v1d_error(struct req *req, const char *msg) "Server: Varnish\r\n" "Connection: close\r\n\r\n"; - VSLb(req->vsl, SLT_Error, "%s", msg); + VSLbs(req->vsl, SLT_Error, TOSTRAND(msg)); VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); VSLb(req->vsl, SLT_RespStatus, "500"); VSLb(req->vsl, SLT_RespReason, "Internal Server Error"); diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index 641f6e805..cc61649fd 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -199,7 +199,7 @@ http1_minimal_response(struct req *req, uint16_t status) VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); VSLb(req->vsl, SLT_RespStatus, "%03d", status); - VSLb(req->vsl, SLT_RespReason, "%s", reason); + VSLbs(req->vsl, SLT_RespReason, TOSTRAND(reason)); if (status >= 400) req->err_code = status; diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index 69c3099d0..7d057fe2e 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -77,8 +77,8 @@ v1f_read(const struct vfp_ctx *vc, struct http_conn *htc, void *d, ssize_t len) i = read(*htc->rfd, p, len); if (i < 0) { VTCP_Assert(i); - VSLb(vc->wrk->vsl, SLT_FetchError, - "%s", VAS_errtxt(errno)); + VSLbs(vc->wrk->vsl, SLT_FetchError, + TOSTRAND(VAS_errtxt(errno))); return (i); } if (i == 0) diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c index f5e08b7da..a19e936d5 100644 --- a/bin/varnishd/http2/cache_http2_deliver.c +++ b/bin/varnishd/http2/cache_http2_deliver.c @@ -181,7 +181,8 @@ h2_minimal_response(struct req *req, uint16_t status) VSLb(req->vsl, SLT_RespProtocol, "HTTP/2.0"); VSLb(req->vsl, SLT_RespStatus, "%03d", status); - VSLb(req->vsl, SLT_RespReason, "%s", http_Status2Reason(status, NULL)); + VSLbs(req->vsl, SLT_RespReason, + TOSTRAND(http_Status2Reason(status, NULL))); if (status >= 400) req->err_code = status; diff --git a/tools/coccinelle/vslb_single_string.cocci b/tools/coccinelle/vslb_single_string.cocci new file mode 100644 index 000000000..6e97d6490 --- /dev/null +++ b/tools/coccinelle/vslb_single_string.cocci @@ -0,0 +1,10 @@ +/* + * This patch avoids printf formatting with VSLb + */ + +@@ +expression vsl, tag, str; +@@ + +- VSLb(vsl, tag, "%s", str) ++ VSLbs(vsl, tag, TOSTRAND(str)) diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c index 091ad3048..d34d1f227 100644 --- a/vmod/vmod_debug.c +++ b/vmod/vmod_debug.c @@ -813,7 +813,8 @@ xyzzy_sethdr(VRT_CTX, VCL_HEADER hdr, VCL_STRANDS s) } else { b = VRT_StrandsWS(hp->ws, hdr->what + 1, s); if (b == NULL) { - VSLb(ctx->vsl, SLT_LostHeader, "%s", hdr->what + 1); + VSLbs(ctx->vsl, SLT_LostHeader, + TOSTRAND(hdr->what + 1)); } else { if (*b != '\0') AN(WS_Allocated(hp->ws, b, strlen(b) + 1)); diff --git a/vmod/vmod_debug_acl.c b/vmod/vmod_debug_acl.c index 385565891..30a35df2e 100644 --- a/vmod/vmod_debug_acl.c +++ b/vmod/vmod_debug_acl.c @@ -200,7 +200,7 @@ xyzzy_sweep_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, VCL_INT step) VSB_putc(vsb, "-X"[i]); if ((j & 0x3f) == 0x3f) { AZ(VSB_finish(vsb)); - VSLb(ctx->vsl, SLT_Debug, "%s", VSB_data(vsb)); + VSLbs(ctx->vsl, SLT_Debug, TOSTRAND(VSB_data(vsb))); sz =VSB_len(vsb); assert (sz > 0); VSHA256_Update(vsha, VSB_data(vsb), sz); @@ -211,7 +211,7 @@ xyzzy_sweep_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, VCL_INT step) } if (VSB_len(vsb)) { AZ(VSB_finish(vsb)); - VSLb(ctx->vsl, SLT_Debug, "%s", VSB_data(vsb)); + VSLbs(ctx->vsl, SLT_Debug, TOSTRAND(VSB_data(vsb))); sz =VSB_len(vsb); assert (sz > 0); VSHA256_Update(vsha, VSB_data(vsb), sz); From nils.goroll at uplex.de Tue Jul 26 10:32:04 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 26 Jul 2022 10:32:04 +0000 (UTC) Subject: [master] 710a9fb1e Silence Flexelint for TOSTRAND, TOSTRANDS Message-ID: <20220726103204.E568211CE3C@lists.varnish-cache.org> commit 710a9fb1ed78d0a4aa377ad40839eb203fc25537 Author: Nils Goroll Date: Tue Jul 26 12:26:09 2022 +0200 Silence Flexelint for TOSTRAND, TOSTRANDS diff --git a/flint.lnt b/flint.lnt index d20948346..3724d99f1 100644 --- a/flint.lnt +++ b/flint.lnt @@ -244,6 +244,10 @@ -emacro(160, _vtake) // The sequence '( {' is non standard +rw( __typeof__ ) +/////////////////////////////////////////////////////////////////////// +// +-emacro(446, TOSTRAND, TOSTRANDS) // side effect in initializer + /////////////////////////////////////////////////////////////////////// // From nils.goroll at uplex.de Tue Jul 26 10:32:05 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 26 Jul 2022 10:32:05 +0000 (UTC) Subject: [master] 5d5653a87 Reapply check_obj.cocci Message-ID: <20220726103205.093F311CE3F@lists.varnish-cache.org> commit 5d5653a875e3918667ddcf6072a0e20a1460dd58 Author: Nils Goroll Date: Tue Jul 26 12:02:09 2022 +0200 Reapply check_obj.cocci diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index bb244ef99..4394a52ed 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -460,7 +460,7 @@ vcc_ParseImport(struct vcc *tl) vimold = msym->import; if (vimold != NULL) { - CHECK_OBJ_NOTNULL(vimold, VMOD_IMPORT_MAGIC); + CHECK_OBJ(vimold, VMOD_IMPORT_MAGIC); if (!strcmp(vimold->file_id, vim->file_id)) { /* Identical import is OK */ } else { From nils.goroll at uplex.de Tue Jul 26 10:32:05 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 26 Jul 2022 10:32:05 +0000 (UTC) Subject: [master] 69ca9b7be Reapply printf_nofmt.cocci Message-ID: <20220726103205.248D011CE43@lists.varnish-cache.org> commit 69ca9b7bea61ca418369d2611a6d5c54d1e7b398 Author: Nils Goroll Date: Tue Jul 26 12:04:04 2022 +0200 Reapply printf_nofmt.cocci Manually replaced %% from printf format with % diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 473c2f1aa..31b98c9c5 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -159,9 +159,9 @@ pan_htc(struct vsb *vsb, const struct http_conn *htc) return; if (htc->rfd != NULL) VSB_printf(vsb, "fd = %d (@%p),\n", *htc->rfd, htc->rfd); - VSB_printf(vsb, "doclose = "); + VSB_cat(vsb, "doclose = "); pan_stream_close(vsb, htc->doclose); - VSB_printf(vsb, "\n"); + VSB_cat(vsb, "\n"); WS_Panic(vsb, htc->ws); VSB_printf(vsb, "{rxbuf_b, rxbuf_e} = {%p, %p},\n", htc->rxbuf_b, htc->rxbuf_e); @@ -726,7 +726,7 @@ pan_ic(const char *func, const char *file, int line, const char *cond, if (pthread_mutex_lock(&panicstr_mtx)) { /* Reentrant panic */ - VSB_printf(pan_vsb,"\n\nPANIC REENTRANCY\n\n"); + VSB_cat(pan_vsb, "\n\nPANIC REENTRANCY\n\n"); abort(); } panicy = pthread_self(); diff --git a/bin/varnishd/common/common_vext.c b/bin/varnishd/common/common_vext.c index 1c1e1ee38..fffd9a8d5 100644 --- a/bin/varnishd/common/common_vext.c +++ b/bin/varnishd/common/common_vext.c @@ -113,7 +113,7 @@ vext_copyin(struct vsb *vident) u %= 26; VSB_printf(vp->vsb, "%c", 'a' + (char)u); } - VSB_printf(vp->vsb, ".so"); + VSB_cat(vp->vsb, ".so"); AZ(VSB_finish(vp->vsb)); fprintf(stderr, "ee2 %s\n", VSB_data(vp->vsb)); fdo = open(VSB_data(vp->vsb), O_WRONLY|O_CREAT|O_EXCL, 0700); diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c index dd9210201..30d95a531 100644 --- a/lib/libvarnish/vsb.c +++ b/lib/libvarnish/vsb.c @@ -612,12 +612,12 @@ VSB_quote_pfx(struct vsb *s, const char *pfx, const void *v, int len, int how) if (how & VSB_QUOTE_CSTR) { VSB_printf(s, "\\n\"\n%s\"", pfx); } else if (how & VSB_QUOTE_JSON) { - VSB_printf(s, "\\n"); + VSB_cat(s, "\\n"); } else if (how & VSB_QUOTE_NONL) { VSB_putc(s, *q); nl = 1; } else { - VSB_printf(s, "\\n"); + VSB_cat(s, "\\n"); } break; case '\r': diff --git a/lib/libvarnish/vsb_test.c b/lib/libvarnish/vsb_test.c index 7ca3beec7..b41512343 100644 --- a/lib/libvarnish/vsb_test.c +++ b/lib/libvarnish/vsb_test.c @@ -135,34 +135,34 @@ main(int argc, char *argv[]) VSB_clear(vsbo); VSB_printf(vsbo, "0x%02x: ", tc->how); VSB_quote(vsbo, tc->in, tc->inlen, VSB_QUOTE_HEX); - VSB_printf(vsbo, " -> "); + VSB_cat(vsbo, " -> "); VSB_quote(vsbo, VSB_data(vsb), -1, VSB_QUOTE_HEX); - VSB_printf(vsbo, " ("); + VSB_cat(vsbo, " ("); VSB_quote(vsbo, tc->out, -1, VSB_QUOTE_ESCHEX); - VSB_printf(vsbo, ")"); + VSB_cat(vsbo, ")"); if (strcmp(VSB_data(vsb), tc->out)) { - VSB_printf(vsbo, "\nShould have been:\n\t"); + VSB_cat(vsbo, "\nShould have been:\n\t"); VSB_quote(vsbo, tc->out, -1, VSB_QUOTE_HEX); - VSB_printf(vsbo, "\nThat's:\n\t"); + VSB_cat(vsbo, "\nThat's:\n\t"); VSB_quote(vsbo, VSB_data(vsb), -1, VSB_QUOTE_ESCHEX); - VSB_printf(vsbo, "\nvs:\n\t"); + VSB_cat(vsbo, "\nvs:\n\t"); VSB_quote(vsbo, tc->out, -1, VSB_QUOTE_ESCHEX); VSB_printf(vsbo, "\nFlags 0x%02x = ", tc->how); if (!tc->how) - VSB_printf(vsbo, "\n\t0"); + VSB_cat(vsbo, "\n\t0"); if (tc->how & VSB_QUOTE_NONL) - VSB_printf(vsbo, "\n\tVSB_QUOTE_NONL"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_NONL"); if (tc->how & VSB_QUOTE_JSON) - VSB_printf(vsbo, "\n\tVSB_QUOTE_JSON"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_JSON"); if (tc->how & VSB_QUOTE_HEX) - VSB_printf(vsbo, "\n\tVSB_QUOTE_HEX"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_HEX"); if (tc->how & VSB_QUOTE_CSTR) - VSB_printf(vsbo, "\n\tVSB_QUOTE_CSTR"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_CSTR"); if (tc->how & VSB_QUOTE_UNSAFE) - VSB_printf(vsbo, "\n\tVSB_QUOTE_UNSAFE"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_UNSAFE"); if (tc->how & VSB_QUOTE_ESCHEX) - VSB_printf(vsbo, "\n\tVSB_QUOTE_ESCHEX"); - VSB_printf(vsbo, "\n\n"); + VSB_cat(vsbo, "\n\tVSB_QUOTE_ESCHEX"); + VSB_cat(vsbo, "\n\n"); err = 1; } AZ(VSB_finish(vsbo)); diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c index 4ee895157..4ccefea4f 100644 --- a/lib/libvcc/vcc_acl.c +++ b/lib/libvcc/vcc_acl.c @@ -544,7 +544,7 @@ vcc_acl_emit(struct vcc *tl, const struct symbol *sym) func = VSB_new_auto(); AN(func); - VSB_printf(func, "match_acl_"); + VSB_cat(func, "match_acl_"); VCC_PrintCName(func, sym->name, NULL); AZ(VSB_finish(func)); diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c index 677e36dbb..1d4eb6453 100644 --- a/lib/libvcc/vcc_expr.c +++ b/lib/libvcc/vcc_expr.c @@ -979,8 +979,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, vcc_type_t fmt) while (tl->t->tok == '*' || tl->t->tok == '/' || tl->t->tok == '%') { if (tl->t->tok == '%' && ((*e)->fmt != INT)) { - VSB_printf(tl->sb, - "Operator %% only possible on INT.\n"); + VSB_cat(tl->sb, "Operator % only possible on INT.\n"); vcc_ErrWhere(tl, tl->t); return; } diff --git a/lib/libvcc/vcc_source.c b/lib/libvcc/vcc_source.c index 57167b37e..a0a93cdc0 100644 --- a/lib/libvcc/vcc_source.c +++ b/lib/libvcc/vcc_source.c @@ -120,7 +120,7 @@ vcc_include_glob_file(struct vcc *tl, const struct source *src_sp, } break; case GLOB_NOMATCH: - VSB_printf(tl->sb, "glob pattern matched no files.\n"); + VSB_cat(tl->sb, "glob pattern matched no files.\n"); tl->err = 1; break; default: diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index 7feb88cf9..9264200c1 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -321,7 +321,7 @@ vcc_UintVal(struct vcc *tl) } retval = (int64_t)round(tl->t->num); if (retval < 0) { - VSB_printf(tl->sb, "UINT cannot be negative\n"); + VSB_cat(tl->sb, "UINT cannot be negative\n"); vcc_ErrWhere(tl, tl->t); return (0); } From nils.goroll at uplex.de Tue Jul 26 10:32:05 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Tue, 26 Jul 2022 10:32:05 +0000 (UTC) Subject: [master] fe97d31c4 Partially reapply return.cocci Message-ID: <20220726103205.41DB111CE47@lists.varnish-cache.org> commit fe97d31c4b3c7388a4f33b5b1130f13b4639f8c5 Author: Nils Goroll Date: Tue Jul 26 12:09:07 2022 +0200 Partially reapply return.cocci diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 7d08808bb..7c6a127f6 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -141,22 +141,22 @@ http_hdr_flags(const char *b, const char *e) struct http_hdrflg *retval; if (e == NULL) - return(NULL); + return (NULL); assert(e > b); u = (unsigned)(e - b); assert(b + u == e); if (u < 2 || u > 19) // MIN_WORD_LENGTH & MAX_WORD_LENGTH - return(NULL); + return (NULL); if (u > 3) u += http_asso_values[((const uint8_t*)b)[3]]; if (u > 38) // MAX_HASH_VALUE - return(NULL); + return (NULL); retval = &http_hdrflg[u]; if (retval->hdr == NULL) - return(NULL); + return (NULL); if (!http_hdr_at(retval->hdr + 1, b, e - b)) - return(NULL); - return(retval); + return (NULL); + return (retval); } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_vrt_filter.c b/bin/varnishd/cache/cache_vrt_filter.c index becac9dc2..1cfedc449 100644 --- a/bin/varnishd/cache/cache_vrt_filter.c +++ b/bin/varnishd/cache/cache_vrt_filter.c @@ -124,7 +124,7 @@ vrt_addfilter(VRT_CTX, const struct vfp *vfp, const struct vdp *vdp) vp->name = name; vp->nlen = strlen(name); VTAILQ_INSERT_TAIL(hd, vp, list); - return(err); + return (err); } const char * diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index 7d057fe2e..d10df7ac5 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -130,8 +130,7 @@ v1f_chunked_pull(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, do { lr = v1f_read(vc, htc, buf + u, 1); if (lr <= 0) - return (VFP_Error(vc, - "chunked read err")); + return (VFP_Error(vc, "chunked read err")); } while (u == 1 && buf[0] == '0' && buf[u] == '0'); if (!vct_ishex(buf[u])) break; diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c index 88c688f08..8b90b97c8 100644 --- a/lib/libvarnish/vnum.c +++ b/lib/libvarnish/vnum.c @@ -119,7 +119,7 @@ SF_Parse_Integer(const char **ipp, const char **errtxt) int sign; retval = sf_parse_int(ipp, errtxt, &sign, 15); - return(retval * sign); + return (retval * sign); } /********************************************************************** @@ -182,7 +182,7 @@ SF_Parse_Decimal(const char **ipp, int strict, const char **errtxt) retval = SF_Parse_Number(ipp, strict, errtxt); if (errno) - return(retval); + return (retval); if (retval < VRT_DECIMAL_MIN || retval > VRT_DECIMAL_MAX) BAIL(err_fatnum); return (retval); @@ -345,9 +345,9 @@ VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel) fval = SF_Parse_Number(&p, 1, &errtxt); if (errno) - return(errtxt); + return (errtxt); if (fval < 0) - return(err_invalid_num); + return (err_invalid_num); fval = VNUM_bytes_unit(fval, p, NULL, rel, &errtxt); if (errno) diff --git a/lib/libvcc/vcc_source.c b/lib/libvcc/vcc_source.c index a0a93cdc0..f717e1192 100644 --- a/lib/libvcc/vcc_source.c +++ b/lib/libvcc/vcc_source.c @@ -161,7 +161,7 @@ vcc_lex_include(struct vcc *tl, const struct source *src_sp, struct token *t) } else { VSB_cat(tl->sb, "Unknown include flag:\n"); vcc_ErrWhere(tl, t); - return(t); + return (t); } tok1 = VTAILQ_NEXT(t, src_list); AN(tok1); @@ -196,7 +196,7 @@ vcc_lex_include(struct vcc *tl, const struct source *src_sp, struct token *t) "include \"./xxxxx\"; needs absolute " "filename of including file.\n"); vcc_ErrWhere(tl, tok1); - return(t); + return (t); } vsb = VSB_new_auto(); AN(vsb); diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c index 82ab2885f..580b6cb2f 100644 --- a/lib/libvcc/vcc_token.c +++ b/lib/libvcc/vcc_token.c @@ -502,7 +502,7 @@ vcc_lex_number(struct vcc *tl, struct source *sp, const char *p) if (q - p > 13 || r - q > 3) { VSB_cat(tl->sb, "Too many digits for real.\n"); vcc_ErrWhere(tl, tl->t); - return(NULL); + return (NULL); } tl->t->num = strtod(p, &s); assert(s == tl->t->e); diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index 4394a52ed..3de227b21 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -260,7 +260,7 @@ vcc_VmodLoad(const struct vcc *tl, struct vmod_import *vim) if (err != NULL) return (-1); - return(0); + return (0); } static void v_matchproto_(vcc_do_stanza_f) diff --git a/vmod/vmod_debug_acl.c b/vmod/vmod_debug_acl.c index 30a35df2e..b7b772593 100644 --- a/vmod/vmod_debug_acl.c +++ b/vmod/vmod_debug_acl.c @@ -183,7 +183,7 @@ xyzzy_sweep_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, VCL_INT step) AN(ip1); assert(step > 0); if (setup_sweep(ctx, asw, ip0, ip1, step)) - return(NULL); + return (NULL); vsb = VSB_new_auto(); AN(vsb); @@ -247,7 +247,7 @@ xyzzy_time_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, assert(turnus > 0); if (setup_sweep(ctx, asw, ip0, ip1, step)) - return(-1); + return (-1); do { (void)VRT_acl_match(ctx, acl, asw->probe); } while (step_sweep(asw) <= 0); From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:06 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:06 +0000 (UTC) Subject: [master] b277667ac circleci: Stop pretending CentOS is dpkg-based Message-ID: <20220727171007.03FE81060A2@lists.varnish-cache.org> commit b277667acc95ce5e39c950cedf0f0bc5e7bb2d0d Author: Dridi Boukelmoune Date: Fri Mar 18 10:32:18 2022 +0100 circleci: Stop pretending CentOS is dpkg-based Everyone knows its package manager is APPX. diff --git a/.circleci/make-deb-packages.sh b/.circleci/make-deb-packages.sh index 8437de094..2f05e99d2 100755 --- a/.circleci/make-deb-packages.sh +++ b/.circleci/make-deb-packages.sh @@ -12,10 +12,10 @@ echo "PARAM_DIST: $PARAM_DIST" if [ -z "$PARAM_RELEASE" ]; then - echo "Env variable PARAM_RELEASE is not set! For example PARAM_RELEASE=8, for CentOS 8" + echo "Env variable PARAM_RELEASE is not set! For example PARAM_RELEASE=focal for Ubuntu 20.04" exit 1 elif [ -z "$PARAM_DIST" ]; then - echo "Env variable PARAM_DIST is not set! For example PARAM_DIST=centos" + echo "Env variable PARAM_DIST is not set! For example PARAM_DIST=debian" exit 1 fi From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:07 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:07 +0000 (UTC) Subject: [master] 6547c2b9c circleci: Add Ubuntu jobs up to the incoming 22.04 Message-ID: <20220727171007.15FAD1060A5@lists.varnish-cache.org> commit 6547c2b9c49e96ea44fa7819fb75ed3ec9ef7530 Author: Dridi Boukelmoune Date: Fri Mar 18 10:38:38 2022 +0100 circleci: Add Ubuntu jobs up to the incoming 22.04 And lay out the arbitrary selection rule for the 32bit build. diff --git a/.circleci/config.yml b/.circleci/config.yml index bf727b86f..0ddcc41f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -398,11 +398,20 @@ workflows: dist: debian release: buster extra_conf: --enable-asan --enable-ubsan --enable-workspace-emulator + # oldest ubuntu goes 32bit - distcheck: name: distcheck_ubuntu_bionic prefix: i386/ dist: ubuntu release: bionic + - distcheck: + name: distcheck_ubuntu_focal + dist: ubuntu + release: focal + - distcheck: + name: distcheck_ubuntu_jammy + dist: ubuntu + release: jammy - distcheck: name: distcheck_alpine dist: alpine @@ -427,6 +436,7 @@ workflows: platform: - ubuntu:bionic - ubuntu:focal + - ubuntu:jammy - debian:bullseye - debian:buster - debian:stretch From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:07 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:07 +0000 (UTC) Subject: [master] 45edd19f2 circleci: Add missing Debian job Message-ID: <20220727171007.387191060A9@lists.varnish-cache.org> commit 45edd19f24ba916105225fd52e1296ef365b04cc Author: Dridi Boukelmoune Date: Fri Mar 18 10:46:11 2022 +0100 circleci: Add missing Debian job And lay out the arbitrary selection rule for the sanitizer build. diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ddcc41f6..4a6517f06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -393,10 +393,15 @@ workflows: name: distcheck_fedora_rawhide dist: fedora release: rawhide + # latest debian uses sanitizers - distcheck: name: distcheck_debian_buster dist: debian release: buster + - distcheck: + name: distcheck_debian_bullseye + dist: debian + release: bullseye extra_conf: --enable-asan --enable-ubsan --enable-workspace-emulator # oldest ubuntu goes 32bit - distcheck: @@ -437,8 +442,8 @@ workflows: - ubuntu:bionic - ubuntu:focal - ubuntu:jammy - - debian:bullseye - debian:buster + - debian:bullseye - debian:stretch - centos:7 - centos:stream From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:07 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:07 +0000 (UTC) Subject: [master] be24b0752 circleci: Fedora is our witness Message-ID: <20220727171007.56D7F1060AD@lists.varnish-cache.org> commit be24b075262d2b8d36a9219ec94e73a18413d921 Author: Dridi Boukelmoune Date: Fri Mar 18 10:50:33 2022 +0100 circleci: Fedora is our witness diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a6517f06..96ac1b70d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -210,6 +210,10 @@ jobs: release: description: the release name (stretch|buster|bionic|focal) type: string + check: + description: the check to perform during the build + default: distcheck + type: string extra_conf: description: platform-specific configure arguments default: "" @@ -343,7 +347,7 @@ jobs: << parameters.extra_conf >> sudo -u varnish \ --preserve-env=ASAN_OPTIONS,LSAN_OPTIONS,TSAN_OPTIONS,UBSAN_OPTIONS \ - make distcheck VERBOSE=1 -j 4 -k \ + make << parameters.check >> VERBOSE=1 -j 4 -k \ DISTCHECK_CONFIGURE_FLAGS="<< pipeline.parameters.configure_args >> \ << parameters.extra_conf >>" ' @@ -385,10 +389,12 @@ workflows: name: distcheck_almalinux_8 dist: almalinux release: "8" + # fedora is our witness - distcheck: name: distcheck_fedora_latest dist: fedora release: latest + check: witness - distcheck: name: distcheck_fedora_rawhide dist: fedora From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:07 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:07 +0000 (UTC) Subject: [master] 4fd57b4c8 circleci: Rename distcheck jobs to build Message-ID: <20220727171007.743B81060B2@lists.varnish-cache.org> commit 4fd57b4c8da2e7385974d6d2f48ff441000bddad Author: Dridi Boukelmoune Date: Wed Jul 27 15:12:32 2022 +0200 circleci: Rename distcheck jobs to build And rename the "check" parameter to "make_target" to avoid ambiguity. Better diff with the --word-diff --word-diff-regex=[a-z]+ options. diff --git a/.circleci/config.yml b/.circleci/config.yml index 96ac1b70d..5b6652118 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -198,7 +198,7 @@ jobs: root: . paths: - "packages" - distcheck: + build: parameters: prefix: description: the container image prefix (repository or architecture) @@ -210,8 +210,8 @@ jobs: release: description: the release name (stretch|buster|bionic|focal) type: string - check: - description: the check to perform during the build + make_target: + description: the make target to execute during the build default: distcheck type: string extra_conf: @@ -229,7 +229,7 @@ jobs: command: yum install -y docker - checkout - run: - name: Extract and distcheck + name: Extract and build command: | docker create --name workspace -v /workspace << parameters.prefix >><< parameters.dist >>:<< parameters.release >> /bin/true docker cp /workspace workspace:/ @@ -347,7 +347,7 @@ jobs: << parameters.extra_conf >> sudo -u varnish \ --preserve-env=ASAN_OPTIONS,LSAN_OPTIONS,TSAN_OPTIONS,UBSAN_OPTIONS \ - make << parameters.check >> VERBOSE=1 -j 4 -k \ + make << parameters.make_target >> VERBOSE=1 -j 4 -k \ DISTCHECK_CONFIGURE_FLAGS="<< pipeline.parameters.configure_args >> \ << parameters.extra_conf >>" ' @@ -376,60 +376,60 @@ workflows: - << pipeline.parameters.build-pkgs >> - << pipeline.parameters.dist-url >> jobs: - - distcheck: - name: distcheck_centos_7 + - build: + name: build_centos_7 dist: centos release: "7" - - distcheck: - name: distcheck_centos_stream + - build: + name: build_centos_stream prefix: quay.io/centos/ dist: centos release: stream - - distcheck: - name: distcheck_almalinux_8 + - build: + name: build_almalinux_8 dist: almalinux release: "8" # fedora is our witness - - distcheck: - name: distcheck_fedora_latest + - build: + name: build_fedora_latest dist: fedora release: latest - check: witness - - distcheck: - name: distcheck_fedora_rawhide + make_target: witness + - build: + name: build_fedora_rawhide dist: fedora release: rawhide # latest debian uses sanitizers - - distcheck: - name: distcheck_debian_buster + - build: + name: build_debian_buster dist: debian release: buster - - distcheck: - name: distcheck_debian_bullseye + - build: + name: build_debian_bullseye dist: debian release: bullseye extra_conf: --enable-asan --enable-ubsan --enable-workspace-emulator # oldest ubuntu goes 32bit - - distcheck: - name: distcheck_ubuntu_bionic + - build: + name: build_ubuntu_bionic prefix: i386/ dist: ubuntu release: bionic - - distcheck: - name: distcheck_ubuntu_focal + - build: + name: build_ubuntu_focal dist: ubuntu release: focal - - distcheck: - name: distcheck_ubuntu_jammy + - build: + name: build_ubuntu_jammy dist: ubuntu release: jammy - - distcheck: - name: distcheck_alpine + - build: + name: build_alpine dist: alpine release: "latest" #extra_conf: --without-jemalloc - - distcheck: - name: distcheck_archlinux + - build: + name: build_archlinux dist: archlinux release: base-devel packaging: From dridi.boukelmoune at gmail.com Wed Jul 27 17:10:07 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:10:07 +0000 (UTC) Subject: [master] cc5d10d62 circleci: New almalinux 9 jobs Message-ID: <20220727171007.94CBC1060B6@lists.varnish-cache.org> commit cc5d10d628f371d98838f709e88d0a770ad5b2e8 Author: Dridi Boukelmoune Date: Wed Jul 27 15:15:15 2022 +0200 circleci: New almalinux 9 jobs diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b6652118..2920b72c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -238,6 +238,12 @@ jobs: centos|almalinux|fedora) yum groupinstall -y "Development Tools" case "<< parameters.dist >>:<< parameters.release >>" in + almalinux:9) + dnf install -y "dnf-command(config-manager)" + yum config-manager --set-enabled crb + yum install -y diffutils + yum install -y epel-release + ;; centos:stream|almalinux:8) dnf install -y "dnf-command(config-manager)" yum config-manager --set-enabled powertools @@ -389,6 +395,10 @@ workflows: name: build_almalinux_8 dist: almalinux release: "8" + - build: + name: build_almalinux_9 + dist: almalinux + release: "9" # fedora is our witness - build: name: build_fedora_latest @@ -454,6 +464,7 @@ workflows: - centos:7 - centos:stream - almalinux:8 + - almalinux:9 - fedora:latest - alpine:3 rclass: diff --git a/.circleci/make-rpm-packages.sh b/.circleci/make-rpm-packages.sh index 566fbc2ca..848084bc4 100755 --- a/.circleci/make-rpm-packages.sh +++ b/.circleci/make-rpm-packages.sh @@ -14,6 +14,11 @@ elif [ -z "$PARAM_DIST" ]; then fi case "$PARAM_DIST:$PARAM_RELEASE" in + almalinux:9) + dnf install -y 'dnf-command(config-manager)' + yum config-manager --set-enabled crb + yum install -y epel-release + ;; centos:stream|almalinux:8) dnf install -y 'dnf-command(config-manager)' yum config-manager --set-enabled powertools From dridi.boukelmoune at gmail.com Wed Jul 27 17:29:05 2022 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 27 Jul 2022 17:29:05 +0000 (UTC) Subject: [master] f83c1f58d circleci: Remove debian:stretch job remnant Message-ID: <20220727172905.81D5810711F@lists.varnish-cache.org> commit f83c1f58d22215fd39fb9c155a7661ea46583010 Author: Dridi Boukelmoune Date: Wed Jul 27 19:28:00 2022 +0200 circleci: Remove debian:stretch job remnant diff --git a/.circleci/config.yml b/.circleci/config.yml index 2920b72c5..0a32ce358 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -208,7 +208,7 @@ jobs: description: the Linux distribution (debian|ubuntu) type: string release: - description: the release name (stretch|buster|bionic|focal) + description: the release name (buster|bullseye|bionic|focal|jammy) type: string make_target: description: the make target to execute during the build @@ -460,7 +460,6 @@ workflows: - ubuntu:jammy - debian:buster - debian:bullseye - - debian:stretch - centos:7 - centos:stream - almalinux:8 From nils.goroll at uplex.de Thu Jul 28 08:19:07 2022 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 28 Jul 2022 08:19:07 +0000 (UTC) Subject: [master] 7779839d8 Extend check_obj.cocci to the trivial base case Message-ID: <20220728081907.24FA79AE0@lists.varnish-cache.org> commit 7779839d8cc023ce79e024c24e97bc2e1b04bd74 Author: Nils Goroll Date: Thu Jul 28 10:17:53 2022 +0200 Extend check_obj.cocci to the trivial base case does not apply in varnish-cache, but found useful in a vmod diff --git a/tools/coccinelle/check_obj.cocci b/tools/coccinelle/check_obj.cocci index 37eff6b68..d82510210 100644 --- a/tools/coccinelle/check_obj.cocci +++ b/tools/coccinelle/check_obj.cocci @@ -1,5 +1,6 @@ /* - * This patch removes a redundant null check. + * This patch removes a redundant null check and replaces assertions + * on the magic with CHECK_OBJ() */ @@ @@ -11,3 +12,10 @@ if (obj != NULL) { + CHECK_OBJ(obj, magic); ... } + +@@ +expression obj, magicval; +@@ + +- assert(obj->magic == magicval); ++ CHECK_OBJ(obj, magicval);