Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1weto3-00576s-1T for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2026 12:12:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1weto2-00DZ3N-1G for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jul 2026 12:12:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1weto1-00DZ3F-2x for pgsql-hackers@lists.postgresql.org; Wed, 01 Jul 2026 12:12:42 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wetnz-000000014li-42M4 for pgsql-hackers@lists.postgresql.org; Wed, 01 Jul 2026 12:12:41 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-697df404e32so1140477a12.0 for ; Wed, 01 Jul 2026 05:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782907958; x=1783512758; darn=lists.postgresql.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=WCJf/HUS7Zc0sIJUM2DvDwU5zTHp8yHfURjvDp5OqIY=; b=R1O9zZ9zfLWEbYJj7QZSlTtvMyXE4Zu/lBZaji7DUNukjSYYK3CwoaFA/2AN+eqINy byKAoTrFkJIE0gc27xD/LDhHyOIBLEPg6l8/JU8Bz/C5DwlblymqtZ/EogAQPc8zK/j/ NgvAFA6RLv1XijvLSs9DVNJsXWrf5SDptRLdtRrZd+DYnz+RYU0OjSAusarN3higG4RW gTGAOK82kjQvnkyLk1hVD/tsbEM2zCLrtK86zwxisMKodikCT/q90hOl6AwkM1JJWI1C YSvHbX6AXdny2m3cr29VlruIB82YB9KeNT+iw7OkySjZbOEa24zN+ShMOoI7wUDeYa5v INVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782907958; x=1783512758; h=mime-version:user-agent:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WCJf/HUS7Zc0sIJUM2DvDwU5zTHp8yHfURjvDp5OqIY=; b=dhMMP9D3ESvroM0o7S4tn33WOkYYqQadMNvtOz229tn6//vm0vmmER0HEJ83TT12Yl gWe0OB/4qq4SkD1uIf+p5tyy5AvS9f33yqDv2NNkJOZ5s68w426HUsb2G44JzSXfa3Pl l9ytH2cT/xb3UZOJCElOh65yaK0iyY3Nm294wHt41ej4qsat4vgZC7MlhD9hpb3gxe+M m4gsvpI9ea6R4Z0AnVA7DmXBYGFMKU3BATxtItxwzb9AhibvQnLNEupb8NViqDdc+mTZ saQphGc9xCVXYitEJzL+SEQ4PFsR81nE30RbuKbuOPWGGYgio75fdCLgHxsmf+kZVOeL J2Dg== X-Gm-Message-State: AOJu0YwZIzhHbeHqxnVTBNEu7Ob3Y95576LjsE67cPX2n2PAhdBA3nqn agYJuqkk8u/e5WgKV2jNEn6TYO6CZRsX1vgkAz9qO3oHHUdeXRmSuhbvuneqDyU= X-Gm-Gg: AfdE7cl/9b/45Qpor54psijKb055tVrUa8p+zLb0Kfo+BqYZZsY1MpOOw1mlLG4faVG r5jSDQARWUrXU2bCZt6e3XL6qqy3IWV7otDHsYVuIkfW7mbwZjRsUv3fZ2zXN8pxJmHwDHiisqm jA+r4SKYbB06z+kV9bG35Gj8DSLyF6SRrvysNNivSI/lpwg6ajGx1refeXPdYXi+5SF3+qjhZDf WaykXno7QlDyEVOHElnJnfz9Jpun/9U6qMwoJQPA2r1TziUv4wuSxjxDZ/MOvoshXFNsHoh9dob 9xSqGO8+un0B2aBpNsXgxFLt6tbZKSAy32EYJBCKKhvWeOAwAfDqvSEfwaDcrPlWI2d5mA46VUb /O3fxGety6WZ78KGf3NXtBpKkXsOU+oCw9xvL7+oQxK+heA3APNC1H/JK7+MtI53VXWt39jgD29 ySEk4Hw3wDYCVupfbIlRO0XSqcAykt X-Received: by 2002:a17:906:f112:b0:c12:951b:7f1c with SMTP id a640c23a62f3a-c12a9d7a733mr58484066b.21.1782907958221; Wed, 01 Jul 2026 05:12:38 -0700 (PDT) Received: from localhost ([2a00:6d43:908:5803::3]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c1288f0cc2asm265641366b.33.2026.07.01.05.12.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2026 05:12:37 -0700 (PDT) From: "Jonathan Gonzalez V." To: pgsql-hackers@lists.postgresql.org Subject: Coverage (lcov) failing with inconsistent error in versions 2.x Date: Wed, 01 Jul 2026 14:12:35 +0200 Message-ID: <87ldbuc3ik.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Hi all While working on another patch I was suggested to check the coverage of the tests, but I hit some errors while trying to build the coverage. The first error and that it's fixed here are: lcov: ERROR: (inconsistent) "/home/zeus/src/postgresql/src/interfaces/libpq/fe-auth-oauth.c":869: duplicate function 'use_builtin_flow' starts on line "/home/zeus/src/postgresql/src/interfaces/libpq/fe-auth-oauth.c":869 but previous definition started on 991 while capturing from /home/zeus/src/postgresql/build/src/interfaces/libpq/libpq.so.5.19.p/fe-auth-oauth.c.gcno. (use "lcov --ignore-errors inconsistent ..." to bypass this error) lcov: ERROR: (inconsistent) "/home/zeus/src/postgresql/worktrees/lcov/src/include/lib/simplehash.h":450: duplicate function 'blockreftable_create' starts on line "/home/zeus/src/postgresql/worktrees/lcov/src/include/lib/simplehash.h":450 but previous definition started on 447 while capturing from /home/zeus/src/postgresql/worktrees/lcov/build/src/common/libpgcommon_srv.a.p/blkreftable.c.gcno. (use "lcov --ignore-errors inconsistent ..." to bypass this error) These error are due to duplicated declaration of SH_CREATE() and use_builtin_flow(), and will only appear in version of lcov >= 2.0 which is the version, but with version 1.16 this doesn't happens. These failure has already been discussed here[0], but this is a patch on the code rather than add an exception. That thread still having some valid points related to another failure that should be discussed there. [0] https://www.postgresql.org/message-id/flat/CAHsn6_xCDQWe8_vVFhtFk27_xTdyVV%2BDr0yWzaooBZ6%2B-VH-5w%40mail.gmail.com -- Jonathan Gonzalez V. EDB https://www.enterprisedb.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v1-0001-libpq-oauth-collapse-use_builtin_flow-into-a-sing.patch From 3f9a98a046f18588e77a9f1e53da7a3ee92c10cf Mon Sep 17 00:00:00 2001 From: "Jonathan Gonzalez V." Date: Wed, 1 Jul 2026 12:31:55 +0200 Subject: [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition There was three separated definition of the function making lcov v2.x fail with an error. --- src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++----------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c index 826f7461cb3..7a35647feb8 100644 --- a/src/interfaces/libpq/fe-auth-oauth.c +++ b/src/interfaces/libpq/fe-auth-oauth.c @@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn) * failure, and positive indicates success. */ -#if !defined(USE_LIBCURL) +#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH) /* - * This configuration doesn't support the builtin flow. + * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime. */ -static int -use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request) -{ - return 0; -} +typedef char *(*libpq_gettext_func) (const char *msgid); -#elif defined(USE_DYNAMIC_OAUTH) +#elif defined(USE_LIBCURL) /* - * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime. + * For static builds, we can just call pg_start_oauthbearer() directly. It's + * provided by libpq-oauth.a. */ +extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request); -typedef char *(*libpq_gettext_func) (const char *msgid); +#endif -/* - * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its - * callbacks into the connection's async auth handlers. - * - * Failure to load here results in a relatively quiet connection error, to - * handle the use case where the build supports loading a flow but a user does - * not want to install it. Troubleshooting of linker/loader failures can be done - * via PGOAUTHDEBUG. - * - * The lifetime of *request ends shortly after this call, so it must be copied - * to longer-lived storage. - */ static int use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request) { +#if !defined(USE_LIBCURL) + return 0; +#elif defined(USE_DYNAMIC_OAUTH) + /* + * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its + * callbacks into the connection's async auth handlers. + * + * Failure to load here results in a relatively quiet connection error, to + * handle the use case where the build supports loading a flow but a user + * does not want to install it. Troubleshooting of linker/loader failures + * can be done via PGOAUTHDEBUG. + * + * The lifetime of *request ends shortly after this call, so it must be + * copied to longer-lived storage. + */ static bool initialized = false; static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; int lockerr; @@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re } return (start_flow(conn, request) == 0) ? 1 : -1; -} - #else - -/* - * For static builds, we can just call pg_start_oauthbearer() directly. It's - * provided by libpq-oauth.a. - */ - -extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request); - -static int -use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request) -{ return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1; -} - #endif /* USE_LIBCURL */ +} /* -- 2.53.0 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch From aa10a3818d3ec7c40b13880788780738856c6dca Mon Sep 17 00:00:00 2001 From: "Jonathan Gonzalez V." Date: Wed, 1 Jul 2026 12:36:52 +0200 Subject: [PATCH v1 2/2] Collapse SH_CREATE() into a single definition The function had two conditional definitions that make lcov v2.x fail. --- src/include/lib/simplehash.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 15af488abfb..cda4347e60b 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -138,6 +138,14 @@ #define SH_INSERT_HASH_INTERNAL SH_MAKE_NAME(insert_hash_internal) #define SH_LOOKUP_HASH_INTERNAL SH_MAKE_NAME(lookup_hash_internal) +#ifdef SH_RAW_ALLOCATOR +/* _hash _create(uint32 nelements, void *private_data) */ +#define SH_CREATE_PARAMETERS uint32 nelements, void *private_data +#else +/* _hash _create(MemoryContext ctx, uint32 nelements, void *private_data) */ +#define SH_CREATE_PARAMETERS MemoryContext ctx, uint32 nelements, void *private_data +#endif + /* generate forward declarations necessary to use the hash table */ #ifdef SH_DECLARE @@ -186,17 +194,7 @@ typedef struct SH_ITERATOR } SH_ITERATOR; /* externally visible function prototypes */ -#ifdef SH_RAW_ALLOCATOR -/* _hash _create(uint32 nelements, void *private_data) */ -SH_SCOPE SH_TYPE *SH_CREATE(uint32 nelements, void *private_data); -#else -/* - * _hash _create(MemoryContext ctx, uint32 nelements, - * void *private_data) - */ -SH_SCOPE SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements, - void *private_data); -#endif +SH_SCOPE SH_TYPE *SH_CREATE(SH_CREATE_PARAMETERS); /* void _destroy(_hash *tb) */ SH_SCOPE void SH_DESTROY(SH_TYPE * tb); @@ -442,13 +440,8 @@ SH_FREE(SH_TYPE * type, void *pointer) * Memory other than for the array of elements will still be allocated from * the passed-in context. */ -#ifdef SH_RAW_ALLOCATOR SH_SCOPE SH_TYPE * -SH_CREATE(uint32 nelements, void *private_data) -#else -SH_SCOPE SH_TYPE * -SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data) -#endif +SH_CREATE(SH_CREATE_PARAMETERS) { SH_TYPE *tb; uint64 size; @@ -1217,6 +1210,7 @@ SH_STAT(SH_TYPE * tb) #undef SH_GROW_MAX_MOVE #undef SH_GROW_MIN_FILLFACTOR #undef SH_MAX_SIZE +#undef SH_CREATE_PARAMETERS /* types */ #undef SH_TYPE -- 2.53.0 --=-=-=--