From 9bb5eecce645dd72853e3ed262bef7bf11cae566 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 10 Jun 2021 10:45:31 -0400 Subject: [PATCH] Avoid ECPG test failures in some GSS-capable environments. Buildfarm member hamerkop has been reporting that two cases in connect/test5.pgc show different error messages than the test expects, because since commit ffa2e4670 libpq's connection failure messages are exposing the fact that a GSS-encrypted connection was attempted and failed. That's pretty interesting information in itself, and I certainly don't wish to shoot the messenger, but we need to do something to stabilize the ECPG results. For the second of these two failure cases, we can add the gssencmode=disable option to prevent the discrepancy. However, that solution is problematic for the first failure, because the only unique thing about that case is that it's testing a completely-omitted connection target; there's noplace to add the option without defeating the point of the test case. After some thrashing around with alternative fixes that turned out to have undesirable side-effects, the most workable answer is just to give up and remove that test case. Perhaps we can revert this later, if we figure out why the GSS code is misbehaving in hamerkop's environment. Thanks to Michael Paquier for exploration of alternatives. Discussion: https://postgr.es/m/YLRZH6CWs9N6Pusy@paquier.xyz --- src/interfaces/ecpg/test/connect/test5.pgc | 6 +++--- src/interfaces/ecpg/test/expected/connect-test5.c | 10 +++------- .../ecpg/test/expected/connect-test5.stderr | 12 +----------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/interfaces/ecpg/test/connect/test5.pgc b/src/interfaces/ecpg/test/connect/test5.pgc index e712fa8778..de29160089 100644 --- a/src/interfaces/ecpg/test/connect/test5.pgc +++ b/src/interfaces/ecpg/test/connect/test5.pgc @@ -40,8 +40,8 @@ exec sql end declare section; exec sql connect to 'ecpg2_regression' as main; exec sql disconnect main; - exec sql connect to as main user regress_ecpg_user2/insecure; - exec sql disconnect main; + /* exec sql connect to as main user regress_ecpg_user2/insecure; + exec sql disconnect main; */ exec sql connect to ecpg2_regression as main user regress_ecpg_user1/connectpw; exec sql disconnect main; @@ -61,7 +61,7 @@ exec sql end declare section; exec sql connect to "unix:postgresql://200.46.204.71/ecpg2_regression" as main user regress_ecpg_user1/connectpw; exec sql disconnect main; - exec sql connect to unix:postgresql://localhost/ as main user regress_ecpg_user2 IDENTIFIED BY insecure; + exec sql connect to "unix:postgresql://localhost/?gssencmode=disable" as main user regress_ecpg_user2 IDENTIFIED BY insecure; exec sql disconnect main; /* connect twice */ diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c index 6ae5b589de..c1124c627f 100644 --- a/src/interfaces/ecpg/test/expected/connect-test5.c +++ b/src/interfaces/ecpg/test/expected/connect-test5.c @@ -86,12 +86,8 @@ main(void) #line 41 "test5.pgc" - { ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); } -#line 43 "test5.pgc" - - { ECPGdisconnect(__LINE__, "main");} -#line 44 "test5.pgc" - + /* exec sql connect to as main user regress_ecpg_user2/insecure; + exec sql disconnect main; */ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); } #line 46 "test5.pgc" @@ -135,7 +131,7 @@ main(void) #line 62 "test5.pgc" - { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "regress_ecpg_user2" , "insecure" , "main", 0); } + { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/?gssencmode=disable" , "regress_ecpg_user2" , "insecure" , "main", 0); } #line 64 "test5.pgc" { ECPGdisconnect(__LINE__, "main");} diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr index a15f344320..01a6a0a13b 100644 --- a/src/interfaces/ecpg/test/expected/connect-test5.stderr +++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr @@ -34,16 +34,6 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection main closed [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGconnect: opening database on port for user regress_ecpg_user2 -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_finish: connection main closed -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: raising sqlcode -402 on line 43: could not connect to database "" on line 43 -[NO_PID]: sqlca: code: -402, state: 08001 -[NO_PID]: raising sqlcode -220 on line 44: connection "main" does not exist on line 44 -[NO_PID]: sqlca: code: -220, state: 08003 [NO_PID]: ECPGconnect: opening database ecpg2_regression on port for user regress_ecpg_user1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection main closed @@ -70,7 +60,7 @@ [NO_PID]: sqlca: code: -402, state: 08001 [NO_PID]: raising sqlcode -220 on line 62: connection "main" does not exist on line 62 [NO_PID]: sqlca: code: -220, state: 08003 -[NO_PID]: ECPGconnect: opening database on port for user regress_ecpg_user2 +[NO_PID]: ECPGconnect: opening database on port with options gssencmode=disable for user regress_ecpg_user2 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGconnect: connection to server failed: FATAL: database "regress_ecpg_user2" does not exist [NO_PID]: sqlca: code: 0, state: 00000