Dear devs,

I propose a patch restoring support for APR 1.4 so that svn 1.14 can be built and packaged on CentOS 7.

The WANdisco folks continue to package svn for a variety of target systems. Packaging for CentOS 7 which has APR 1.4.8, they ran into the problem that just before svn 1.14.0 we bumped the dependency requirement to APR 1.5.0 and removed support for older APR versions.

Here's the change we made:
r1874094 | jamessan | 2020-02-17 03:49:42
Require at least version 1.5 of APR

Since r1874057, the apr_pescape_shell() API is being used to escape filenames
when invoking $SVN_EDITOR.  This was added to APR in 1.5.0, released on
2013-11-13.

* INSTALL
  (): Document new minimum APR version

* build/generator/gen_win_dependencies.py
  (_find_apr): Bump minimal_apr_version to 1.5.0

* configure.ac
  (APR_VER_REGEXES): Bump minor version in 1.x regex to 1.5

* get-deps.sh:
  (APR_VERSION): Specify 1.5.0 as default version

* subversion/include/private/svn_dep_compat.h
  (apr_time_from_msec): Removed, since it's provided by APR 1.4.0 or later

* subversion/include/svn_types.h
  (apr_hash_this_key, apr_hash_this_key_len, apr_hash_this_val): Remove
   prototypes, since they're provide by APR 1.5.0 or later

* subversion/libsvn_subr/iter.c
  (hash_do_baton): Remove condition requiring APR 1.4.0 to define this type
  (svn_iter_apr_hash): Remove pre-APR 1.4.0 code
  (apr_hash_this_key, apr_hash_this_key_len, apr_hash_this_val): Remove
   definitions, since they're provided by APR 1.5.0 or later

* subversion/libsvn_subr/pool.c
  (apr_pool_create_unmanaged_ex): Remove conditional alias to
   apr_pool_create_core_ex, for APR versions < 1.3.3

The context is we'd recently started using apr_pescape_shell() in r1874057, shortly afterwards changing to using apr_escape_shell() instead, and those escaping functions are new in 1.5.0.

Ian at WANdisco told me:
The dependencies we have issues with are apr and apr-util as 1.14 requires at 
least APR 1.5 and Red Hat ship 1.4.8 in EL7. I tried ignoring the version and 
using the old apr but it doesn't compile due to some missing symbols.

Because of this if we want to ship any 1.14 build for EL7 we have to build our 
own (later) APR and APR-Util packages which in turn means libserf and apache 
httpd would need to link against these too.

They are looking for a more self-contained solution.

I propose adding support more or less as in the attached patch.  It:

- reverts r1874094, thus restoring the support we had for APR 1.4 (and even 1.3 by the look of it), but we never had backward compatibility support for apr_escape_shell();

  - adds a local copy of the 'apr_escape_shell()' function, copied
from APR 1.7.0.

One adjustments is needed before this is ready to commit: I must make the 'apr_escape_shell' part conditional on APR version. Note also that the support for 'apr_escape_shell()' adds 4 files, as that's how the code was laid out in APR. We could combine them but I preferred to copy it as exactly as possible.

If this is an acceptable approach, I would propose it for backport to a 1.14.x point release.

WANdisco would prefer to package our upstream svn source release exactly rather than patch it in their packaging, and that is why I am proposing adding this support.

Of course I understand that APR pre-1.5 is pretty old and the argument to not complicate the current code with too much backward compatibility support code. So the question is whether this is too much or whether supporting building on distros like CentOS 7 out of the box is the better option.

- Julian
Restoring support for building with APR 1.4.

(In fact the support goes back as far as APR 1.3.)

The first part is a revert of r1874094.

  M   INSTALL
  M   build/generator/gen_win_dependencies.py
  M   configure.ac
  M   subversion/include/private/svn_dep_compat.h
  M   subversion/include/svn_types.h
  M   subversion/libsvn_subr/iter.c
  M   subversion/libsvn_subr/pool.c

The second part adds a local copy of the 'apr_escape_shell' function, copied
from APR 1.7.0.

  A   subversion/libsvn_subr/apr_encode_private.h
  A   subversion/libsvn_subr/apr_escape.c
  A   subversion/libsvn_subr/apr_escape.h
  A   subversion/libsvn_subr/apr_escape_test_char.h
  M   subversion/libsvn_subr/cmdline.c

--This line, and those below, will be ignored--

Index: INSTALL
===================================================================
--- INSTALL	(revision 1881769)
+++ INSTALL	(working copy)
@@ -206,7 +206,7 @@
       commands described in section II.B before installing the following.
 
 
-      1.  Apache Portable Runtime 1.5 or newer  (REQUIRED)
+      1.  Apache Portable Runtime 1.3 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 @@
         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.3 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
