Skip to content

Commit d86e9e2

Browse files
committed
Fix bogus list-iteration code in pg_regress.c, affecting ecpg tests only.
While looking at a recent buildfarm failure in the ecpg tests, I wondered why the pg_regress output claimed the stderr part of the test failed, when the regression diffs were clearly for the stdout part. Looking into it, the reason is that pg_regress.c's logic for iterating over three parallel lists is wrong, and has been wrong since it was written: it advances the "tag" pointer at a different place in the loop than the other two pointers. Fix that.
1 parent 217d8f3 commit d86e9e2

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/test/regress/pg_regress.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,14 +1742,11 @@ run_schedule(const char *schedule, test_function tfunc)
17421742
*/
17431743
for (rl = resultfiles[i], el = expectfiles[i], tl = tags[i];
17441744
rl != NULL; /* rl and el have the same length */
1745-
rl = rl->next, el = el->next)
1745+
rl = rl->next, el = el->next,
1746+
tl = tl ? tl->next : NULL)
17461747
{
17471748
bool newdiff;
17481749

1749-
if (tl)
1750-
tl = tl->next; /* tl has the same length as rl and el if
1751-
* it exists */
1752-
17531750
newdiff = results_differ(tests[i], rl->str, el->str);
17541751
if (newdiff && tl)
17551752
{
@@ -1829,14 +1826,11 @@ run_single_test(const char *test, test_function tfunc)
18291826
*/
18301827
for (rl = resultfiles, el = expectfiles, tl = tags;
18311828
rl != NULL; /* rl and el have the same length */
1832-
rl = rl->next, el = el->next)
1829+
rl = rl->next, el = el->next,
1830+
tl = tl ? tl->next : NULL)
18331831
{
18341832
bool newdiff;
18351833

1836-
if (tl)
1837-
tl = tl->next; /* tl has the same length as rl and el if it
1838-
* exists */
1839-
18401834
newdiff = results_differ(test, rl->str, el->str);
18411835
if (newdiff && tl)
18421836
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy