Oh Jihyeon created ZOOKEEPER-5135:
-------------------------------------

             Summary: C client fails to build with GCC 15 and SSL tests fail 
with OpenSSL 3.5 on Ubuntu 26.04
                 Key: ZOOKEEPER-5135
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5135
             Project: ZooKeeper
          Issue Type: Bug
          Components: build, c client, tests
    Affects Versions: 3.8.9, 3.9.8, 3.11.0, 3.10.1
            Reporter: Oh Jihyeon


ZOOKEEPER-5116 pinned the CI build to ubuntu-24.04, because the C client failed 
to build on Ubuntu 26.04. There are two problems.

h3. 1. Build fails with GCC 15

With GCC 15 (which defaults to C23) and a recent glibc, {{strchr()}} returns 
{{const char *}} when it is given a {{const char *}}. Because the C client is 
built with {{-Werror}}, three places fail:
{noformat}
src/zookeeper.c:1423:18: error: assignment discards 'const' qualifier from 
pointer target type [-Werror=discarded-qualifiers]
src/cli.c:562:13: error: assignment discards 'const' qualifier from pointer 
target type [-Werror=discarded-qualifiers]
src/cli.c:776:11: error: assignment discards 'const' qualifier from pointer 
target type [-Werror=discarded-qualifiers]
{noformat}

h3. 2. SSL tests fail with OpenSSL 3.5

Once the build is fixed, testSSL, testSSLServerOnly and testReadOnlyWithSSL 
fail with ZSSLCONNECTIONERROR. The tests pass {{server.crt}} as the CA file, 
and {{gencerts.sh}} gives the root and server certificates the same subject. 
With OpenSSL 3.0, the server certificate looks self-signed, so it is verified 
against itself by accident. With OpenSSL 3.5, key identifiers are added by 
default, which shows that the root issued it, so verification fails. The root 
certificate also has no CA extensions.

h3. Fix

* Declare {{index_chroot}} as {{const char *}} in zookeeper.c, and cast the 
result of {{strchr()}} in cli.c, where the input is modified.
* Give the root certificate its own subject and CA extensions in gencerts.sh, 
and use {{root.crt}} as the CA file in the C client and zkpython tests.
* Pin the CI build to ubuntu-26.04.

PR: https://github.com/apache/zookeeper/pull/2510




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to