Mailing List Archive

[master] 2d2fc8990 vte: Don't count '\t' and '\n' delimiters
commit 2d2fc8990c99641cf460dded11179d2a2edb4c5d
Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
Date: Mon Dec 4 17:19:47 2023 +0100

vte: Don't count '\t' and '\n' delimiters

Since the maximum space between fields is 3, it should have been obvious
that something was off while inspecting test cases. Before this fix, the
fields were aligned, but sometimes the space between fields was too wide
and in particular before right-aligned fields.

diff --git a/bin/varnishtest/tests/r02471.vtc b/bin/varnishtest/tests/r02471.vtc
index 994480af5..a9e30c92f 100644
--- a/bin/varnishtest/tests/r02471.vtc
+++ b/bin/varnishtest/tests/r02471.vtc
@@ -23,7 +23,7 @@ varnish v1 -vcl+backend {}
varnish v1 -cliok "vcl.state vcl1 cold"

# Nothing holds vcl1, so it should go gold.
-varnish v1 -cliexpect "cold cold 0 vcl1" "vcl.list"
+varnish v1 -cliexpect "cold cold 0 vcl1" "vcl.list"


# Grab hold of vcl1
@@ -43,7 +43,7 @@ client c1 {

# There should still be a single busy hold on vcl1
varnish v1 -cliok "vcl.state vcl1 cold"
-varnish v1 -cliexpect "cold busy [12] vcl1" "vcl.list"
+varnish v1 -cliexpect "cold busy [12] vcl1" "vcl.list"

# Release hold on vcl1
varnish v1 -cliok "vcl.state vcl1 auto"
@@ -60,6 +60,6 @@ client c1 {
rxresp
} -run

-# Nothing holds vcl1, so it should go gold.
+# Nothing holds vcl1, so it should go cold.
varnish v1 -cliok "vcl.state vcl1 cold"
-varnish v1 -cliexpect "cold .... [01] vcl1" "vcl.list"
+varnish v1 -cliexpect "cold .... [01] vcl1" "vcl.list"
diff --git a/bin/varnishtest/tests/u00000.vtc b/bin/varnishtest/tests/u00000.vtc
index d3baa09d6..63df292be 100644
--- a/bin/varnishtest/tests/u00000.vtc
+++ b/bin/varnishtest/tests/u00000.vtc
@@ -108,7 +108,7 @@ shell -expect {VCL 'vcl1' now active} {
varnishadm -n ${tmpdir}/v1 vcl.use vcl1
}

-shell -expect {active auto warm - vcl1} {
+shell -expect {active auto warm - vcl1} {
varnishadm -n ${tmpdir}/v1 vcl.list
}

@@ -152,8 +152,8 @@ shell {
}

varnish v2 -arg "-f ${tmpdir}/ok1" -arg "-f ${tmpdir}/ok2" -start
-varnish v2 -cliexpect {available auto warm 0 boot0} "vcl.list"
-varnish v2 -cliexpect {active auto warm 0 boot1} "vcl.list"
+varnish v2 -cliexpect {available auto warm 0 boot0} "vcl.list"
+varnish v2 -cliexpect {active auto warm 0 boot1} "vcl.list"
varnish v2 -stop -wait

# Test multiple -f options with a bad VCL
diff --git a/bin/varnishtest/tests/u00011.vtc b/bin/varnishtest/tests/u00011.vtc
index 42152f824..57273fb39 100644
--- a/bin/varnishtest/tests/u00011.vtc
+++ b/bin/varnishtest/tests/u00011.vtc
@@ -24,7 +24,7 @@ process p1 -expect-text 12 1 "200 "
process p1 -expect-text 13 1 PONG

process p1 -write "vcl.li\t\r"
-process p1 -expect-text 0 1 "active auto warm"
+process p1 -expect-text 0 1 "active auto warm"

process p1 -write "vcl.s\t\th\t vcl1\r"
process p1 -expect-text 0 1 "backend s1"
diff --git a/bin/varnishtest/tests/u00012.vtc b/bin/varnishtest/tests/u00012.vtc
index 3f4a19ec6..cecf70e9f 100644
--- a/bin/varnishtest/tests/u00012.vtc
+++ b/bin/varnishtest/tests/u00012.vtc
@@ -22,7 +22,7 @@ process p1 -expect-text 2 1 "200 19 "
process p1 -expect-text 3 1 PONG

process p1 -write "vcl.list\r"
-process p1 -expect-text 0 0 "auto warm"
+process p1 -expect-text 0 0 "auto warm"

process p1 -write "vcl.show vcl1\r"
process p1 -expect-text 0 0 "backend s1"
diff --git a/bin/varnishtest/tests/v00045.vtc b/bin/varnishtest/tests/v00045.vtc
index 812c0392a..795d25436 100644
--- a/bin/varnishtest/tests/v00045.vtc
+++ b/bin/varnishtest/tests/v00045.vtc
@@ -17,7 +17,7 @@ varnish v1 -cliok "vcl.state vcl1 cold"
# We should now see it as cooling
delay 1

-varnish v1 -cliexpect "available cold cooling 0 vcl1" vcl.list
+varnish v1 -cliexpect "available cold cooling 0 vcl1" vcl.list
varnish v1 -clijson "vcl.list -j"

# It can't be warmed up yet
@@ -26,7 +26,7 @@ varnish v1 -cliexpect "vmod-debug ref on vcl1" "vcl.state vcl1 warm"

# It will eventually cool down
delay 2
-varnish v1 -cliexpect "available cold cold 0 vcl1" vcl.list
+varnish v1 -cliexpect "available cold cold 0 vcl1" vcl.list
varnish v1 -clijson "vcl.list -j"

# At this point it becomes possible to warm up again
diff --git a/lib/libvarnish/vte.c b/lib/libvarnish/vte.c
index c97a95441..cd2620251 100644
--- a/lib/libvarnish/vte.c
+++ b/lib/libvarnish/vte.c
@@ -138,7 +138,7 @@ vte_update(struct vte *vte)
vte->f_off = 0;
vte->f_sz = 0;
vte->l_sz = 0;
- } else {
+ } else if (*p != '\t') {
vte->f_sz++;
vte->l_sz++;
}
@@ -261,9 +261,9 @@ VTE_format(const struct vte *vte, VTE_format_f *func, void *priv)
just_left = 0;
while (*p != 0) {
if (*p == '\v') {
- if (p - 1 > q) { /* exclude previous separator */
+ if (p > q) {
VTE_FORMAT(func, priv, "%.*s%s",
- (int)((p - 1) - q), q, sep);
+ (int)(p - q), q, sep);
}
q = ++p;
just_left = 1;
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit