subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1881958 - in /subversion/trunk: ./ build/generator/ subversion/include/ subversion/include/private/ subversion/libsvn_subr/
Date Wed, 23 Sep 2020 15:04:32 GMT
Author: julianfoad
Date: Wed Sep 23 15:04:31 2020
New Revision: 1881958

URL: http://svn.apache.org/viewvc?rev=1881958&view=rev
Log:
Restoring support for building with APR 1.4.

Change the minimum required version of APR from 1.5 to 1.4.

This is required to build and package Subversion on CentOS 7 using the
distribution's APR package.  (The alternative of also packaging a later
version of APR and APR-util has undesirable consequences: libserf and apache
httpd would need to link against these too.)

The first part of this patch is a partial revert of r1874094 (which changed
the requirement from APR 1.3 to APR 1.5), reverting only the parts needed to
restore APR 1.4 compatibility.

* INSTALL,
  build/generator/gen_win_dependencies.py,
  configure.ac:
  Change minimum APR version from 1.5 to 1.4.

* subversion/include/svn_types.h,
  subversion/libsvn_subr/iter.c:
  Restore the compatibility versions of apr_hash_this_key,
  apr_hash_this_key_len, apr_hash_this_val.

The second part of this patch adds a local copy of the 'apr_escape_shell'
function, copied from APR 1.7.0, if building against APR < 1.5.

* subversion/include/private/svn_dep_compat.h
  (APR_ESCAPE_STRING, apr_escape_shell): Declare if APR < 1.5.

* subversion/libsvn_subr/apr_escape.c
  New, copied from parts of APR 1.7.0.

* subversion/libsvn_subr/cmdline.c
  When APR < 1.5, include 'svn_dep_compat.h' instead of 'apr_escape.h'.

Added:
    subversion/trunk/subversion/libsvn_subr/apr_escape.c   (with props)
Modified:
    subversion/trunk/INSTALL
    subversion/trunk/build/generator/gen_win_dependencies.py
    subversion/trunk/configure.ac
    subversion/trunk/subversion/include/private/svn_dep_compat.h
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/libsvn_subr/cmdline.c
    subversion/trunk/subversion/libsvn_subr/iter.c

Modified: subversion/trunk/INSTALL
URL: http://svn.apache.org/viewvc/subversion/trunk/INSTALL?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/INSTALL (original)
+++ subversion/trunk/INSTALL Wed Sep 23 15:04:31 2020
@@ -206,7 +206,7 @@ I.    INTRODUCTION
       commands described in section II.B before installing the following.
 
 
-      1.  Apache Portable Runtime 1.5 or newer  (REQUIRED)
+      1.  Apache Portable Runtime 1.4 or newer  (REQUIRED)
 
       Whenever you want to build any part of Subversion, you need the
       Apache Portable Runtime (APR) and the APR Utility (APR-util)
@@ -838,7 +838,7 @@ II.   INSTALLATION
         needed to compile Apache.  Note that this is the actual awk program,
         not an installer - just rename it to awk.exe and it is ready to use.
       * Apache apr, apr-util, and optionally apr-iconv libraries, version
-        1.5 or later (1.2 for apr-iconv). If you are building from a Subversion
+        1.4 or later (1.2 for apr-iconv). If you are building from a Subversion
         checkout and have not downloaded Apache 2, then get these 3 libraries
         from https://www.apache.org/dist/apr/.
       * SQLite 3.8.2 or higher from https://www.sqlite.org/download.html

Modified: subversion/trunk/build/generator/gen_win_dependencies.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win_dependencies.py?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win_dependencies.py (original)
+++ subversion/trunk/build/generator/gen_win_dependencies.py Wed Sep 23 15:04:31 2020
@@ -345,7 +345,7 @@ class GenDependenciesBase(gen_base.Gener
   def _find_apr(self):
     "Find the APR library and version"
 
-    minimal_apr_version = (1, 5, 0)
+    minimal_apr_version = (1, 4, 0)
 
     if not self.apr_path:
       sys.stderr.write("ERROR: Use '--with-apr' option to configure APR " + \

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Wed Sep 23 15:04:31 2020
@@ -91,7 +91,7 @@ AC_SUBST([MKDIR])
 dnl verify apr version and set apr flags
 dnl These regular expressions should not contain "\(" and "\)".
 
-APR_VER_REGEXES=["1\.[5-9]\. 2\."]
+APR_VER_REGEXES=["1\.[4-9]\. 2\."]
 
 SVN_LIB_APR($APR_VER_REGEXES)
 

Modified: subversion/trunk/subversion/include/private/svn_dep_compat.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_dep_compat.h?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_dep_compat.h (original)
+++ subversion/trunk/subversion/include/private/svn_dep_compat.h Wed Sep 23 15:04:31 2020
@@ -29,6 +29,7 @@
 #define SVN_DEP_COMPAT_H
 
 #include <apr_version.h>
+#include <apr_errno.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -193,6 +194,16 @@ extern "C" {
 ((major*1000000 + minor*1000 + patch) <= SVN_SQLITE_MIN_VERSION_NUMBER)
 #endif /* SQLITE_VERSION_AT_LEAST */
 
+/**
+ * Support for 'apr_escape_shell() which was introduced in APR 1.5.
+ */
+#if !APR_VERSION_AT_LEAST(1,5,0)
+/* from apr_escape.h */
+#define APR_ESCAPE_STRING      (-1)
+APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str,
+        apr_ssize_t slen, apr_size_t *len);
+#endif
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Wed Sep 23 15:04:31 2020
@@ -249,6 +249,35 @@ typedef struct svn_version_t svn_version
 
 
 
+/** @defgroup apr_hash_utilities APR Hash Table Helpers
+ * These functions enable the caller to dereference an APR hash table index
+ * without type casts or temporary variables.
+ *
+ * These functions are provided by APR itself from version 1.5.
+ * Definitions are provided here for when using older versions of APR.
+ * @{
+ */
+
+#if !APR_VERSION_AT_LEAST(1, 5, 0)
+
+/** Return the key of the hash table entry indexed by @a hi. */
+const void *
+apr_hash_this_key(apr_hash_index_t *hi);
+
+/** Return the key length of the hash table entry indexed by @a hi. */
+apr_ssize_t
+apr_hash_this_key_len(apr_hash_index_t *hi);
+
+/** Return the value of the hash table entry indexed by @a hi. */
+void *
+apr_hash_this_val(apr_hash_index_t *hi);
+
+#endif
+
+/** @} */
+
+
+
 /** On Windows, APR_STATUS_IS_ENOTDIR includes several kinds of
  * invalid-pathname error but not ERROR_INVALID_NAME, so we include it.
  * We also include ERROR_DIRECTORY as that was not included in apr versions

Added: subversion/trunk/subversion/libsvn_subr/apr_escape.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/apr_escape.c?rev=1881958&view=auto
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/apr_escape.c (added)
+++ subversion/trunk/subversion/libsvn_subr/apr_escape.c Wed Sep 23 15:04:31 2020
@@ -0,0 +1,128 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* The code in this file is copied from APR (initially from APR 1.7.0)
+ * to provide compatibility for building against APR < 1.5.0.
+ */
+
+#include "private/svn_dep_compat.h"
+
+#if !APR_VERSION_AT_LEAST(1,5,0)
+
+#include <apr_lib.h>
+#include <apr_strings.h>
+
+/* from apr_escape_test_char.h */
+#define T_ESCAPE_SHELL_CMD     (1)
+#define T_ESCAPE_PATH_SEGMENT  (2)
+#define T_OS_ESCAPE_PATH       (4)
+#define T_ESCAPE_ECHO          (8)
+#define T_ESCAPE_URLENCODED    (16)
+#define T_ESCAPE_XML           (32)
+#define T_ESCAPE_LDAP_DN       (64)
+#define T_ESCAPE_LDAP_FILTER   (128)
+
+static const unsigned char test_char_table[256] = {
+    224,222,222,222,222,222,222,222,222,222,223,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,6,16,127,22,17,22,49,17,
+    145,145,129,80,80,0,0,18,0,0,0,0,0,0,0,0,0,0,16,87,
+    119,16,119,23,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,23,223,23,23,0,23,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,23,23,23,17,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222 
+};
+
+/* from apr_encode_private.h */
+#if APR_CHARSET_EBCDIC
+#error This Subversion compatibility code for APR<1.5 does not support EBCDIC.
+#else                           /* APR_CHARSET_EBCDIC */
+#define ENCODE_TO_ASCII(ch)  (ch)
+#define ENCODE_TO_NATIVE(ch)  (ch)
+#endif                          /* !APR_CHARSET_EBCDIC */
+
+/* we assume the folks using this ensure 0 <= c < 256... which means
+ * you need a cast to (unsigned char) first, you can't just plug a
+ * char in here and get it to work, because if char is signed then it
+ * will first be sign extended.
+ */
+#define TEST_CHAR(c, f)        (test_char_table[(unsigned)(c)] & (f))
+
+APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str,
+        apr_ssize_t slen, apr_size_t *len)
+{
+    unsigned char *d;
+    const unsigned char *s;
+    apr_size_t size = 1;
+    int found = 0;
+
+    d = (unsigned char *) escaped;
+    s = (const unsigned char *) str;
+
+    if (s) {
+        if (d) {
+            for (; *s && slen; ++s, slen--) {
+#if defined(OS2) || defined(WIN32)
+                /*
+                 * Newlines to Win32/OS2 CreateProcess() are ill advised.
+                 * Convert them to spaces since they are effectively white
+                 * space to most applications
+                 */
+                if (*s == '\r' || *s == '\n') {
+                    if (d) {
+                        *d++ = ' ';
+                        found = 1;
+                    }
+                    continue;
+                }
+#endif
+                if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) {
+                    *d++ = '\\';
+                    size++;
+                    found = 1;
+                }
+                *d++ = *s;
+                size++;
+            }
+            *d = '\0';
+        }
+        else {
+            for (; *s && slen; ++s, slen--) {
+                if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) {
+                    size++;
+                    found = 1;
+                }
+                size++;
+            }
+        }
+    }
+
+    if (len) {
+        *len = size;
+    }
+    if (!found) {
+        return APR_NOTFOUND;
+    }
+
+    return APR_SUCCESS;
+}
+
+#endif

Propchange: subversion/trunk/subversion/libsvn_subr/apr_escape.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/trunk/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cmdline.c?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cmdline.c Wed Sep 23 15:04:31 2020
@@ -39,7 +39,12 @@
 
 #include <apr.h>                /* for STDIN_FILENO */
 #include <apr_errno.h>          /* for apr_strerror */
+#include <apr_version.h>
+#if APR_VERSION_AT_LEAST(1,5,0)
 #include <apr_escape.h>
+#else
+#include "private/svn_dep_compat.h"
+#endif
 #include <apr_general.h>        /* for apr_initialize/apr_terminate */
 #include <apr_strings.h>        /* for apr_snprintf */
 #include <apr_pools.h>

Modified: subversion/trunk/subversion/libsvn_subr/iter.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/iter.c?rev=1881958&r1=1881957&r2=1881958&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/iter.c (original)
+++ subversion/trunk/subversion/libsvn_subr/iter.c Wed Sep 23 15:04:31 2020
@@ -143,3 +143,29 @@ svn_iter__break(void)
 {
   return &internal_break_error;
 }
+
+#if !APR_VERSION_AT_LEAST(1, 5, 0)
+const void *apr_hash_this_key(apr_hash_index_t *hi)
+{
+  const void *key;
+
+  apr_hash_this((apr_hash_index_t *)hi, &key, NULL, NULL);
+  return key;
+}
+
+apr_ssize_t apr_hash_this_key_len(apr_hash_index_t *hi)
+{
+  apr_ssize_t klen;
+
+  apr_hash_this((apr_hash_index_t *)hi, NULL, &klen, NULL);
+  return klen;
+}
+
+void *apr_hash_this_val(apr_hash_index_t *hi)
+{
+  void *val;
+
+  apr_hash_this((apr_hash_index_t *)hi, NULL, NULL, &val);
+  return val;
+}
+#endif



Mime
View raw message