Author: kotkov Date: Mon Dec 22 19:47:44 2025 New Revision: 1930808 Log: ra_serf: Guard against SERF_VERSION_AT_LEAST(unreleased version) logic.
Before this change, our code contained several blocks of code conditional on SERF_VERSION_AT_LEAST(1, 4, 0). Since Serf 1.4.0 is unreleased, this code relies on development snapshots rather than a stable API. Essentially, that's a ticking timebomb. The code encodes assumptions about a development version of Serf but will automatically activate if a user builds against an officially released Serf 1.4.0+. More specifically: - The code may not compile, depending on the final API state in Serf 1.4.0+. - Even if it compiles, assumptions about Serf's behavior may no longer hold. - Even if the assumptions hold, these code paths may still not work as intended, because they are effectively hidden from our standard release testing and buildbots. To fix this issue, place such code under an additional guard (#ifdef SVN__SERF_EXPERIMENTAL) that is never defined in production builds. See [1] for additional details. * subversion/libsvn_ra_serf/serf.c (load_config): Guard code with #ifdef SVN__SERF_EXPERIMENTAL. * subversion/libsvn_ra_serf/update.c (get_best_connection): Guard code with #ifdef SVN__SERF_EXPERIMENTAL. * subversion/libsvn_ra_serf/util.c (conn_negotiate_protocol, conn_setup, svn_ra_serf__default_readline): Guard code with #ifdef SVN__SERF_EXPERIMENTAL. [1]: https://lists.apache.org/thread/7dpmb63wc1phqvgwvp9hnyrzfqpd2mz5 Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c subversion/trunk/subversion/libsvn_ra_serf/update.c subversion/trunk/subversion/libsvn_ra_serf/util.c Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/serf.c Mon Dec 22 19:30:13 2025 (r1930807) +++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Mon Dec 22 19:47:44 2025 (r1930808) @@ -165,10 +165,12 @@ load_config(svn_ra_serf__session_t *sess const char *exceptions; apr_port_t proxy_port; svn_tristate_t chunked_requests; +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING) apr_int64_t log_components; apr_int64_t log_level; #endif +#endif if (config_hash) { @@ -252,6 +254,7 @@ load_config(svn_ra_serf__session_t *sess SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS, "auto", svn_tristate_unknown)); +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING) SVN_ERR(svn_config_get_int64(config, &log_components, SVN_CONFIG_SECTION_GLOBAL, @@ -262,6 +265,7 @@ load_config(svn_ra_serf__session_t *sess SVN_CONFIG_OPTION_SERF_LOG_LEVEL, SERF_LOG_INFO)); #endif +#endif server_group = svn_auth_get_parameter(session->auth_baton, SVN_AUTH_PARAM_SERVER_GROUP); @@ -319,6 +323,7 @@ load_config(svn_ra_serf__session_t *sess SVN_CONFIG_OPTION_HTTP_CHUNKED_REQUESTS, "auto", chunked_requests)); +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING) SVN_ERR(svn_config_get_int64(config, &log_components, server_group, @@ -329,8 +334,10 @@ load_config(svn_ra_serf__session_t *sess SVN_CONFIG_OPTION_SERF_LOG_LEVEL, log_level)); #endif +#endif } +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && !defined(SVN_SERF_NO_LOGGING) if (log_components != SERF_LOGCOMP_NONE) { @@ -349,6 +356,7 @@ load_config(svn_ra_serf__session_t *sess serf_logging_add_output(session->context, output); } #endif +#endif /* Don't allow the http-max-connections value to be larger than our compiled-in limit, or to be too small to operate. Broken Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/update.c Mon Dec 22 19:30:13 2025 (r1930807) +++ subversion/trunk/subversion/libsvn_ra_serf/update.c Mon Dec 22 19:47:44 2025 (r1930808) @@ -616,7 +616,7 @@ get_best_connection(report_context_t *ct } else { -#if SERF_VERSION_AT_LEAST(1, 4, 0) +#if defined(SVN__SERF_EXPERIMENTAL) && SERF_VERSION_AT_LEAST(1, 4, 0) /* Often one connection is slower than others, e.g. because the server process/thread has to do more work for the particular set of requests. In the worst case, when REQUEST_COUNT_TO_RESUME requests are queued Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/util.c Mon Dec 22 19:30:13 2025 (r1930807) +++ subversion/trunk/subversion/libsvn_ra_serf/util.c Mon Dec 22 19:47:44 2025 (r1930808) @@ -481,6 +481,7 @@ load_authorities(svn_ra_serf__connection return SVN_NO_ERROR; } +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && defined(SVN__SERF_TEST_HTTP2) /* Implements serf_ssl_protocol_result_cb_t */ static apr_status_t @@ -512,6 +513,7 @@ conn_negotiate_protocol(void *data, return APR_SUCCESS; } #endif +#endif static svn_error_t * conn_setup(apr_socket_t *sock, @@ -558,6 +560,7 @@ conn_setup(apr_socket_t *sock, SVN_ERR(load_authorities(conn, conn->session->ssl_authorities, conn->session->pool)); } +#ifdef SVN__SERF_EXPERIMENTAL #if SERF_VERSION_AT_LEAST(1, 4, 0) && defined(SVN__SERF_TEST_HTTP2) if (APR_SUCCESS == serf_ssl_negotiate_protocol(conn->ssl_context, "h2,http/1.1", @@ -568,6 +571,7 @@ conn_setup(apr_socket_t *sock, SERF_CONNECTION_FRAMING_TYPE_NONE); } #endif +#endif } if (write_bkt) @@ -2273,7 +2277,7 @@ svn_ra_serf__default_readline(serf_bucke int *found, const char **data, apr_size_t *len) { -#if SERF_VERSION_AT_LEAST(1, 4, 0) +#if defined(SVN__SERF_EXPERIMENTAL) && SERF_VERSION_AT_LEAST(1, 4, 0) return serf_default_readline(bucket, acceptable, found, data, len); #else return bucket_limited_readline(bucket, acceptable, SERF_READ_ALL_AVAIL,
