Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Avoid ECPG test failures in some GSS-capable environments.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Jun 2021 14:45:31 +0000 (10:45 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Jun 2021 14:45:42 +0000 (10:45 -0400)
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
src/interfaces/ecpg/test/expected/connect-test5.c
src/interfaces/ecpg/test/expected/connect-test5.stderr

index e712fa87783fb249c3900bd8a77f572a28f1b150..de291600899e145d9592fb4b85d1fb5e77a68a29 100644 (file)
@@ -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 */
index 6ae5b589dea4f95ef9ce736d166b3bcd8f09e664..c1124c627ff3ac9c00e8b579d385554d3fb8f5a0 100644 (file)
@@ -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");}
index a15f3443204f0fa959f3d7ab51ee9320b0b063f3..01a6a0a13b236b1eca1736d6d70000f66bf5dd34 100644 (file)
 [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 <DEFAULT> on <DEFAULT> port <DEFAULT>  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 "<DEFAULT>" 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 <DEFAULT> port <DEFAULT>  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 <DEFAULT> on <DEFAULT> port <DEFAULT>  for user regress_ecpg_user2
+[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> 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