You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2022/01/14 14:01:51 UTC

svn commit: r1897034 [20/37] - in /subversion/branches/multi-wc-format: ./ build/ build/ac-macros/ build/generator/ build/generator/swig/ build/generator/templates/ contrib/client-side/ contrib/client-side/svn_load_dirs/ contrib/hook-scripts/ contrib/s...

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_fs/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_fs/verify.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_fs/verify.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_fs/verify.c Fri Jan 14 14:01:45 2022
@@ -681,26 +681,30 @@ compare_p2l_to_rev(svn_fs_t *fs,
                                      NULL,
                                      _("p2l index entry for revision r%ld"
                                        " at offset %s contains invalid item"
-                                       " type %d"),
+                                       " type %u"),
                                      start,
                                      apr_off_t_toa(pool, offset),
-                                     entry->type);
+                                     (unsigned int)entry->type);
 
           /* There can be only one changes entry and that has a fixed type
            * and item number.  Its presence and parse-ability will be checked
            * during later stages of the verification process. */
           if (   (entry->type == SVN_FS_FS__ITEM_TYPE_CHANGES)
               != (entry->item.number == SVN_FS_FS__ITEM_INDEX_CHANGES))
-            return svn_error_createf(SVN_ERR_FS_INDEX_CORRUPTION,
-                                     NULL,
-                                     _("p2l index entry for changes in"
-                                       " revision r%ld is item %ld of type"
-                                       " %d at offset %s"),
-                                     entry->item.revision,
-                                     entry->item.number,
-                                     entry->type,
-                                     apr_off_t_toa(pool, offset));
-
+            {
+              const char *num_str = apr_psprintf(pool,
+                                                 "%" APR_UINT64_T_FMT,
+                                                 entry->item.number);
+              return svn_error_createf(SVN_ERR_FS_INDEX_CORRUPTION,
+                                       NULL,
+                                       _("p2l index entry for changes in"
+                                         " revision r%ld is item %s"
+                                         " of type %u at offset %s"),
+                                       entry->item.revision,
+                                       num_str,
+                                       (unsigned int)entry->type,
+                                       apr_off_t_toa(pool, offset));
+            }
           /* Check contents. */
           if (entry->type == SVN_FS_FS__ITEM_TYPE_UNUSED)
             {

Propchange: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
  Merged /subversion/branches/swig-py3/subversion/libsvn_fs_x:r1813660-1869353
  Merged /subversion/trunk/subversion/libsvn_fs_x:r1842403-1897029

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/batch_fsync.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/batch_fsync.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/batch_fsync.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/batch_fsync.c Fri Jan 14 14:01:45 2022
@@ -21,7 +21,6 @@
  */
 
 #include <apr_thread_pool.h>
-#include <apr_thread_cond.h>
 
 #include "batch_fsync.h"
 #include "svn_pools.h"
@@ -33,6 +32,8 @@
 #include "private/svn_dep_compat.h"
 #include "private/svn_mutex.h"
 #include "private/svn_subr_private.h"
+#include "private/svn_thread_cond.h"
+#include "private/svn_waitable_counter.h"
 
 /* Handy macro to check APR function results and turning them into
  * svn_error_t upon failure. */
@@ -43,140 +44,6 @@
       return svn_error_wrap_apr(status_, msg);  \
   }
 
-
-/* A simple SVN-wrapper around the apr_thread_cond_* API */
-#if APR_HAS_THREADS
-typedef apr_thread_cond_t svn_thread_cond__t;
-#else
-typedef int svn_thread_cond__t;
-#endif
-
-static svn_error_t *
-svn_thread_cond__create(svn_thread_cond__t **cond,
-                        apr_pool_t *result_pool)
-{
-#if APR_HAS_THREADS
-
-  WRAP_APR_ERR(apr_thread_cond_create(cond, result_pool),
-               _("Can't create condition variable"));
-
-#else
-
-  *cond = apr_pcalloc(result_pool, sizeof(**cond));
-
-#endif
-
-  return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-svn_thread_cond__broadcast(svn_thread_cond__t *cond)
-{
-#if APR_HAS_THREADS
-
-  WRAP_APR_ERR(apr_thread_cond_broadcast(cond),
-               _("Can't broadcast condition variable"));
-
-#endif
-
-  return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-svn_thread_cond__wait(svn_thread_cond__t *cond,
-                      svn_mutex__t *mutex)
-{
-#if APR_HAS_THREADS
-
-  WRAP_APR_ERR(apr_thread_cond_wait(cond, svn_mutex__get(mutex)),
-               _("Can't broadcast condition variable"));
-
-#endif
-
-  return SVN_NO_ERROR;
-}
-
-/* Utility construct:  Clients can efficiently wait for the encapsulated
- * counter to reach a certain value.  Currently, only increments have been
- * implemented.  This whole structure can be opaque to the API users.
- */
-typedef struct waitable_counter_t
-{
-  /* Current value, initialized to 0. */
-  int value;
-
-  /* Synchronization objects. */
-  svn_thread_cond__t *cond;
-  svn_mutex__t *mutex;
-} waitable_counter_t;
-
-/* Set *COUNTER_P to a new waitable_counter_t instance allocated in
- * RESULT_POOL.  The initial counter value is 0. */
-static svn_error_t *
-waitable_counter__create(waitable_counter_t **counter_p,
-                         apr_pool_t *result_pool)
-{
-  waitable_counter_t *counter = apr_pcalloc(result_pool, sizeof(*counter));
-  counter->value = 0;
-
-  SVN_ERR(svn_thread_cond__create(&counter->cond, result_pool));
-  SVN_ERR(svn_mutex__init(&counter->mutex, TRUE, result_pool));
-
-  *counter_p = counter;
-
-  return SVN_NO_ERROR;
-}
-
-/* Increment the value in COUNTER by 1. */
-static svn_error_t *
-waitable_counter__increment(waitable_counter_t *counter)
-{
-  SVN_ERR(svn_mutex__lock(counter->mutex));
-  counter->value++;
-
-  SVN_ERR(svn_thread_cond__broadcast(counter->cond));
-  SVN_ERR(svn_mutex__unlock(counter->mutex, SVN_NO_ERROR));
-
-  return SVN_NO_ERROR;
-}
-
-/* Efficiently wait for COUNTER to assume VALUE. */
-static svn_error_t *
-waitable_counter__wait_for(waitable_counter_t *counter,
-                           int value)
-{
-  svn_boolean_t done = FALSE;
-
-  /* This loop implicitly handles spurious wake-ups. */
-  do
-    {
-      SVN_ERR(svn_mutex__lock(counter->mutex));
-
-      if (counter->value == value)
-        done = TRUE;
-      else
-        SVN_ERR(svn_thread_cond__wait(counter->cond, counter->mutex));
-
-      SVN_ERR(svn_mutex__unlock(counter->mutex, SVN_NO_ERROR));
-    }
-  while (!done);
-
-  return SVN_NO_ERROR;
-}
-
-/* Set the value in COUNTER to 0. */
-static svn_error_t *
-waitable_counter__reset(waitable_counter_t *counter)
-{
-  SVN_ERR(svn_mutex__lock(counter->mutex));
-  counter->value = 0;
-  SVN_ERR(svn_mutex__unlock(counter->mutex, SVN_NO_ERROR));
-
-  SVN_ERR(svn_thread_cond__broadcast(counter->cond));
-
-  return SVN_NO_ERROR;
-}
-
 /* Entry type for the svn_fs_x__batch_fsync_t collection.  There is one
  * instance per file handle.
  */
@@ -193,7 +60,7 @@ typedef struct to_sync_t
   svn_error_t *result;
 
   /* Counter to increment when we completed the task. */
-  waitable_counter_t *counter;
+  svn_waitable_counter_t *counter;
 } to_sync_t;
 
 /* The actual collection object. */
@@ -203,7 +70,7 @@ struct svn_fs_x__batch_fsync_t
   apr_hash_t *files;
 
   /* Counts the number of completed fsync tasks. */
-  waitable_counter_t *counter;
+  svn_waitable_counter_t *counter;
 
   /* Perform fsyncs only if this flag has been set. */
   svn_boolean_t flush_to_disk;
@@ -330,7 +197,7 @@ svn_fs_x__batch_fsync_create(svn_fs_x__b
   result->files = svn_hash__make(result_pool);
   result->flush_to_disk = flush_to_disk;
 
-  SVN_ERR(waitable_counter__create(&result->counter, result_pool));
+  SVN_ERR(svn_waitable_counter__create(&result->counter, result_pool));
   apr_pool_cleanup_register(result_pool, result, fsync_batch_cleanup,
                             apr_pool_cleanup_null);
 
@@ -483,7 +350,7 @@ flush_task(apr_thread_t *tid,
      OTOH, the main thread will probably deadlock anyway if we got
      an error here, thus there is no point in trying to tell the
      main thread what the problem was. */
-  svn_error_clear(waitable_counter__increment(to_sync->counter));
+  svn_error_clear(svn_waitable_counter__increment(to_sync->counter));
 
   return NULL;
 }
@@ -518,7 +385,7 @@ svn_fs_x__batch_fsync_run(svn_fs_x__batc
 
   /* Make sure the task completion counter is set to 0. */
   chain = svn_error_compose_create(chain,
-                                   waitable_counter__reset(batch->counter));
+                                   svn_waitable_counter__reset(batch->counter));
 
   /* Start the actual fsyncing process. */
   if (batch->flush_to_disk)
@@ -562,8 +429,8 @@ svn_fs_x__batch_fsync_run(svn_fs_x__batc
 
   /* Wait for all outstanding flush operations to complete. */
   chain = svn_error_compose_create(chain,
-                                   waitable_counter__wait_for(batch->counter,
-                                                              tasks));
+                                   svn_waitable_counter__wait_for(
+                                       batch->counter, tasks));
 
   /* Collect the results, close all files and release memory. */
   for (hi = apr_hash_first(scratch_pool, batch->files);

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/cached_data.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/cached_data.c Fri Jan 14 14:01:45 2022
@@ -394,7 +394,7 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
 {
   svn_fs_x__noderev_t *noderev;
 
-  /* If we want a full acccess log, we need to provide full data and
+  /* If we want a full access log, we need to provide full data and
      cannot take shortcuts here. */
 #if !defined(SVN_FS_X__LOG_ACCESS)
 
@@ -951,7 +951,7 @@ typedef struct rep_read_baton_t
   /* Used for temporary allocations during the read. */
   apr_pool_t *scratch_pool;
 
-  /* Pool used to store file handles and other data that is persistant
+  /* Pool used to store file handles and other data that is persistent
      for the entire stream read. */
   apr_pool_t *filehandle_pool;
 } rep_read_baton_t;
@@ -1518,7 +1518,7 @@ get_combined_window(svn_stringbuf_t **re
   return SVN_NO_ERROR;
 }
 
-/* Returns whether or not the expanded fulltext of the file is cachable
+/* Returns whether or not the expanded fulltext of the file is cacheable
  * based on its size SIZE.  The decision depends on the cache used by FFD.
  */
 static svn_boolean_t
@@ -2229,7 +2229,7 @@ svn_fs_x__get_contents_from_file(svn_str
                              rb->filehandle_pool, rb->scratch_pool));
 
       /* Insert the access to REP as the first element of the delta chain. */
-      svn_sort__array_insert(rb->rs_list, &rs, 0);
+      SVN_ERR(svn_sort__array_insert2(rb->rs_list, &rs, 0));
     }
 
   /* Now, the baton is complete and we can assemble the stream around it. */
@@ -2585,7 +2585,7 @@ parse_dir_entries(apr_array_header_t **e
 }
 
 /* For directory NODEREV in FS, return the *FILESIZE of its in-txn
- * representation.  If the directory representation is comitted data,
+ * representation.  If the directory representation is committed data,
  * set *FILESIZE to SVN_INVALID_FILESIZE. Use SCRATCH_POOL for temporaries.
  */
 static svn_error_t *

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/caching.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/caching.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/caching.c Fri Jan 14 14:01:45 2022
@@ -415,7 +415,7 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
    *   (e.g. fulltexts etc.)
    * - Index data required to find any of the other data has high prio
    *   (e.g. noderevs, L2P and P2L index pages)
-   * - everthing else should use default prio
+   * - everything else should use default prio
    */
 
 #ifdef SVN_DEBUG_CACHE_DUMP_STATS

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.c Fri Jan 14 14:01:45 2022
@@ -807,7 +807,7 @@ get_copy_inheritance(svn_fs_x__copy_id_i
      or if it is a branch point that we are accessing via its original
      copy destination path. */
   svn_fs_x__dag_get_copyroot(&copyroot_rev, &copyroot_path, child->node);
-  SVN_ERR(svn_fs_x__revision_root(&copyroot_root, fs, copyroot_rev, 
+  SVN_ERR(svn_fs_x__revision_root(&copyroot_root, fs, copyroot_rev,
                                   scratch_pool));
   SVN_ERR(svn_fs_x__get_temp_dag_node(&copyroot_node, copyroot_root,
                                       copyroot_path, scratch_pool));
@@ -833,7 +833,7 @@ get_copy_inheritance(svn_fs_x__copy_id_i
 }
 
 /* Allocate a new svn_fs_x__dag_path_t node from RESULT_POOL, containing
-   NODE, ENTRY and PARENT, all copied into RESULT_POOL as well.  */
+   NODE, ENTRY and PARENT; NODE and ENTRY are copied into RESULT_POOL.  */
 static svn_fs_x__dag_path_t *
 make_parent_path(dag_node_t *node,
                  const svn_stringbuf_t *entry,
@@ -909,7 +909,7 @@ svn_fs_x__get_dag_path(svn_fs_x__dag_pat
         {
           /* If this was the last path component, and the caller
              said it was optional, then don't return an error;
-             just put a NULL node pointer in the path. 
+             just put a NULL node pointer in the path.
            */
           if ((flags & svn_fs_x__dag_path_last_optional)
               && (path_len == path.len))

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/dag_cache.h Fri Jan 14 14:01:45 2022
@@ -103,7 +103,7 @@ typedef struct svn_fs_x__dag_path_t
    IS_TXN_PATH must be set.  If IS_TXN_PATH is FALSE, no copy ID
    inheritance information will be calculated for the *PARENT_PATH_P chain.
 
-   If FLAGS & open_path_last_optional is zero, return the error
+   If FLAGS & svn_fs_x__dag_path_last_optional is zero, return the error
    SVN_ERR_FS_NOT_FOUND if the node PATH refers to does not exist.  If
    non-zero, require all the parent directories to exist as normal,
    but if the final path component doesn't exist, simply return a path

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs.c Fri Jan 14 14:01:45 2022
@@ -310,7 +310,8 @@ static fs_vtable_t fs_vtable = {
   x_info,
   svn_fs_x__verify_root,
   x_freeze,
-  x_set_errcall
+  x_set_errcall,
+  NULL /* ioctl */
 };
 
 
@@ -641,7 +642,8 @@ static fs_library_vtable_t library_vtabl
   x_logfiles,
   NULL /* parse_id */,
   x_set_svn_fs_open,
-  x_info_dup
+  x_info_dup,
+  NULL /* ioctl */
 };
 
 svn_error_t *

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs_x.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/fs_x.c Fri Jan 14 14:01:45 2022
@@ -951,7 +951,7 @@ write_revision_zero(svn_fs_t *fs,
 
   SVN_ERR(svn_io_file_open(&apr_file,
                            svn_fs_x__path_revprops(fs, 0, scratch_pool),
-                           APR_WRITE | APR_CREATE, APR_OS_DEFAULT, 
+                           APR_WRITE | APR_CREATE, APR_OS_DEFAULT,
                            scratch_pool));
   SVN_ERR(svn_fs_x__write_non_packed_revprops(apr_file, proplist,
                                               scratch_pool));

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/hotcopy.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/hotcopy.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/hotcopy.c Fri Jan 14 14:01:45 2022
@@ -625,7 +625,7 @@ hotcopy_body(void *baton,
     SVN_ERR(cancel_func(cancel_baton));
 
   /* Split the logic for new and old FS formats. The latter is much simpler
-   * due to the absense of sharding and packing. However, it requires special
+   * due to the absence of sharding and packing. However, it requires special
    * care when updating the 'current' file (which contains not just the
    * revision number, but also the next-ID counters). */
   SVN_ERR(hotcopy_revisions(src_fs, dst_fs, src_youngest, dst_youngest,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/id.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/id.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/id.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/id.h Fri Jan 14 14:01:45 2022
@@ -37,7 +37,7 @@ typedef apr_int64_t svn_fs_x__txn_id_t;
 
 /* Change set is the umbrella term for transaction and revision in FSX.
  * Revision numbers (>=0) map 1:1 onto change sets while txns are mapped
- * onto the negatve value range. */
+ * onto the negative value range. */
 typedef apr_int64_t svn_fs_x__change_set_t;
 
 /* Invalid / unused change set number. */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/index.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/index.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/index.c Fri Jan 14 14:01:45 2022
@@ -953,7 +953,7 @@ svn_fs_x__l2p_index_append(svn_checksum_
                                               &eof, local_pool));
 
       /* handle new revision */
-      if ((entry > 0 && proto_entry.offset == 0) || eof)
+      if (eof || (entry > 0 && proto_entry.offset == 0))
         {
           /* dump entries, grouped into pages */
 
@@ -2219,7 +2219,7 @@ svn_fs_x__p2l_index_append(svn_checksum_
       SVN_ERR(read_p2l_entry_from_proto_index(proto_index, &entry,
                                               &eof, iterpool));
 
-      if (entry.item_count && !eof)
+      if (!eof && entry.item_count)
         {
           entry.items = apr_palloc(iterpool,
                                    entry.item_count * sizeof(*entry.items));
@@ -2742,8 +2742,8 @@ get_p2l_page(apr_array_header_t **entrie
  * Set *END to TRUE if the caller should stop refeching.
  *
  * *BATON will be updated with the selected page's info and SCRATCH_POOL
- * will be used for temporary allocations.  If the data is alread in the
- * cache, descrease *LEAKING_BUCKET and increase it otherwise.  With that
+ * will be used for temporary allocations.  If the data is already in the
+ * cache, decrease *LEAKING_BUCKET and increase it otherwise.  With that
  * pattern we will still read all pages from the block even if some of
  * them survived in the cached.
  */
@@ -2919,7 +2919,7 @@ append_p2l_entries(apr_array_header_t *e
     }
 }
 
-/* Auxilliary struct passed to p2l_entries_func selecting the relevant
+/* Auxiliary struct passed to p2l_entries_func selecting the relevant
  * data range. */
 typedef struct p2l_entries_baton_t
 {

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/low_level.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/low_level.c Fri Jan 14 14:01:45 2022
@@ -161,16 +161,16 @@ svn_fs_x__parse_footer(apr_off_t *l2p_of
                             rev));
   *p2l_offset = (apr_off_t)val;
 
-  /* The P2L indes follows the L2P index */
+  /* The P2L index follows the L2P index */
   if (*p2l_offset <= *l2p_offset)
     return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
                              "P2L offset %s must be larger than L2P offset %s"
                              " in r%ld footer",
                              apr_psprintf(result_pool,
-                                          "%" APR_UINT64_T_HEX_FMT,
+                                          "0x%" APR_UINT64_T_HEX_FMT,
                                           (apr_uint64_t)*p2l_offset),
                              apr_psprintf(result_pool,
-                                          "%" APR_UINT64_T_HEX_FMT,
+                                          "0x%" APR_UINT64_T_HEX_FMT,
                                           (apr_uint64_t)*l2p_offset),
                              rev);
 
@@ -998,7 +998,7 @@ svn_fs_x__read_changes(apr_array_header_
       SVN_ERR(read_change(&change, stream, result_pool, iterpool));
       if (!change)
         break;
- 
+
       APR_ARRAY_PUSH(*changes, svn_fs_x__change_t*) = change;
     }
   svn_pool_destroy(iterpool);

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/pack.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/pack.c Fri Jan 14 14:01:45 2022
@@ -1461,7 +1461,7 @@ copy_reps_from_temp(pack_context_t *cont
   SVN_ERR(store_items(context, temp_file, reps, initial_reps_count,
                       scratch_pool));
 
-  /* vaccum ENTRIES array: eliminate NULL entries */
+  /* vacuum ENTRIES array: eliminate NULL entries */
   for (i = 0, k = 0; i < reps->nelts; ++i)
     {
       svn_fs_x__p2l_entry_t *entry
@@ -1686,7 +1686,7 @@ write_l2p_index(pack_context_t *context,
                                                context->reps,
                                                pool, scratch_pool));
 
-  /* Append newly written segment to exisiting proto index file. */
+  /* Append newly written segment to existing proto index file. */
   SVN_ERR(svn_io_file_name_get(&proto_index, context->proto_l2p_index,
                                scratch_pool));
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/rev_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/rev_file.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/rev_file.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/rev_file.c Fri Jan 14 14:01:45 2022
@@ -66,7 +66,7 @@ struct svn_fs_x__revision_file_t
   svn_fs_x__index_info_t p2l_info;
 
   /* Pool used for all sub-structure allocations (file, streams etc.).
-     A sub-pool of OWNER. NULL until the lazily initilized. */
+     A sub-pool of OWNER. NULL until the lazily initialized. */
   apr_pool_t *pool;
 
   /* Pool that this structure got allocated in. */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/revprops.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/revprops.c Fri Jan 14 14:01:45 2022
@@ -449,7 +449,7 @@ verify_checksum(svn_stringbuf_t *content
                        content->len, scratch_pool));
 
   if (!svn_checksum_match(actual, expected))
-    SVN_ERR(svn_checksum_mismatch_err(expected, actual, scratch_pool, 
+    SVN_ERR(svn_checksum_mismatch_err(expected, actual, scratch_pool,
                                       "checksum mismatch"));
 
   return SVN_NO_ERROR;
@@ -1203,7 +1203,7 @@ repack_file_open(apr_file_t **file,
   if (revprops->entry.start_rev == start_rev)
     APR_ARRAY_IDX(revprops->manifest, idx, manifest_entry_t) = new_entry;
   else
-    svn_sort__array_insert(revprops->manifest, &new_path, idx + 1);
+    SVN_ERR(svn_sort__array_insert2(revprops->manifest, &new_path, idx + 1));
 
   /* open the file */
   new_path = get_revprop_pack_filepath(revprops, &new_entry, scratch_pool);
@@ -1424,7 +1424,7 @@ svn_fs_x__set_revision_proplist(svn_fs_t
                                  scratch_pool));
   else
     SVN_ERR(write_non_packed_revprop(&final_path, &tmp_path,
-                                     fs, rev, proplist, batch, 
+                                     fs, rev, proplist, batch,
                                      scratch_pool, scratch_pool));
 
   /* We use the rev file of this revision as the perms reference,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/structure
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/structure?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/structure (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/structure Fri Jan 14 14:01:45 2022
@@ -112,7 +112,7 @@ representation checksum and location map
 hash text as the primary key, mapped to the representation revision, offset,
 size and expanded size.  This file is only consulted during writes and never
 during reads.  Consequently, it is not required, and may be removed at an
-abritrary time, with the subsequent loss of rep-sharing capabilities for
+arbitrary time, with the subsequent loss of rep-sharing capabilities for
 revisions written thereafter.
 
 Filesystem formats

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/temp_serializer.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/temp_serializer.c Fri Jan 14 14:01:45 2022
@@ -38,7 +38,7 @@
 #include "cached_data.h"
 
 /* Utility to encode a signed NUMBER into a variable-length sequence of
- * 8-bit chars in KEY_BUFFER and return the last writen position.
+ * 8-bit chars in KEY_BUFFER and return the last written position.
  *
  * Numbers will be stored in 7 bits / byte and using byte values above
  * 32 (' ') to make them combinable with other string by simply separating
@@ -183,7 +183,7 @@ svn_fs_x__deserialize_apr_array(void *bu
   (*array)->pool = result_pool;
 }
 
-/* auxilliary structure representing the content of a directory array */
+/* auxiliary structure representing the content of a directory array */
 typedef struct dir_data_t
 {
   /* number of entries in the directory
@@ -925,13 +925,13 @@ slowly_replace_dir_entry(void **data,
         APR_ARRAY_IDX(entries, idx, svn_fs_x__dirent_t *)
           = replace_baton->new_entry;
       else
-        svn_sort__array_insert(entries, &replace_baton->new_entry, idx);
+        SVN_ERR(svn_sort__array_insert2(entries, &replace_baton->new_entry, idx));
     }
   else
     {
       /* Remove the old ENTRY. */
       if (entry)
-        svn_sort__array_delete(entries, idx, 1);
+        SVN_ERR(svn_sort__array_delete2(entries, idx, 1));
     }
 
   return svn_fs_x__serialize_dir_entries(data, data_len, dir, pool);

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/transaction.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/transaction.c Fri Jan 14 14:01:45 2022
@@ -881,7 +881,7 @@ unparse_dir_entry(svn_fs_x__dirent_t *di
   apr_size_t to_write;
   apr_size_t name_len = strlen(dirent->name);
 
-  /* A buffer with sufficient space for 
+  /* A buffer with sufficient space for
    * - entry name + 1 terminating NUL
    * - 1 byte for the node kind
    * - 2 numbers in 7b/8b encoding for the noderev-id
@@ -3066,7 +3066,7 @@ get_final_id(svn_fs_x__id_t *part,
     part->change_set = svn_fs_x__change_set_by_rev(revision);
 }
 
-/* Copy a node-revision specified by id ID in fileystem FS from a
+/* Copy a node-revision specified by id ID in filesystem FS from a
    transaction into the proto-rev-file FILE.  Set *NEW_ID_P to a
    pointer to the new noderev-id.  If this is a directory, copy all
    children as well.
@@ -3738,7 +3738,7 @@ promote_cached_directories(svn_fs_t *fs,
 
       /* Currently, the entry for KEY - if it still exists - is marked
        * as "stale" and would not be used.  Mark it as current for in-
-       * revison data. */
+       * revision data. */
       SVN_ERR(svn_cache__set_partial(ffd->dir_cache, key,
                                      svn_fs_x__reset_txn_filesize, NULL,
                                      iterpool));

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/tree.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/tree.c Fri Jan 14 14:01:45 2022
@@ -2072,7 +2072,7 @@ text_stream_writer(void *baton,
   return svn_stream_write(tb->file_stream, data, len);
 }
 
-/* Close function for the publically returned stream. */
+/* Close function for the publicly returned stream. */
 static svn_error_t *
 text_stream_closer(void *baton)
 {

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/util.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/util.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/util.h Fri Jan 14 14:01:45 2022
@@ -384,7 +384,7 @@ svn_error_t *
 svn_fs_x__update_min_unpacked_rev(svn_fs_t *fs,
                                   apr_pool_t *scratch_pool);
 
-/* Atomically update the 'min-unpacked-rev' file in FS to hold the specifed
+/* Atomically update the 'min-unpacked-rev' file in FS to hold the specified
  * REVNUM.  Perform temporary allocations in SCRATCH_POOL.
  */
 svn_error_t *
@@ -400,7 +400,7 @@ svn_fs_x__read_current(svn_revnum_t *rev
                        svn_fs_t *fs,
                        apr_pool_t *scratch_pool);
 
-/* Atomically update the 'current' file to hold the specifed REV.
+/* Atomically update the 'current' file to hold the specified REV.
    Perform temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_fs_x__write_current(svn_fs_t *fs,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_fs_x/verify.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_fs_x/verify.c Fri Jan 14 14:01:45 2022
@@ -179,7 +179,7 @@ verify_index_checksum(svn_fs_x__revision
 
       SVN_ERR(svn_fs_x__rev_file_name(&file_name, file, scratch_pool));
       SVN_ERR(svn_checksum_mismatch_err(index_info->checksum, actual,
-                                        scratch_pool, 
+                                        scratch_pool,
                                         _("%s checksum mismatch in file %s"),
                                         name, file_name));
     }

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/compat.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/compat.c Fri Jan 14 14:01:45 2022
@@ -942,7 +942,7 @@ svn_ra__get_inherited_props_walk(svn_ra_
                                                          parent_url,
                                                          result_pool);
           new_iprop->prop_hash = final_hash;
-          svn_sort__array_insert(*inherited_props, &new_iprop, 0);
+          SVN_ERR(svn_sort__array_insert2(*inherited_props, &new_iprop, 0));
         }
     }
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/deprecated.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/deprecated.c Fri Jan 14 14:01:45 2022
@@ -151,6 +151,19 @@ static svn_ra_reporter2_t reporter_3in2_
   abort_report
 };
 
+svn_error_t *svn_ra_open4(svn_ra_session_t **session_p,
+                          const char **corrected_url_p,
+                          const char *repos_URL,
+                          const char *uuid,
+                          const svn_ra_callbacks2_t *callbacks,
+                          void *callback_baton,
+                          apr_hash_t *config,
+                          apr_pool_t *pool)
+{
+  return svn_ra_open5(session_p, corrected_url_p, NULL, repos_URL, uuid,
+                      callbacks, callback_baton, config, pool);
+}
+
 svn_error_t *svn_ra_open3(svn_ra_session_t **session_p,
                           const char *repos_URL,
                           const char *uuid,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.c Fri Jan 14 14:01:45 2022
@@ -243,7 +243,7 @@ svn_error_t *svn_ra_initialize(apr_pool_
 /* Please note: the implementation of svn_ra_create_callbacks is
  * duplicated in libsvn_ra/wrapper_template.h:compat_open() .  This
  * duplication is intentional, is there to avoid a circular
- * dependancy, and is justified in great length in the code of
+ * dependency, and is justified in great length in the code of
  * compat_open() in libsvn_ra/wrapper_template.h.  If you modify the
  * implementation of svn_ra_create_callbacks(), be sure to keep the
  * code in wrapper_template.h:compat_open() in sync with your
@@ -256,8 +256,9 @@ svn_ra_create_callbacks(svn_ra_callbacks
   return SVN_NO_ERROR;
 }
 
-svn_error_t *svn_ra_open4(svn_ra_session_t **session_p,
+svn_error_t *svn_ra_open5(svn_ra_session_t **session_p,
                           const char **corrected_url_p,
+                          const char **redirect_url_p,
                           const char *repos_URL,
                           const char *uuid,
                           const svn_ra_callbacks2_t *callbacks,
@@ -381,7 +382,7 @@ svn_error_t *svn_ra_open4(svn_ra_session
   session->pool = sesspool;
 
   /* Ask the library to open the session. */
-  err = vtable->open_session(session, corrected_url_p,
+  err = vtable->open_session(session, corrected_url_p, redirect_url_p,
                              repos_URL,
                              callbacks, callback_baton, auth_baton,
                              config, sesspool, scratch_pool);
@@ -406,12 +407,14 @@ svn_error_t *svn_ra_open4(svn_ra_session
     {
       /* *session_p = NULL; */
       *corrected_url_p = apr_pstrdup(pool, *corrected_url_p);
+      if (redirect_url_p && *redirect_url_p)
+        *redirect_url_p = apr_pstrdup(pool, *redirect_url_p);
       svn_pool_destroy(sesspool); /* Includes scratch_pool */
       return SVN_NO_ERROR;
     }
 
   if (vtable->set_svn_ra_open)
-    SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open4));
+    SVN_ERR(vtable->set_svn_ra_open(session, svn_ra_open5));
 
   /* Check the UUID. */
   if (uuid)
@@ -472,7 +475,7 @@ svn_ra__dup_session(svn_ra_session_t **n
                                            scratch_pool));
 
   if (session->vtable->set_svn_ra_open)
-    SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open4));
+    SVN_ERR(session->vtable->set_svn_ra_open(session, svn_ra_open5));
 
   *new_session = session;
   return SVN_NO_ERROR;

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/ra_loader.h Fri Jan 14 14:01:45 2022
@@ -42,6 +42,7 @@ extern "C" {
    handed to the ra api to allow opening other ra sessions. */
 typedef svn_error_t * (*svn_ra__open_func_t)(svn_ra_session_t **session_p,
                                               const char **corrected_url,
+                                              const char **redirect_url,
                                               const char *repos_URL,
                                               const char *uuid,
                                               const svn_ra_callbacks2_t *callbacks,
@@ -64,11 +65,12 @@ typedef struct svn_ra__vtable_t {
 
   /* Implementations of the public API functions. */
 
-  /* See svn_ra_open4(). */
+  /* See svn_ra_open5(). */
   /* All fields in SESSION, except priv, have been initialized by the
      time this is called.  SESSION->priv may be set by this function. */
   svn_error_t *(*open_session)(svn_ra_session_t *session,
                                const char **corrected_url,
+                               const char **redirect_url,
                                const char *session_URL,
                                const svn_ra_callbacks2_t *callbacks,
                                void *callback_baton,
@@ -326,7 +328,7 @@ typedef struct svn_ra__vtable_t {
                                       svn_revnum_t revision,
                                       apr_pool_t *result_pool,
                                       apr_pool_t *scratch_pool);
-  /* If not NULL, receives a pointer to svn_ra_open, to alllow opening
+  /* If not NULL, receives a pointer to svn_ra_open, to allow opening
      a new ra session from inside the ra layer without a circular
      library dependency*/
   svn_error_t *(*set_svn_ra_open)(svn_ra_session_t *session,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/util.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/util.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/util.c Fri Jan 14 14:01:45 2022
@@ -216,7 +216,7 @@ svn_ra__get_operational_lock(const svn_s
       /* Did we get a value from the repository?  We'll check to see
          if it matches our token.  If so, we call it success.  If not
          and we're told to steal locks, we remember the existing lock
-         token and fall through to the locking code; othewise, we
+         token and fall through to the locking code; otherwise, we
          sleep and retry. */
       if (reposlocktoken)
         {

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra/wrapper_template.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra/wrapper_template.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra/wrapper_template.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra/wrapper_template.h Fri Jan 14 14:01:45 2022
@@ -61,9 +61,9 @@ static svn_error_t *compat_open(void **s
 {
   /* Here, we should be calling svn_ra_create_callbacks to initialize
    * the svn_ra_callbacks2_t structure.  However, doing that
-   * introduces a circular dependancy between libsvn_ra and
+   * introduces a circular dependency between libsvn_ra and
    * libsvn_ra_{local,neon,serf,svn}, which include
-   * wrapper_template.h.  In turn, circular dependancies break the
+   * wrapper_template.h.  In turn, circular dependencies break the
    * build on win32 (and possibly other systems).
    *
    * In order to avoid this happening at all, the code of
@@ -90,7 +90,7 @@ static svn_error_t *compat_open(void **s
   callbacks2->progress_func = NULL;
   callbacks2->progress_baton = NULL;
 
-  SVN_ERR(VTBL.open_session(sess, &session_url, repos_URL,
+  SVN_ERR(VTBL.open_session(sess, &session_url, NULL, repos_URL,
                             callbacks2, callback_baton,
                             callbacks ? callbacks->auth_baton : NULL,
                             config, sesspool, sesspool));

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_local/ra_plugin.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_local/ra_plugin.c Fri Jan 14 14:01:45 2022
@@ -554,6 +554,7 @@ ignore_warnings(void *baton,
 static svn_error_t *
 svn_ra_local__open(svn_ra_session_t *session,
                    const char **corrected_url,
+                   const char **redirect_url,
                    const char *repos_URL,
                    const svn_ra_callbacks2_t *callbacks,
                    void *callback_baton,
@@ -576,6 +577,8 @@ svn_ra_local__open(svn_ra_session_t *ses
   /* We don't support redirections in ra-local. */
   if (corrected_url)
     *corrected_url = NULL;
+  if (redirect_url)
+    *redirect_url = NULL;
 
   /* Allocate and stash the session_sess args we have already. */
   sess = apr_pcalloc(pool, sizeof(*sess));
@@ -1751,7 +1754,7 @@ static svn_error_t *
 svn_ra_local__register_editor_shim_callbacks(svn_ra_session_t *session,
                                     svn_delta_shim_callbacks_t *callbacks)
 {
-  /* This is currenly a no-op, since we don't provide our own editor, just
+  /* This is currently a no-op, since we don't provide our own editor, just
      use the one the libsvn_repos hands back to us. */
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/commit.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/commit.c Fri Jan 14 14:01:45 2022
@@ -1211,7 +1211,7 @@ post_response_handler(serf_request_t *re
   /* Then see which ones we can discover. */
   serf_bucket_headers_do(hdrs, post_headers_iterator_callback, prc);
 
-  /* Execute the 'real' response handler to XML-parse the repsonse body. */
+  /* Execute the 'real' response handler to XML-parse the response body. */
   return svn_ra_serf__expect_empty_body(request, response,
                                         prc->handler, scratch_pool);
 }

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/get_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/get_file.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/get_file.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/get_file.c Fri Jan 14 14:01:45 2022
@@ -137,7 +137,7 @@ cancel_fetch(serf_request_t *request,
  * using SESSION->wc_callbacks->get_wc_contents() if sha1 property is
  * present in PROPS.
  *
- * Sets *FOUND_P to TRUE if file contents was successfuly fetched.
+ * Sets *FOUND_P to TRUE if file contents was successfully fetched.
  *
  * Performs all temporary allocations in POOL.
  */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/inherited_props.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/inherited_props.c Fri Jan 14 14:01:45 2022
@@ -28,14 +28,12 @@
 #include "svn_hash.h"
 #include "svn_path.h"
 #include "svn_ra.h"
-#include "svn_sorts.h"
 #include "svn_string.h"
 #include "svn_xml.h"
 #include "svn_props.h"
 #include "svn_base64.h"
 
 #include "private/svn_dav_protocol.h"
-#include "private/svn_sorts_private.h"
 #include "../libsvn_ra/ra_loader.h"
 #include "svn_private_config.h"
 #include "ra_serf.h"
@@ -314,8 +312,8 @@ get_iprops_via_more_requests(svn_ra_sess
   *iprops = apr_array_make(result_pool, rq_info->nelts,
                            sizeof(svn_prop_inherited_item_t *));
 
-  /* And now create the result set */
-  for (i = 0; i < rq_info->nelts; i++)
+  /* And now create the result set in depth-first order. */
+  for (i = rq_info->nelts - 1; i >= 0; i--)
     {
       iprop_rq_info_t *rq = APR_ARRAY_IDX(rq_info, i, iprop_rq_info_t *);
       apr_hash_t *node_props;
@@ -340,7 +338,7 @@ get_iprops_via_more_requests(svn_ra_sess
       new_iprop = apr_palloc(result_pool, sizeof(*new_iprop));
       new_iprop->path_or_url = apr_pstrdup(result_pool, rq->relpath);
       new_iprop->prop_hash = svn_prop_hash_dup(node_props, result_pool);
-      svn_sort__array_insert(*iprops, &new_iprop, 0);
+      APR_ARRAY_PUSH(*iprops, svn_prop_inherited_item_t *) = new_iprop;
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/lock.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/lock.c Fri Jan 14 14:01:45 2022
@@ -354,7 +354,7 @@ run_locks(svn_ra_serf__session_t *sess,
               SVN_ERR(cb_err);
 
               waittime_left = sess->timeout;
-              svn_sort__array_delete(lock_ctxs, i, 1);
+              SVN_ERR(svn_sort__array_delete2(lock_ctxs, i, 1));
               i--;
 
               svn_pool_destroy(ctx->pool);

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/options.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/options.c Fri Jan 14 14:01:45 2022
@@ -546,6 +546,7 @@ svn_ra_serf__v1_get_activity_collection(
 svn_error_t *
 svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
                                    const char **corrected_url,
+                                   const char **redirect_url,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool)
 {
@@ -553,6 +554,8 @@ svn_ra_serf__exchange_capabilities(svn_r
 
   if (corrected_url)
     *corrected_url = NULL;
+  if (redirect_url)
+    *redirect_url = NULL;
 
   /* This routine automatically fills in serf_sess->capabilities */
   SVN_ERR(create_options_req(&opt_ctx, serf_sess, scratch_pool));
@@ -575,8 +578,11 @@ svn_ra_serf__exchange_capabilities(svn_r
         }
       else if (svn_path_is_url(opt_ctx->handler->location))
         {
-          *corrected_url = svn_uri_canonicalize(opt_ctx->handler->location,
-                                                result_pool);
+          SVN_ERR(svn_uri_canonicalize_safe(corrected_url, NULL,
+              opt_ctx->handler->location, result_pool, scratch_pool));
+          if (redirect_url)
+            *redirect_url = apr_pstrdup(result_pool,
+                                        opt_ctx->handler->location);
         }
       else
         {
@@ -587,11 +593,14 @@ svn_ra_serf__exchange_capabilities(svn_r
              See issue #3775 for details. */
 
           apr_uri_t corrected_URI = serf_sess->session_url;
+          char *absolute_uri;
 
           corrected_URI.path = (char *)corrected_url;
-          *corrected_url = svn_uri_canonicalize(
-                              apr_uri_unparse(scratch_pool, &corrected_URI, 0),
-                              result_pool);
+          absolute_uri = apr_uri_unparse(scratch_pool, &corrected_URI, 0);
+          SVN_ERR(svn_uri_canonicalize_safe(corrected_url, NULL,
+              absolute_uri, result_pool, scratch_pool));
+          if (redirect_url)
+            *redirect_url = apr_pstrdup(result_pool, absolute_uri);
         }
 
       return SVN_NO_ERROR;
@@ -699,7 +708,8 @@ svn_ra_serf__has_capability(svn_ra_sessi
 
   /* If any capability is unknown, they're all unknown, so ask. */
   if (cap_result == NULL)
-    SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, pool, pool));
+    SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, NULL,
+                                               pool, pool));
 
   /* Try again, now that we've fetched the capabilities. */
   cap_result = svn_hash_gets(serf_sess->capabilities, capability);

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/property.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/property.c Fri Jan 14 14:01:45 2022
@@ -205,7 +205,7 @@ propfind_closed(svn_ra_serf__xml_estate_
 
   if (leaving_state == MULTISTATUS)
     {
-      /* We've gathered all the data from the reponse. Add this item
+      /* We've gathered all the data from the response. Add this item
          onto the "done list". External callers will then know this
          request has been completed (tho stray response bytes may still
          arrive).  */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/ra_serf.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/ra_serf.h Fri Jan 14 14:01:45 2022
@@ -379,7 +379,7 @@ svn_ra_serf__context_run_wait(svn_boolea
                               apr_pool_t *scratch_pool);
 
 /* Run the context once. Manage waittime_left to handle timing out when
-   nothing happens over the session->timout.
+   nothing happens over the session->timeout.
  */
 svn_error_t *
 svn_ra_serf__context_run(svn_ra_serf__session_t *sess,
@@ -716,7 +716,7 @@ svn_ra_serf__create_expat_handler(svn_ra
                                   apr_pool_t *result_pool);
 
 
-/* Allocated within XES->STATE_POOL. Changes are not allowd (callers
+/* Allocated within XES->STATE_POOL. Changes are not allowed (callers
    should make a deep copy if they need to make changes).
 
    The resulting hash maps char* names to char* values.  */
@@ -1472,6 +1472,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
 svn_error_t *
 svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
                                    const char **corrected_url,
+                                   const char **redirect_url,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool);
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/replay.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/replay.c Fri Jan 14 14:01:45 2022
@@ -666,7 +666,7 @@ svn_ra_serf__replay_range(svn_ra_session
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
 
   if (session->http20) {
-      /* ### Auch... this doesn't work yet... 
+      /* ### Auch... this doesn't work yet...
 
          This code relies on responses coming in in an exact order, while
          http2 does everything to deliver responses as fast as possible.

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/serf.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/serf.c Fri Jan 14 14:01:45 2022
@@ -363,7 +363,7 @@ load_config(svn_ra_serf__session_t *sess
     {
       apr_int64_t timeout;
       svn_error_t *err;
-      
+
       err = svn_cstring_strtoi64(&timeout, timeout_str, 0, APR_INT64_MAX, 10);
       if (err)
         return svn_error_createf(SVN_ERR_BAD_CONFIG_VALUE, err,
@@ -476,6 +476,7 @@ get_user_agent_string(apr_pool_t *pool)
 static svn_error_t *
 svn_ra_serf__open(svn_ra_session_t *session,
                   const char **corrected_url,
+                  const char **redirect_url,
                   const char *session_URL,
                   const svn_ra_callbacks2_t *callbacks,
                   void *callback_baton,
@@ -492,6 +493,8 @@ svn_ra_serf__open(svn_ra_session_t *sess
 
   if (corrected_url)
     *corrected_url = NULL;
+  if (redirect_url)
+    *redirect_url = NULL;
 
   serf_sess = apr_pcalloc(result_pool, sizeof(*serf_sess));
   serf_sess->pool = result_pool;
@@ -588,7 +591,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
      Luckily our caller now passes us two pools which handle this case.
    */
 #if defined(SVN_DEBUG) && !SERF_VERSION_AT_LEAST(1,4,0)
-  /* Currently ensured by svn_ra_open4().
+  /* Currently ensured by svn_ra_open5().
      If failing causes segfault in basic_tests.py 48, "basic auth test" */
   SVN_ERR_ASSERT((serf_sess->pool != scratch_pool)
                  && apr_pool_is_ancestor(serf_sess->pool, scratch_pool));
@@ -599,6 +602,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
   serf_sess->conn_latency = -1;
 
   err = svn_ra_serf__exchange_capabilities(serf_sess, corrected_url,
+                                           redirect_url,
                                            result_pool, scratch_pool);
 
   /* serf should produce a usable error code instead of APR_EGENERAL */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/update.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/update.c Fri Jan 14 14:01:45 2022
@@ -2223,7 +2223,7 @@ process_buffer(update_delay_baton_t *udb
 }
 
 
-/* Delaying wrapping reponse handler, to avoid creating too many
+/* Delaying wrapping response handler, to avoid creating too many
    requests to deliver efficiently */
 static svn_error_t *
 update_delay_handler(serf_request_t *request,

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/util.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_serf/util.c Fri Jan 14 14:01:45 2022
@@ -798,7 +798,7 @@ apr_status_t svn_ra_serf__handle_client_
  *
  * If CONTENT_TYPE is not-NULL, it will be sent as the Content-Type header.
  *
- * If DAV_HEADERS is non-zero, it will add standard DAV capabilites headers
+ * If DAV_HEADERS is non-zero, it will add standard DAV capabilities headers
  * to request.
  *
  * REQUEST_POOL should live for the duration of the request. Serf will
@@ -997,7 +997,7 @@ svn_ra_serf__context_run_wait(svn_boolea
 /* Ensure that a handler is no longer scheduled on the connection.
 
    Eventually serf will have a reliable way to cancel existing requests,
-   but currently it doesn't even have a way to relyable identify a request
+   but currently it doesn't even have a way to reliable identify a request
    after rescheduling, for auth reasons.
 
    So the only thing we can do today is reset the connection, which
@@ -1116,19 +1116,17 @@ response_get_location(serf_bucket_t *res
         return NULL;
 
       /* Replace the path path with what we got */
-      uri.path = (char*)svn_urlpath__canonicalize(location, scratch_pool);
+      uri.path = apr_pstrdup(scratch_pool, location);
 
       /* And make APR produce a proper full url for us */
-      location = apr_uri_unparse(scratch_pool, &uri, 0);
-
-      /* Fall through to ensure our canonicalization rules */
+      return apr_uri_unparse(result_pool, &uri, 0);
     }
   else if (!svn_path_is_url(location))
     {
       return NULL; /* Any other formats we should support? */
     }
 
-  return svn_uri_canonicalize(location, result_pool);
+  return apr_pstrdup(result_pool, location);
 }
 
 
@@ -1552,7 +1550,7 @@ handle_response_cb(serf_request_t *reque
          If we would return an error outer-status the connection
          would have to be restarted. With scheduled still TRUE
          destroying the handler's pool will still reset the
-         connection, avoiding the posibility of returning
+         connection, avoiding the possibility of returning
          an error for this handler when a new request is
          scheduled. */
       outer_status = APR_EAGAIN; /* Exit context loop */

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/client.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/client.c Fri Jan 14 14:01:45 2022
@@ -561,8 +561,8 @@ static svn_error_t *make_tunnel(const ch
   return SVN_NO_ERROR;
 }
 
-/* Parse URL inot URI, validating it and setting the default port if none
-   was given.  Allocate the URI fileds out of POOL. */
+/* Parse URL into URI, validating it and setting the default port if none
+   was given.  Allocate the URI fields out of POOL. */
 static svn_error_t *parse_url(const char *url, apr_uri_t *uri,
                               apr_pool_t *pool)
 {
@@ -841,6 +841,7 @@ is_valid_hostinfo(const char *hostinfo)
 
 static svn_error_t *ra_svn_open(svn_ra_session_t *session,
                                 const char **corrected_url,
+                                const char **redirect_url,
                                 const char *url,
                                 const svn_ra_callbacks2_t *callbacks,
                                 void *callback_baton,
@@ -858,6 +859,8 @@ static svn_error_t *ra_svn_open(svn_ra_s
   /* We don't support server-prescribed redirections in ra-svn. */
   if (corrected_url)
     *corrected_url = NULL;
+  if (redirect_url)
+    *redirect_url = NULL;
 
   SVN_ERR(parse_url(url, &uri, sess_pool));
 
@@ -913,7 +916,7 @@ static svn_error_t *ra_svn_dup_session(s
 {
   svn_ra_svn__session_baton_t *old_sess = old_session->priv;
 
-  SVN_ERR(ra_svn_open(new_session, NULL, new_session_url,
+  SVN_ERR(ra_svn_open(new_session, NULL, NULL, new_session_url,
                       old_sess->callbacks, old_sess->callbacks_baton,
                       old_sess->auth_baton, old_sess->config,
                       result_pool, scratch_pool));
@@ -1613,7 +1616,7 @@ static svn_error_t *ra_svn_get_dir(svn_r
 
          Note: they should NOT be "fixed" to send NULL, as that would break
          any older clients which received that NULL. But we may as well
-         be defensive against a malicous server.  */
+         be defensive against a malicious server.  */
       if (cdate == NULL)
         dirent->time = 0;
       else
@@ -3105,6 +3108,7 @@ ra_svn_get_deleted_rev(svn_ra_session_t
 {
   svn_ra_svn__session_baton_t *sess_baton = session->priv;
   svn_ra_svn_conn_t *conn = sess_baton->conn;
+  svn_error_t *err;
 
   path = reparent_path(session, path, pool);
 
@@ -3116,8 +3120,20 @@ ra_svn_get_deleted_rev(svn_ra_session_t
   SVN_ERR(handle_unsupported_cmd(handle_auth_request(sess_baton, pool),
                                  N_("'get-deleted-rev' not implemented")));
 
-  return svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, "r",
-                                                       revision_deleted));
+  err = svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, "r",
+                                                      revision_deleted));
+  /* The protocol does not allow for a reply of SVN_INVALID_REVNUM directly.
+     Instead, a new enough server returns SVN_ERR_ENTRY_MISSING_REVISION to
+     indicate the answer to the query is SVN_INVALID_REVNUM. (An older server
+     closes the connection and returns SVN_ERR_RA_SVN_CONNECTION_CLOSED.) */
+  if (err && err->apr_err == SVN_ERR_ENTRY_MISSING_REVISION)
+    {
+      *revision_deleted = SVN_INVALID_REVNUM;
+      svn_error_clear(err);
+    }
+  else
+    SVN_ERR(err);
+  return SVN_NO_ERROR;
 }
 
 static svn_error_t *

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/cyrus_auth.c Fri Jan 14 14:01:45 2022
@@ -277,7 +277,7 @@ void svn_ra_svn__default_secprops(sasl_s
   secprops->max_ssf = 256;
 
   /* Set maxbufsize to the maximum amount of data we can read at any one time.
-     This value needs to be commmunicated to the peer if a security layer
+     This value needs to be communicated to the peer if a security layer
      is negotiated. */
   secprops->maxbufsize = SVN_RA_SVN__READBUF_SIZE;
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/editorp.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/editorp.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/editorp.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/editorp.c Fri Jan 14 14:01:45 2022
@@ -118,7 +118,7 @@ make_token(char type,
   char buffer[1 + SVN_INT64_BUFFER_SIZE];
   buffer[0] = type;
   len = 1 + svn__ui64toa(&buffer[1], eb->next_token++);
-  
+
   return svn_string_ncreate(buffer, len, pool);
 }
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/marshal.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_ra_svn/marshal.c Fri Jan 14 14:01:45 2022
@@ -1888,7 +1888,7 @@ svn_ra_svn__has_command(svn_boolean_t *h
 {
   svn_error_t *err;
 
-  /* Don't make whitespace between commands trigger I/O limitiations. */
+  /* Don't make whitespace between commands trigger I/O limitations. */
   svn_ra_svn__reset_command_io_counters(conn);
 
   err = svn_ra_svn__has_item(has_command, conn, pool);
@@ -2786,9 +2786,6 @@ svn_error_t *svn_ra_svn__write_cmd_failu
   return writebuf_write_literal(conn, pool, ") ) ");
 }
 
-/* Initializer for static svn_string_t . */
-#define STATIC_SVN_STRING(x) { x, sizeof(x) - 1 }
-
 /* Return a pre-cooked serialized representation for the changed path
    flags NODE_KIND, TEXT_MODIFIED and PROPS_MODIFIED.  If we don't
    have a suitable pre-cooked string, return an empty string. */
@@ -2798,18 +2795,18 @@ changed_path_flags(svn_node_kind_t node_
                    svn_boolean_t props_modified)
 {
   static const svn_string_t file_flags[4]
-    = { STATIC_SVN_STRING(" ) ( 4:file false false ) ) "),
-        STATIC_SVN_STRING(" ) ( 4:file false true ) ) "),
-        STATIC_SVN_STRING(" ) ( 4:file true false ) ) "),
-        STATIC_SVN_STRING(" ) ( 4:file true true ) ) ") };
+    = { SVN__STATIC_STRING(" ) ( 4:file false false ) ) "),
+        SVN__STATIC_STRING(" ) ( 4:file false true ) ) "),
+        SVN__STATIC_STRING(" ) ( 4:file true false ) ) "),
+        SVN__STATIC_STRING(" ) ( 4:file true true ) ) ") };
 
   static const svn_string_t dir_flags[4]
-    = { STATIC_SVN_STRING(" ) ( 3:dir false false ) ) "),
-        STATIC_SVN_STRING(" ) ( 3:dir false true ) ) "),
-        STATIC_SVN_STRING(" ) ( 3:dir true false ) ) "),
-        STATIC_SVN_STRING(" ) ( 3:dir true true ) ) ") };
+    = { SVN__STATIC_STRING(" ) ( 3:dir false false ) ) "),
+        SVN__STATIC_STRING(" ) ( 3:dir false true ) ) "),
+        SVN__STATIC_STRING(" ) ( 3:dir true false ) ) "),
+        SVN__STATIC_STRING(" ) ( 3:dir true true ) ) ") };
 
-  static const svn_string_t no_flags = STATIC_SVN_STRING("");
+  static const svn_string_t no_flags = SVN__STATIC_STRING("");
 
   /* Select the array based on the NODE_KIND. */
   const svn_string_t *flags;

Modified: subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.c Fri Jan 14 14:01:45 2022
@@ -81,11 +81,11 @@ typedef struct limited_rights_t
    */
   path_access_t access;
 
-  /* Minimal access rights that the user has on this or any other node in 
+  /* Minimal access rights that the user has on this or any other node in
    * the sub-tree.  This does not take inherited rights into account. */
   authz_access_t min_rights;
 
-  /* Maximal access rights that the user has on this or any other node in 
+  /* Maximal access rights that the user has on this or any other node in
    * the sub-tree.  This does not take inherited rights into account. */
   authz_access_t max_rights;
 
@@ -130,6 +130,30 @@ static svn_object_pool__t *authz_pool =
 static svn_object_pool__t *filtered_pool = NULL;
 static svn_atomic_t authz_pool_initialized = FALSE;
 
+/*
+ * Ensure that we will initialize authz again if the pool which
+ * our authz caches depend on is cleared.
+ *
+ * HTTPD may run pre/post config hooks multiple times and clear
+ * its global configuration pool which our authz pools depend on.
+ * This happens in a non-threaded context during HTTPD's intialization
+ * and HTTPD's main loop, so it is safe to reset static variables here.
+ * (And any applications which cleared this pool while SVN threads
+ * were running would crash no matter what.)
+ *
+ * See issue #4880, "Use-after-free of object-pools in
+ * subversion/libsvn_repos/authz.c when used as httpd module"
+ */
+static apr_status_t
+deinit_authz(void *data)
+{
+  /* The two object pools run their own cleanup handlers. */
+  authz_pool = NULL;
+  filtered_pool = NULL;
+  authz_pool_initialized = FALSE;
+  return APR_SUCCESS;
+}
+
 /* Implements svn_atomic__err_init_func_t. */
 static svn_error_t *
 synchronized_authz_initialize(void *baton, apr_pool_t *pool)
@@ -143,6 +167,7 @@ synchronized_authz_initialize(void *bato
   SVN_ERR(svn_object_pool__create(&authz_pool, multi_threaded, pool));
   SVN_ERR(svn_object_pool__create(&filtered_pool, multi_threaded, pool));
 
+  apr_pool_cleanup_register(pool, NULL, deinit_authz, apr_pool_cleanup_null);
   return SVN_NO_ERROR;
 }
 
@@ -369,7 +394,7 @@ ensure_node_in_array(apr_array_header_t
    * Create one and insert it into the sorted array. */
   entry.node = create_node(segment, result_pool);
   entry.next = NULL;
-  svn_sort__array_insert(*array, &entry, idx);
+  svn_error_clear(svn_sort__array_insert2(*array, &entry, idx));
 
   return entry.node;
 }
@@ -889,9 +914,7 @@ create_user_authz(authz_full_t *authz,
   /* Use a separate sub-pool to keep memory usage tight. */
   apr_pool_t *subpool = svn_pool_create(scratch_pool);
 
-  /* Find all ACLs for REPOSITORY. 
-   * Note that repo-specific rules replace global rules,
-   * even if they don't apply to the current user. */
+  /* Find all ACLs for REPOSITORY. */
   apr_array_header_t *acls = apr_array_make(subpool, authz->acls->nelts,
                                             sizeof(authz_acl_t *));
   for (i = 0; i < authz->acls->nelts; ++i)
@@ -908,15 +931,36 @@ create_user_authz(authz_full_t *authz,
                 = APR_ARRAY_IDX(acls, acls->nelts - 1, const authz_acl_t *);
               if (svn_authz__compare_paths(&prev_acl->rule, &acl->rule) == 0)
                 {
+                  svn_boolean_t global_acl_applies;
+                  svn_boolean_t repos_acl_applies;
+
+                  /* Previous ACL is a global rule. */
                   SVN_ERR_ASSERT_NO_RETURN(!strcmp(prev_acl->rule.repos,
                                                    AUTHZ_ANY_REPOSITORY));
+                  /* Current ACL is a per-repository rule. */
                   SVN_ERR_ASSERT_NO_RETURN(strcmp(acl->rule.repos,
                                                   AUTHZ_ANY_REPOSITORY));
-                  apr_array_pop(acls);
+
+                  global_acl_applies =
+                    svn_authz__get_acl_access(NULL, prev_acl, user, repository);
+                  repos_acl_applies =
+                    svn_authz__get_acl_access(NULL, acl, user, repository);
+
+                  /* Prefer rules which apply to both this user and this path
+                   * over rules which apply only to the path. In cases where
+                   * both rules apply to user and path, always prefer the
+                   * repository-specific rule. */
+                  if (!global_acl_applies || repos_acl_applies)
+                    {
+                      apr_array_pop(acls);
+                      APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl;
+                    }
                 }
+              else
+                APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl;
             }
-
-          APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl;
+          else
+            APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl;
         }
     }
 
@@ -947,7 +991,7 @@ create_user_authz(authz_full_t *authz,
   svn_pool_clear(subpool);
   trim_tree(root, NO_SEQUENCE_NUMBER, subpool);
 
-  /* Calculate recursive rights. 
+  /* Calculate recursive rights.
    *
    * This is a bottom-up calculation of the range of access rights
    * specified anywhere in  the respective sub-tree, including the base
@@ -999,7 +1043,7 @@ static lookup_state_t *
 create_lookup_state(apr_pool_t *result_pool)
 {
   lookup_state_t *state = apr_pcalloc(result_pool, sizeof(*state));
- 
+
   state->next = apr_array_make(result_pool, 4, sizeof(node_t *));
   state->current = apr_array_make(result_pool, 4, sizeof(node_t *));
 
@@ -1548,6 +1592,8 @@ authz_read(authz_full_t **authz_p,
            const char *groups_path,
            svn_boolean_t must_exist,
            svn_repos_t *repos_hint,
+           svn_repos_authz_warning_func_t warning_func,
+           void *warning_baton,
            apr_pool_t *result_pool,
            apr_pool_t *scratch_pool)
 {
@@ -1587,7 +1633,8 @@ authz_read(authz_full_t **authz_p,
           /* Parse the configuration(s) and construct the full authz model
            * from it. */
           err = svn_authz__parse(authz_p, rules_stream, groups_stream,
-                                item_pool, scratch_pool);
+                                 warning_func, warning_baton,
+                                 item_pool, scratch_pool);
           if (err != SVN_NO_ERROR)
             {
               /* That pool would otherwise never get destroyed. */
@@ -1611,11 +1658,11 @@ authz_read(authz_full_t **authz_p,
     {
       /* Parse the configuration(s) and construct the full authz model from
        * it. */
-      err = svn_error_quick_wrapf(svn_authz__parse(authz_p, rules_stream,
-                                                   groups_stream,
-                                                   result_pool, scratch_pool),
-                                  "Error while parsing authz file: '%s':",
-                                  path);
+      err = svn_error_quick_wrapf(
+          svn_authz__parse(authz_p, rules_stream, groups_stream,
+                           warning_func, warning_baton,
+                           result_pool, scratch_pool),
+          "Error while parsing authz file: '%s':", path);
     }
 
   svn_repos__destroy_config_access(config_access);
@@ -1628,11 +1675,13 @@ authz_read(authz_full_t **authz_p,
 /*** Public functions. ***/
 
 svn_error_t *
-svn_repos_authz_read3(svn_authz_t **authz_p,
+svn_repos_authz_read4(svn_authz_t **authz_p,
                       const char *path,
                       const char *groups_path,
                       svn_boolean_t must_exist,
                       svn_repos_t *repos_hint,
+                      svn_repos_authz_warning_func_t warning_func,
+                      void *warning_baton,
                       apr_pool_t *result_pool,
                       apr_pool_t *scratch_pool)
 {
@@ -1640,7 +1689,8 @@ svn_repos_authz_read3(svn_authz_t **auth
   authz->pool = result_pool;
 
   SVN_ERR(authz_read(&authz->full, &authz->authz_id, path, groups_path,
-                     must_exist, repos_hint, result_pool, scratch_pool));
+                     must_exist, repos_hint, warning_func, warning_baton,
+                     result_pool, scratch_pool));
 
   *authz_p = authz;
   return SVN_NO_ERROR;
@@ -1648,18 +1698,21 @@ svn_repos_authz_read3(svn_authz_t **auth
 
 
 svn_error_t *
-svn_repos_authz_parse(svn_authz_t **authz_p, svn_stream_t *stream,
-                      svn_stream_t *groups_stream, apr_pool_t *pool)
+svn_repos_authz_parse2(svn_authz_t **authz_p,
+                       svn_stream_t *stream,
+                       svn_stream_t *groups_stream,
+                       svn_repos_authz_warning_func_t warning_func,
+                       void *warning_baton,
+                       apr_pool_t *result_pool,
+                       apr_pool_t *scratch_pool)
 {
-  apr_pool_t *scratch_pool = svn_pool_create(pool);
-  svn_authz_t *authz = apr_pcalloc(pool, sizeof(*authz));
-  authz->pool = pool;
+  svn_authz_t *authz = apr_pcalloc(result_pool, sizeof(*authz));
+  authz->pool = result_pool;
 
   /* Parse the configuration and construct the full authz model from it. */
-  SVN_ERR(svn_authz__parse(&authz->full, stream, groups_stream, pool,
-                           scratch_pool));
-
-  svn_pool_destroy(scratch_pool);
+  SVN_ERR(svn_authz__parse(&authz->full, stream, groups_stream,
+                           warning_func, warning_baton,
+                           result_pool, scratch_pool));
 
   *authz_p = authz;
   return SVN_NO_ERROR;

Modified: subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.h
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.h?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.h (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_repos/authz.h Fri Jan 14 14:01:45 2022
@@ -139,6 +139,10 @@ typedef struct authz_full_t
   svn_boolean_t has_authn_rights;
   authz_global_rights_t authn_rights;
 
+  /* Globally accumulated rights from inverted selectors. */
+  svn_boolean_t has_neg_rights;
+  authz_global_rights_t neg_rights;
+
   /* Globally accumulated rights, for all concrete users mentioned
      in the authz file. The key is the user name, the value is
      an authz_global_rights_t*. */
@@ -257,14 +261,19 @@ typedef struct authz_acl_t
   /* The parsed rule. */
   authz_rule_t rule;
 
-  /* Access rights for anonymous users */
+
+  /* Access rights for anonymous users. */
   svn_boolean_t has_anon_access;
   authz_access_t anon_access;
 
-  /* Access rights for authenticated users */
+  /* Access rights for authenticated users. */
   svn_boolean_t has_authn_access;
   authz_access_t authn_access;
 
+  /* Access rights from inverted selectors. */
+  svn_boolean_t has_neg_access;
+  authz_access_t neg_access;
+
   /* All other user- or group-specific access rights.
      Aliases are replaced with their definitions, rules for the same
      user or group are merged. */
@@ -303,6 +312,8 @@ svn_error_t *
 svn_authz__parse(authz_full_t **authz,
                  svn_stream_t *rules,
                  svn_stream_t *groups,
+                 svn_repos_authz_warning_func_t warning_func,
+                 void *warning_baton,
                  apr_pool_t *result_pool,
                  apr_pool_t *scratch_pool);
 

Modified: subversion/branches/multi-wc-format/subversion/libsvn_repos/authz_info.c
URL: http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_repos/authz_info.c?rev=1897034&r1=1897033&r2=1897034&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_repos/authz_info.c (original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_repos/authz_info.c Fri Jan 14 14:01:45 2022
@@ -148,37 +148,50 @@ svn_authz__get_global_rights(authz_right
     {
       /* Check if we have explicit rights for anonymous access. */
       if (authz->has_anon_rights)
-        return resolve_global_rights(rights_p, &authz->anon_rights, repos);
+        {
+          return resolve_global_rights(rights_p, &authz->anon_rights, repos);
+        }
+      else
+        {
+          /* Return the implicit rights, i.e., none. */
+          rights_p->min_access = authz_access_none;
+          rights_p->max_access = authz_access_none;
+          return FALSE;
+        }
     }
   else
     {
+      svn_boolean_t combine_user_rights = FALSE;
+      svn_boolean_t access = FALSE;
+
       /* Check if we have explicit rights for this user. */
       const authz_global_rights_t *const user_rights =
         svn_hash_gets(authz->user_rights, user);
 
       if (user_rights)
         {
-          svn_boolean_t explicit
-            = resolve_global_rights(rights_p, user_rights, repos);
-
-          /* Rights given to _any_ authenticated user may apply, too. */
-          if (authz->has_authn_rights)
-            {
-              authz_rights_t authn;
-              explicit |= resolve_global_rights(&authn, &authz->authn_rights,
-                                                repos);
-              combine_rights(rights_p, rights_p, &authn);
-            }
-          return explicit;
+          access = resolve_global_rights(rights_p, user_rights, repos);
+          combine_user_rights = TRUE;
+        }
+      else if (authz->has_neg_rights)
+        {
+          /* Check if inverted-rule rights apply */
+          access = resolve_global_rights(rights_p, &authz->neg_rights, repos);
+          combine_user_rights = TRUE;
         }
 
-      /* Check if we have explicit rights for authenticated access. */
+      /* Rights given to _any_ authenticated user may apply, too. */
       if (authz->has_authn_rights)
-        return resolve_global_rights(rights_p, &authz->authn_rights, repos);
-    }
+        {
+          authz_rights_t authn;
+          access |= resolve_global_rights(&authn, &authz->authn_rights, repos);
 
-  /* Fall-through: return the implicit rights, i.e., none. */
-  rights_p->min_access = authz_access_none;
-  rights_p->max_access = authz_access_none;
-  return FALSE;
+          if (combine_user_rights)
+            combine_rights(rights_p, rights_p, &authn);
+          else
+            *rights_p = authn;
+        }
+
+      return access;
+    }
 }