This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new 46c4cb1c2 [security-flags-itest] Fix missing command line flags 46c4cb1c2 is described below commit 46c4cb1c2906a77f700509d02813a15dbf919927 Author: Ádám Bakai <aba...@cloudera.com> AuthorDate: Mon May 6 11:41:53 2024 +0200 [security-flags-itest] Fix missing command line flags It is a known phenomenon, that static libraries won't be included into an executable if there are no usage for any function or variable[1]. This means the initialization routines in the library won't be executed, even if these initialization routines have side effects, such as registering the variable in the gflags ecosystem. As a result, the CheckRpcAuthnFlagsGroupValidator test failed because "rpc_authentication" flag was not registered properly. To solve this issue, a command line variable check is added, so now the library will be used in the executable and the initialization routines will be executed. [1] https://stackoverflow.com/questions/1229430/how-do-i-prevent-my-unused-global-variables-being-compiled-out-of-my-static-li Change-Id: Iec751e8761562612d97b886740c9b20cd134a0bc Reviewed-on: http://gerrit.cloudera.org:8080/21399 Tested-by: Kudu Jenkins Reviewed-by: Alexey Serbin <ale...@apache.org> --- src/kudu/integration-tests/security-flags-itest.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/kudu/integration-tests/security-flags-itest.cc b/src/kudu/integration-tests/security-flags-itest.cc index 81476215e..568b41334 100644 --- a/src/kudu/integration-tests/security-flags-itest.cc +++ b/src/kudu/integration-tests/security-flags-itest.cc @@ -28,6 +28,8 @@ #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" +DECLARE_string(rpc_authentication); + using gflags::SetCommandLineOption; using kudu::cluster::ExternalMiniCluster; using kudu::cluster::ExternalMiniClusterOptions; @@ -43,7 +45,17 @@ TEST_F(SecurityFlagsTest, CheckRpcAuthnFlagsGroupValidator) { // set them to the required values instead to verify the functionality // of the corresponding group flag validator. ASSERT_NE("", SetCommandLineOption("unlock_experimental_flags", "true")); + ASSERT_NE("", SetCommandLineOption("rpc_authentication", "required")); + // This check has two purposes. The first purpose is that it verifies that the + // flag is set up correctly. The second purpose is that linker can omit whole + // library files when no function or variable is used in them. This can happen + // even if the variable's constructor has some side effects. This happenned + // with the command line arguments in release build in some cases. As a + // solution, FLAGS_rpc_authentication is used and as a consequence, all the + // global variable constructors are called. + ASSERT_EQ("required", FLAGS_rpc_authentication); + ASSERT_NE("", SetCommandLineOption("keytab_file", "")); ASSERT_NE("", SetCommandLineOption("rpc_certificate_file", "")); ASSERT_DEATH({ ValidateFlags(); },