Author: svn-role
Date: Wed Jul 8 04:00:32 2026
New Revision: 1935990
Log:
Merge the r1934788 group from trunk:
* r1934788, r1934920, r1935780, r1935781
Use snprintf() instead sprintf() if available. Fixes deprecation warning on
macOS newer versions of Xcode.
Justification:
Warnings, especially false positives, are distracting.
Votes:
+1: ivan, brane, kotkov
Modified:
subversion/branches/1.15.x/ (props changed)
subversion/branches/1.15.x/CMakeLists.txt
subversion/branches/1.15.x/STATUS
subversion/branches/1.15.x/build/ac-macros/compiler.m4
subversion/branches/1.15.x/subversion/svn/filesize.c
subversion/branches/1.15.x/subversion/tests/libsvn_subr/skel-test.c
Modified: subversion/branches/1.15.x/CMakeLists.txt
==============================================================================
--- subversion/branches/1.15.x/CMakeLists.txt Wed Jul 8 04:00:18 2026
(r1935989)
+++ subversion/branches/1.15.x/CMakeLists.txt Wed Jul 8 04:00:32 2026
(r1935990)
@@ -623,6 +623,8 @@ macro(autocheck_symbol_exists SYMBOL FIL
endif()
endmacro()
+autocheck_symbol_exists("snprintf" "stdio.h" HAVE_SNPRINTF)
+
autocheck_include_files("elf.h" HAVE_ELF_H)
autocheck_include_files("inttypes.h" HAVE_INTTYPES_H)
autocheck_include_files("stdbool.h" HAVE_STDBOOL_H)
Modified: subversion/branches/1.15.x/STATUS
==============================================================================
--- subversion/branches/1.15.x/STATUS Wed Jul 8 04:00:18 2026
(r1935989)
+++ subversion/branches/1.15.x/STATUS Wed Jul 8 04:00:32 2026
(r1935990)
@@ -67,14 +67,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1934788, r1934920, r1935780, r1935781
- Use snprintf() instead sprintf() if available. Fixes deprecation warning on
- macOS newer versions of Xcode.
- Justification:
- Warnings, especially false positives, are distracting.
- Votes:
- +1: ivan, brane, kotkov
-
* r1934787, r1934811
Fix potential use of uninitialized memory in the conflict resolver.
Justification:
Modified: subversion/branches/1.15.x/build/ac-macros/compiler.m4
==============================================================================
--- subversion/branches/1.15.x/build/ac-macros/compiler.m4 Wed Jul 8
04:00:18 2026 (r1935989)
+++ subversion/branches/1.15.x/build/ac-macros/compiler.m4 Wed Jul 8
04:00:32 2026 (r1935990)
@@ -71,6 +71,9 @@ AC_DEFUN([SVN_CC_MODE_SETUP],
])
fi
+ dnl check for snprintf so that we can use it instead of sprintf.
+ AC_CHECK_FUNCS(snprintf)
+
CMODEFLAGS="$CFLAGS"
CFLAGS=""
SVN_DOT_CLANGD_CC([$CMODEFLAGS])
Modified: subversion/branches/1.15.x/subversion/svn/filesize.c
==============================================================================
--- subversion/branches/1.15.x/subversion/svn/filesize.c Wed Jul 8
04:00:18 2026 (r1935989)
+++ subversion/branches/1.15.x/subversion/svn/filesize.c Wed Jul 8
04:00:32 2026 (r1935990)
@@ -31,6 +31,7 @@
#include <apr_strings.h>
#include "cl.h"
+#include "svn_private_config.h"
/*** Code. ***/
@@ -97,13 +98,24 @@ format_size(double human_readable_size,
the absolute size is actually a single-digit number, because
files can't have fractional byte sizes. */
if (absolute_human_readable_size >= 10)
- sprintf(buffer, "%.0f", human_readable_size);
+ {
+#if HAVE_SNPRINTF
+ snprintf(buffer, sizeof(buffer), "%.0f", human_readable_size);
+#else
+ sprintf(buffer, "%.0f", human_readable_size);
+#endif
+ }
else
{
double integral;
const double frac = modf(absolute_human_readable_size, &integral);
const int decimals = (index > 0 && (integral < 9 || frac <=
.949999999));
+#if HAVE_SNPRINTF
+ snprintf(buffer, sizeof(buffer), "%.*f", decimals,
+ human_readable_size);
+#else
sprintf(buffer, "%.*f", decimals, human_readable_size);
+#endif
}
return apr_pstrcat(result_pool, buffer, suffix, SVN_VA_NULL);
Modified: subversion/branches/1.15.x/subversion/tests/libsvn_subr/skel-test.c
==============================================================================
--- subversion/branches/1.15.x/subversion/tests/libsvn_subr/skel-test.c Wed Jul
8 04:00:18 2026 (r1935989)
+++ subversion/branches/1.15.x/subversion/tests/libsvn_subr/skel-test.c Wed Jul
8 04:00:32 2026 (r1935990)
@@ -33,6 +33,7 @@
#include "../svn_test.h"
#include "../svn_test_fs.h"
+#include "svn_private_config.h"
/* Some utility functions. */
@@ -307,14 +308,19 @@ put_explicit_length(svn_stringbuf_t *str
apr_size_t len,
char sep)
{
- char *buf = malloc(len + 100);
+ const apr_size_t alloc_len = len + 100;
+ char *buf = malloc(alloc_len);
apr_size_t length_len;
if (! skel_is_space(sep))
abort();
/* Generate the length and separator character. */
- sprintf(buf, "%"APR_SIZE_T_FMT"%c", len, sep);
+#if HAVE_SNPRINTF
+ snprintf(buf, alloc_len, "%" APR_SIZE_T_FMT "%c", len, sep);
+#else
+ sprintf(buf, "%" APR_SIZE_T_FMT "%c", len, sep);
+#endif
length_len = strlen(buf);
/* Copy in the real data (which may contain nulls). */