Index: build/generator/gen_win_dependencies.py
===================================================================
--- build/generator/gen_win_dependencies.py	(revision 1881769)
+++ build/generator/gen_win_dependencies.py	(working copy)
@@ -345,7 +345,7 @@
   def _find_apr(self):
     "Find the APR library and version"
 
-    minimal_apr_version = (1, 5, 0)
+    minimal_apr_version = (1, 3, 0)
 
     if not self.apr_path:
       sys.stderr.write("ERROR: Use '--with-apr' option to configure APR " + \
Index: configure.ac
===================================================================
--- configure.ac	(revision 1881769)
+++ configure.ac	(working copy)
@@ -91,7 +91,7 @@
 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\.[3-9]\. 2\."]
 
 SVN_LIB_APR($APR_VER_REGEXES)
 
Index: get-deps.sh
===================================================================
--- get-deps.sh	(revision 1881769)
+++ get-deps.sh	(working copy)
@@ -31,7 +31,7 @@
 # features already used in the file.  Reviewing the history of changes
 # may be useful as well.
 
-APR_VERSION=${APR_VERSION:-"1.5.0"}
+APR_VERSION=${APR_VERSION:-"1.4.6"}
 APU_VERSION=${APU_VERSION:-"1.5.1"}
 PY3C_VERSION=${PY3C_VERSION:='1.1'}
 SERF_VERSION=${SERF_VERSION:-"1.3.8"}
Index: subversion/include/private/svn_dep_compat.h
===================================================================
--- subversion/include/private/svn_dep_compat.h	(revision 1881769)
+++ subversion/include/private/svn_dep_compat.h	(working copy)
@@ -108,6 +108,12 @@
 #define APR_OPENINFO  0x00100000
 #endif
 
+#if !APR_VERSION_AT_LEAST(1,4,0)
+#ifndef apr_time_from_msec
+#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000)
+#endif
+#endif
+
 /**
  * APR 1 has volatile qualifier bugs in some atomic prototypes that
  * are fixed in APR 2:
Index: subversion/include/svn_types.h
===================================================================
--- subversion/include/svn_types.h	(revision 1881769)
+++ subversion/include/svn_types.h	(working copy)
@@ -249,6 +249,35 @@
 
 
 
+/** @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
Index: subversion/libsvn_subr/iter.c
===================================================================
--- subversion/libsvn_subr/iter.c	(revision 1881769)
+++ subversion/libsvn_subr/iter.c	(working copy)
@@ -37,6 +37,7 @@
     __LINE__ /* line number */
   };
 
+#if APR_VERSION_AT_LEAST(1, 4, 0)
 struct hash_do_baton
 {
   void *baton;
@@ -58,6 +59,7 @@
 
   return hdb->err == SVN_NO_ERROR;
 }
+#endif
 
 svn_error_t *
 svn_iter_apr_hash(svn_boolean_t *completed,
@@ -66,6 +68,7 @@
                   void *baton,
                   apr_pool_t *pool)
 {
+#if APR_VERSION_AT_LEAST(1, 4, 0)
   struct hash_do_baton hdb;
   svn_boolean_t error_received;
 
@@ -94,6 +97,43 @@
     }
 
   return hdb.err;
+#else
+  svn_error_t *err = SVN_NO_ERROR;
+  apr_pool_t *iterpool = svn_pool_create(pool);
+  apr_hash_index_t *hi;
+
+  for (hi = apr_hash_first(pool, hash);
+       ! err && hi; hi = apr_hash_next(hi))
+    {
+      const void *key;
+      void *val;
+      apr_ssize_t len;
+
+      svn_pool_clear(iterpool);
+
+      apr_hash_this(hi, &key, &len, &val);
+      err = (*func)(baton, key, len, val, iterpool);
+    }
+
+  if (completed)
+    *completed = ! err;
+
+  if (err && err->apr_err == SVN_ERR_ITER_BREAK)
+    {
+      if (err != &internal_break_error)
+        /* Errors - except those created by svn_iter_break() -
+           need to be cleared when not further propagated. */
+        svn_error_clear(err);
+
+      err = SVN_NO_ERROR;
+    }
+
+  /* Clear iterpool, because callers may clear the error but have no way
+     to clear the iterpool with potentially lots of allocated memory */
+  svn_pool_destroy(iterpool);
+
+  return err;
+#endif
 }
 
 svn_error_t *
@@ -143,3 +183,29 @@
 {
   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
Index: subversion/libsvn_subr/pool.c
===================================================================
--- subversion/libsvn_subr/pool.c	(revision 1881769)
+++ subversion/libsvn_subr/pool.c	(working copy)
@@ -151,6 +151,16 @@
 }
 
 
+/*
+ * apr_pool_create_core_ex was introduced in APR 1.3.0, then
+ * deprecated and renamed to apr_pool_create_unmanaged_ex in 1.3.3.
+ * Since our minimum requirement is APR 1.3.0, one or the other of
+ * these functions will always be available.
+ */
+#if !APR_VERSION_AT_LEAST(1,3,3)
+#define apr_pool_create_unmanaged_ex apr_pool_create_core_ex
+#endif
+
 /* Private function that creates an unmanaged pool. */
 apr_pool_t *
 svn_pool__create_unmanaged(svn_boolean_t thread_safe)
Index: subversion/libsvn_subr/apr_encode_private.h
===================================================================
--- subversion/libsvn_subr/apr_encode_private.h	(nonexistent)
+++ subversion/libsvn_subr/apr_encode_private.h	(working copy)
@@ -0,0 +1,84 @@
+/* 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.
+ */
+
+/**
+ * @file apr_encode_private.h
+ * @brief APR-UTIL Encoding Private
+ */
+#ifndef APR_ENCODE_PRIVATE_H
+#define APR_ENCODE_PRIVATE_H
+
+#include "apr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup APR_Util_Encode_Private
+ * @ingroup APR_Util
+ * @{
+ */
+
+#if APR_CHARSET_EBCDIC
+    static int convert_a2e[256] = {
+        0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+        0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
+        0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
+        0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
+        0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
+        0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
+        0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+        0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
+        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B,
+        0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF,
+        0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC,
+        0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB,
+        0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
+        0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59,
+        0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
+    0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF};
+
+    static int convert_e2a[256] = {
+        0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+        0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F,
+        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07,
+        0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A,
+        0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
+        0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
+        0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
+        0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
+        0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1,
+        0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4,
+        0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE,
+        0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7,
+        0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5,
+        0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF,
+        0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5,
+    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F};
+#define decode ENCODE_TO_ASCII(ch)  convert_e2a[(unsigned char)ch]
+#define decode ENCODE_TO_NATIVE(ch)  convert_a2e[(unsigned char)ch]
+#else                           /* APR_CHARSET_EBCDIC */
+#define ENCODE_TO_ASCII(ch)  (ch)
+#define ENCODE_TO_NATIVE(ch)  (ch)
+#endif                          /* !APR_CHARSET_EBCDIC */
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* !APR_ENCODE_PRIVATE_H */

Property changes on: subversion/libsvn_subr/apr_encode_private.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: subversion/libsvn_subr/apr_escape.c
===================================================================
--- subversion/libsvn_subr/apr_escape.c	(nonexistent)
+++ subversion/libsvn_subr/apr_escape.c	(working copy)
@@ -0,0 +1,88 @@
+/* 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.
+ */
+
+#include "apr_escape.h"
+#include "apr_escape_test_char.h"
+#include "apr_encode_private.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+
+/* 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;
+}
+

Property changes on: subversion/libsvn_subr/apr_escape.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: subversion/libsvn_subr/apr_escape.h
===================================================================
--- subversion/libsvn_subr/apr_escape.h	(nonexistent)
+++ subversion/libsvn_subr/apr_escape.h	(working copy)
@@ -0,0 +1,53 @@
+/* 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.
+ */
+
+#ifndef APR_ESCAPE_H
+#define APR_ESCAPE_H
+#include "apr.h"
+#include "apr_general.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * When passing a string to one of the escape functions, this value can be
+ * passed to indicate a string-valued key, and have the length computed
+ * automatically.
+ */
+#define APR_ESCAPE_STRING      (-1)
+
+/**
+ * Perform shell escaping on the provided string.
+ * 
+ * Shell escaping causes characters to be prefixed with a '\' character.
+ * @param escaped Optional buffer to write the encoded string, can be
+ * NULL
+ * @param str The original string
+ * @param slen The length of the original string, or APR_ESCAPE_STRING
+ * @param len If present, returns the length of the string
+ * @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
+ * detected or the string was NULL
+ */
+APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str,
+        apr_ssize_t slen, apr_size_t *len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* !APR_ESCAPE_H */

Property changes on: subversion/libsvn_subr/apr_escape.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: subversion/libsvn_subr/apr_escape_test_char.h
===================================================================
--- subversion/libsvn_subr/apr_escape_test_char.h	(nonexistent)
+++ subversion/libsvn_subr/apr_escape_test_char.h	(working copy)
@@ -0,0 +1,25 @@
+/* this file is automatically generated by gen_test_char, do not edit. "make include/private/apr_escape_test_char.h" to regenerate. */
+#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 
+};

Property changes on: subversion/libsvn_subr/apr_escape_test_char.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c	(revision 1881769)
+++ subversion/libsvn_subr/cmdline.c	(working copy)
@@ -39,7 +39,7 @@
 
 #include <apr.h>                /* for STDIN_FILENO */
 #include <apr_errno.h>          /* for apr_strerror */
-#include <apr_escape.h>
+#include "apr_escape.h"
 #include <apr_general.h>        /* for apr_initialize/apr_terminate */
 #include <apr_strings.h>        /* for apr_snprintf */
 #include <apr_pools.h>

Reply via email to