Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3133996AE for ; Thu, 12 Apr 2012 22:49:15 +0000 (UTC) Received: (qmail 39156 invoked by uid 500); 12 Apr 2012 22:49:15 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 39054 invoked by uid 500); 12 Apr 2012 22:49:15 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 38937 invoked by uid 99); 12 Apr 2012 22:49:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Apr 2012 22:49:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Apr 2012 22:49:02 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8C4C42388A38; Thu, 12 Apr 2012 22:48:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1325565 [2/3] - in /subversion/branches/ev2-export: ./ contrib/client-side/emacs/ contrib/client-side/vim/ notes/ subversion/bindings/swig/ruby/test/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libs... Date: Thu, 12 Apr 2012 22:48:35 -0000 To: commits@subversion.apache.org From: hwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120412224839.8C4C42388A38@eris.apache.org> Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/fs_fs.c Thu Apr 12 22:48:32 2012 @@ -71,7 +71,7 @@ /* The default maximum number of files per directory to store in the rev and revprops directory. The number below is somewhat arbitrary, - and can be overriden by defining the macro while compiling; the + and can be overridden by defining the macro while compiling; the figure of 1000 is reasonable for VFAT filesystems, which are by far the worst performers in this area. */ #ifndef SVN_FS_FS_DEFAULT_MAX_FILES_PER_DIR @@ -80,7 +80,7 @@ /* Begin deltification after a node history exceeded this this limit. Useful values are 4 to 64 with 16 being a good compromise between - computational overhead and pository size savings. + computational overhead and repository size savings. Should be a power of 2. Values < 2 will result in standard skip-delta behavior. */ #define SVN_FS_FS_MAX_LINEAR_DELTIFICATION 16 @@ -432,7 +432,7 @@ path_and_offset_of(apr_file_t *file, apr } - + /* Functions for working with shared transaction data. */ /* Return the transaction object for transaction TXN_ID from the @@ -1082,6 +1082,34 @@ read_config(svn_fs_t *fs, else ffd->rep_sharing_allowed = FALSE; + /* Initialize ffd->deltify_directories. */ + if (ffd->format >= SVN_FS_FS__MIN_DELTIFICATION_FORMAT) + { + SVN_ERR(svn_config_get_bool(ffd->config, &ffd->deltify_directories, + CONFIG_SECTION_DELTIFICATION, + CONFIG_OPTION_ENABLE_DIR_DELTIFICATION, + FALSE)); + SVN_ERR(svn_config_get_bool(ffd->config, &ffd->deltify_properties, + CONFIG_SECTION_DELTIFICATION, + CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION, + FALSE)); + SVN_ERR(svn_config_get_int64(ffd->config, &ffd->max_deltification_walk, + CONFIG_SECTION_DELTIFICATION, + CONFIG_OPTION_MAX_DELTIFICATION_WALK, + SVN_FS_FS_MAX_DELTIFICATION_WALK)); + SVN_ERR(svn_config_get_int64(ffd->config, &ffd->max_linear_deltification, + CONFIG_SECTION_DELTIFICATION, + CONFIG_OPTION_MAX_LINEAR_DELTIFICATION, + SVN_FS_FS_MAX_LINEAR_DELTIFICATION)); + } + else + { + ffd->deltify_directories = FALSE; + ffd->deltify_properties = FALSE; + ffd->max_deltification_walk = SVN_FS_FS_MAX_DELTIFICATION_WALK; + ffd->max_linear_deltification = SVN_FS_FS_MAX_LINEAR_DELTIFICATION; + } + return SVN_NO_ERROR; } @@ -1130,7 +1158,67 @@ write_config(svn_fs_t *fs, "### 'svnadmin verify' will check the rep-cache regardless of this setting." NL "### rep-sharing is enabled by default." NL "# " CONFIG_OPTION_ENABLE_REP_SHARING " = true" NL - +"" NL +"[" CONFIG_SECTION_DELTIFICATION "]" NL +"### To conserve space, the filesystem stores data as differences against" NL +"### existing representations. This comes at a slight cost in performance," NL +"### as calculating differences can increase commit times. Reading data" NL +"### will also create higher CPU load and the data will be fragmented." NL +"### Since deltification tends to save significant amounts of disk space," NL +"### the overall I/O load can actually be lower." NL +"###" NL +"### The options in this section allow for tuning the deltification" NL +"### strategy. Their effects on data size and server performance may vary" NL +"### from one repository to another. Versions prior to 1.8 will ignore" NL +"### this section." NL +"###" NL +"### The following parameter enables deltification for directories. It can" NL +"### be switched on and off at will, but for best space-saving results" NL +"### should be enabled consistently over the life of the repository." NL +"### Repositories containing large directories will benefit greatly." NL +"### In rarely read repositories, the I/O overhead may be significant as" NL +"### cache hit rates will most likely be low" NL +"### directory deltification is disabled by default." NL +"# " CONFIG_OPTION_ENABLE_DIR_DELTIFICATION " = true" NL +"###" NL +"### The following parameter enables deltification for properties on files" NL +"### and directories. Overall, this is a minor tuning option but can save" NL +"### some disk space if frequently merge or if you frequently change node" NL +"### properties. You should not activate this if rep-sharing has been" NL +"### disabled." NL +"### property deltification is disabled by default." NL +"# " CONFIG_OPTION_ENABLE_PROPS_DELTIFICATION " = true" NL +"###" NL +"### During commit, the server may need to walk the whole change history of" NL +"### of a given node to find a suitable deltification base. This linear" NL +"### process can impact commit times, svnadmin load and similar operations." NL +"### This setting limits the depth of the deltification history. If the" NL +"### threshold has been reached, the node will be stored as fulltext and a" NL +"### new deltification history begins." NL +"### Note, this is unrelated to svn log." NL +"### Very large values rarely provide significant additional savings but" NL +"### can impact performance greatly - in particular if directory" NL +"### deltification has been activated. Very small values may be useful in" NL +"### repositories that are dominated by large, changing binaries." NL +"### Should be a power of two minus 1. A value of 0 will effectively" NL +"### disable deltification." NL +"### For 1.8, the default value is 1023; earlier versions have no limit." NL +"# " CONFIG_OPTION_MAX_DELTIFICATION_WALK " = 1023" NL +"###" NL +"### The skip-delta scheme used by FSFS tends to repeatably store redundant" NL +"### delta information where a simple delta against the latest version is" NL +"### often smaller. By default, 1.8+ will therefore use skip deltas only" NL +"### after the linear chain of deltas has grown beyond the threshold" NL +"### specified by this setting." NL +"### Values up to 64 can result in some reduction in repository size for" NL +"### the cost of quickly increasing I/O and CPU costs. Similarly, smaller" NL +"### numbers can reduce those costs at the cost of more disk space. For" NL +"### rarely read repositories or those containing larger binaries, this may" NL +"### present a better trade-off." NL +"### Should be a power of two. A value of 1 or smaller will cause the" NL +"### exclusive use of skip-deltas (as in pre-1.8)." NL +"### For 1.8, the default value is 16; earlier versions use 1." NL +"# " CONFIG_OPTION_MAX_LINEAR_DELTIFICATION " = 16" NL ; #undef NL return svn_io_file_create(svn_dirent_join(fs->path, PATH_CONFIG, pool), @@ -3536,8 +3624,9 @@ read_representation(svn_stream_t **conte { svn_stringbuf_t *fulltext; svn_boolean_t is_cached; - fulltext_cache_key = apr_psprintf(pool, "%ld/%" APR_OFF_T_FMT, - rep->revision, rep->offset); + fulltext_cache_key = svn_fs_fs__combine_two_numbers(rep->revision, + rep->offset, + pool); SVN_ERR(svn_cache__get((void **) &fulltext, &is_cached, ffd->fulltext_cache, fulltext_cache_key, pool)); @@ -5265,6 +5354,7 @@ choose_delta_base(representation_t **rep int count; int walk; node_revision_t *base; + fs_fs_data_t *ffd = fs->fsap_data; /* If we have no predecessors, then use the empty stream as a base. */ @@ -5285,14 +5375,14 @@ choose_delta_base(representation_t **rep along very long node histories. Close to HEAD however, we create a linear history to minimize delta size. */ walk = noderev->predecessor_count - count; - if (walk < SVN_FS_FS_MAX_LINEAR_DELTIFICATION) + if (walk < (int)ffd->max_linear_deltification) count = noderev->predecessor_count - 1; /* Finding the delta base over a very long distance can become extremely expensive for very deep histories, possibly causing client timeouts etc. OTOH, this is a rare operation and its gains are minimal. Lets simply start deltification anew close every other 1000 changes or so. */ - if (walk > SVN_FS_FS_MAX_DELTIFICATION_WALK) + if (walk > (int)ffd->max_deltification_walk) { *rep = NULL; return SVN_NO_ERROR; @@ -5772,7 +5862,6 @@ write_hash_rep(representation_t *rep, earlier reps with the same content. When such existing reps can be found, we will truncate the one just written from the file and return the existing rep. Perform temporary allocations in POOL. */ -#ifdef SVN_FS_FS_DELTIFY_DIRECTORIES static svn_error_t * write_hash_delta_rep(representation_t *rep, apr_file_t *file, @@ -5873,7 +5962,6 @@ write_hash_delta_rep(representation_t *r return SVN_NO_ERROR; } -#endif /* Sanity check ROOT_NODEREV, a candidate for being the root node-revision of (not yet committed) revision REV in FS. Use POOL for temporary @@ -6026,14 +6114,13 @@ write_final_rev(const svn_fs_id_t **new_ noderev->data_rep->txn_id = NULL; noderev->data_rep->revision = rev; -#ifdef SVN_FS_FS_DELTIFY_DIRECTORIES - SVN_ERR(write_hash_delta_rep(noderev->data_rep, file, - str_entries, fs, noderev, NULL, - pool)); -#else - SVN_ERR(write_hash_rep(noderev->data_rep, file, str_entries, - fs, NULL, pool)); -#endif + if (ffd->deltify_directories) + SVN_ERR(write_hash_delta_rep(noderev->data_rep, file, + str_entries, fs, noderev, NULL, + pool)); + else + SVN_ERR(write_hash_rep(noderev->data_rep, file, str_entries, + fs, NULL, pool)); } } else @@ -6066,14 +6153,13 @@ write_final_rev(const svn_fs_id_t **new_ noderev->prop_rep->txn_id = NULL; noderev->prop_rep->revision = rev; -#ifdef SVN_FS_FS_DELTIFY_PROPS - SVN_ERR(write_hash_delta_rep(noderev->prop_rep, file, - proplist, fs, noderev, reps_hash, - pool)); -#else - SVN_ERR(write_hash_rep(noderev->prop_rep, file, proplist, - fs, reps_hash, pool)); -#endif + if (ffd->deltify_properties) + SVN_ERR(write_hash_delta_rep(noderev->prop_rep, file, + proplist, fs, noderev, reps_hash, + pool)); + else + SVN_ERR(write_hash_rep(noderev->prop_rep, file, proplist, + fs, reps_hash, pool)); } @@ -7960,7 +8046,7 @@ svn_fs_fs__verify(svn_fs_t *fs, svn_pool_clear(iterpool); /* ### TODO: Make sure caches are disabled. - + When this code is called in the library, we want to ensure we use the on-disk data --- rather than some data that was read in the possibly-distance past and cached since. */ Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/temp_serializer.c Thu Apr 12 22:48:32 2012 @@ -184,7 +184,7 @@ serialize_checksum(svn_temp_serializer__ /* Utility function to deserialize the checksum CS inside the BUFFER. */ static void -deserialize_checksum(void *buffer, svn_checksum_t * const *cs) +deserialize_checksum(void *buffer, svn_checksum_t **cs) { svn_temp_deserializer__resolve(buffer, (void **)cs); if (*cs == NULL) @@ -852,7 +852,7 @@ svn_fs_fs__get_sharded_offset(void **out void *baton, apr_pool_t *pool) { - apr_off_t *manifest = (apr_off_t *)data; + const apr_off_t *manifest = data; apr_int64_t shard_pos = *(apr_int64_t *)baton; *(apr_off_t *)out = manifest[shard_pos]; @@ -879,9 +879,9 @@ find_entry(svn_fs_dirent_t **entries, for (middle = upper / 2; lower < upper; middle = (upper + lower) / 2) { const svn_fs_dirent_t *entry = - svn_temp_deserializer__ptr(entries, (const void **)&entries[middle]); + svn_temp_deserializer__ptr(entries, (const void *const *)&entries[middle]); const char* entry_name = - svn_temp_deserializer__ptr(entry, (const void **)&entry->name); + svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name); int diff = strcmp(entry_name, name); if (diff < 0) @@ -895,9 +895,9 @@ find_entry(svn_fs_dirent_t **entries, if (lower < count) { const svn_fs_dirent_t *entry = - svn_temp_deserializer__ptr(entries, (const void **)&entries[lower]); + svn_temp_deserializer__ptr(entries, (const void *const *)&entries[lower]); const char* entry_name = - svn_temp_deserializer__ptr(entry, (const void **)&entry->name); + svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name); if (strcmp(entry_name, name) == 0) *found = TRUE; @@ -913,17 +913,17 @@ svn_fs_fs__extract_dir_entry(void **out, void *baton, apr_pool_t *pool) { - hash_data_t *hash_data = (hash_data_t *)data; + const hash_data_t *hash_data = data; const char* name = baton; svn_boolean_t found; /* resolve the reference to the entries array */ const svn_fs_dirent_t * const *entries = - svn_temp_deserializer__ptr(data, (const void **)&hash_data->entries); + svn_temp_deserializer__ptr(data, (const void *const *)&hash_data->entries); /* resolve the reference to the lengths array */ const apr_uint32_t *lengths = - svn_temp_deserializer__ptr(data, (const void **)&hash_data->lengths); + svn_temp_deserializer__ptr(data, (const void *const *)&hash_data->lengths); /* binary search for the desired entry by name */ apr_size_t pos = find_entry((svn_fs_dirent_t **)entries, @@ -936,7 +936,7 @@ svn_fs_fs__extract_dir_entry(void **out, if (found) { const svn_fs_dirent_t *source = - svn_temp_deserializer__ptr(entries, (const void **)&entries[pos]); + svn_temp_deserializer__ptr(entries, (const void *const *)&entries[pos]); /* Entries have been serialized one-by-one, each time including all * nestes structures and strings. Therefore, they occupy a single @@ -1007,12 +1007,12 @@ svn_fs_fs__replace_dir_entry(void **data /* resolve the reference to the entries array */ entries = (svn_fs_dirent_t **) svn_temp_deserializer__ptr((const char *)hash_data, - (const void **)&hash_data->entries); + (const void *const *)&hash_data->entries); /* resolve the reference to the lengths array */ lengths = (apr_uint32_t *) svn_temp_deserializer__ptr((const char *)hash_data, - (const void **)&hash_data->lengths); + (const void *const *)&hash_data->lengths); /* binary search for the desired entry by name */ pos = find_entry(entries, replace_baton->name, hash_data->count, &found); @@ -1081,7 +1081,7 @@ svn_fs_fs__replace_dir_entry(void **data hash_data = (hash_data_t *)*data; lengths = (apr_uint32_t *) svn_temp_deserializer__ptr((const char *)hash_data, - (const void **)&hash_data->lengths); + (const void *const *)&hash_data->lengths); lengths[pos] = length; return SVN_NO_ERROR; Modified: subversion/branches/ev2-export/subversion/libsvn_fs_fs/tree.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_fs_fs/tree.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_fs_fs/tree.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_fs_fs/tree.c Thu Apr 12 22:48:32 2012 @@ -57,6 +57,7 @@ #include "tree.h" #include "fs_fs.h" #include "id.h" +#include "temp_serializer.h" #include "private/svn_mergeinfo_private.h" #include "private/svn_fs_util.h" @@ -154,8 +155,8 @@ locate_cache(svn_cache__t **cache, { fs_fs_data_t *ffd = root->fs->fsap_data; if (cache) *cache = ffd->rev_node_cache; - if (key && path) *key = apr_psprintf(pool, "%ld%s", - root->rev, path); + if (key && path) *key + = svn_fs_fs__combine_number_and_string(root->rev, path, pool); } } Modified: subversion/branches/ev2-export/subversion/libsvn_ra/compat.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra/compat.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra/compat.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra/compat.c Thu Apr 12 22:48:32 2012 @@ -141,7 +141,7 @@ prev_log_path(const char **prev_path_p, svn_sort__item_t item = APR_ARRAY_IDX(paths, i - 1, svn_sort__item_t); const char *ch_path = item.key; - int len = strlen(ch_path); + size_t len = strlen(ch_path); /* See if our path is the child of this change path. If not, keep looking. */ Modified: subversion/branches/ev2-export/subversion/libsvn_ra_neon/commit.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_neon/commit.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_neon/commit.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_neon/commit.c Thu Apr 12 22:48:32 2012 @@ -1620,7 +1620,8 @@ svn_error_t * svn_ra_neon__get_commit_ed *edit_baton = cc; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - ras->shim_callbacks, pool, pool)); + NULL, NULL, ras->shim_callbacks, + pool, pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/commit.c Thu Apr 12 22:48:32 2012 @@ -2322,6 +2322,7 @@ svn_ra_serf__get_commit_editor(svn_ra_se svn_delta_editor_t *editor; commit_context_t *ctx; apr_hash_index_t *hi; + const char *repos_root; ctx = apr_pcalloc(pool, sizeof(*ctx)); @@ -2368,9 +2369,11 @@ svn_ra_serf__get_commit_editor(svn_ra_se *ret_editor = editor; *edit_baton = ctx; + SVN_ERR(svn_ra_serf__get_repos_root(ra_session, &repos_root, pool)); + SVN_ERR(svn_editor__insert_shims(ret_editor, edit_baton, *ret_editor, - *edit_baton, session->shim_callbacks, - pool, pool)); + *edit_baton, repos_root, NULL, + session->shim_callbacks, pool, pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/ra_serf.h Thu Apr 12 22:48:32 2012 @@ -1425,6 +1425,12 @@ svn_ra_serf__create_sb_bucket(svn_spillb apr_pool_t *scratch_pool); +svn_error_t * +svn_ra_serf__get_repos_root(svn_ra_session_t *ra_session, + const char **url, + apr_pool_t *pool); + + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: subversion/branches/ev2-export/subversion/libsvn_ra_serf/serf.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_serf/serf.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_serf/serf.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_serf/serf.c Thu Apr 12 22:48:32 2012 @@ -1063,7 +1063,7 @@ svn_ra_serf__get_dir(svn_ra_session_t *r return SVN_NO_ERROR; } -static svn_error_t * +svn_error_t * svn_ra_serf__get_repos_root(svn_ra_session_t *ra_session, const char **url, apr_pool_t *pool) Modified: subversion/branches/ev2-export/subversion/libsvn_ra_svn/cyrus_auth.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_svn/cyrus_auth.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_svn/cyrus_auth.c Thu Apr 12 22:48:32 2012 @@ -533,7 +533,7 @@ static svn_error_t *try_auth(svn_ra_svn_ clear_sasl_errno(); result = sasl_client_step(sasl_ctx, in->data, - in->len, + (const unsigned int) in->len, &client_interact, &out, /* Filled in by SASL. */ &outlen); @@ -620,7 +620,7 @@ static svn_error_t *sasl_read_cb(void *b return SVN_NO_ERROR; } clear_sasl_errno(); - result = sasl_decode(sasl_baton->ctx, buffer, len2, + result = sasl_decode(sasl_baton->ctx, buffer, (unsigned int) len2, &sasl_baton->read_buf, &sasl_baton->read_len); if (result != SASL_OK) @@ -662,7 +662,7 @@ sasl_write_cb(void *baton, const char *b /* Make sure we don't write too much. */ *len = (*len > sasl_baton->maxsize) ? sasl_baton->maxsize : *len; clear_sasl_errno(); - result = sasl_encode(sasl_baton->ctx, buffer, *len, + result = sasl_encode(sasl_baton->ctx, buffer, (unsigned int) *len, &sasl_baton->write_buf, &sasl_baton->write_len); @@ -755,9 +755,8 @@ svn_error_t *svn_ra_svn__enable_sasl_enc { clear_sasl_errno(); result = sasl_decode(sasl_ctx, conn->read_ptr, - conn->read_end - conn->read_ptr, - &sasl_baton->read_buf, - &sasl_baton->read_len); + (unsigned int) (conn->read_end - conn->read_ptr), + &sasl_baton->read_buf, &sasl_baton->read_len); if (result != SASL_OK) return svn_error_create(SVN_ERR_RA_NOT_AUTHORIZED, NULL, get_sasl_error(sasl_ctx, result, pool)); Modified: subversion/branches/ev2-export/subversion/libsvn_ra_svn/editorp.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_ra_svn/editorp.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_ra_svn/editorp.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_ra_svn/editorp.c Thu Apr 12 22:48:32 2012 @@ -437,7 +437,8 @@ void svn_ra_svn_get_editor(const svn_del *edit_baton = eb; svn_error_clear(svn_editor__insert_shims(editor, edit_baton, *editor, - *edit_baton, conn->shim_callbacks, + *edit_baton, NULL, NULL, + conn->shim_callbacks, pool, pool)); } Modified: subversion/branches/ev2-export/subversion/libsvn_repos/commit.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_repos/commit.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_repos/commit.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_repos/commit.c Thu Apr 12 22:48:32 2012 @@ -783,33 +783,6 @@ abort_edit(void *edit_baton, static svn_error_t * -rationalize_shim_path(const char **fs_path, - struct edit_baton *eb, - const char *path, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool) -{ - if (svn_path_is_url(path)) - { - /* This is a copyfrom URL. */ - path = svn_uri_skip_ancestor(eb->repos_url, path, scratch_pool); - *fs_path = svn_fspath__canonicalize(path, scratch_pool); - } - else - { - /* This is a base-relative path. */ - if (path[0] != '/') - /* Get an absolute path for use in the FS. */ - *fs_path = svn_fspath__join(eb->base_path, path, scratch_pool); - else - *fs_path = path; - } - - return SVN_NO_ERROR; -} - - -static svn_error_t * fetch_props_func(apr_hash_t **props, void *baton, const char *path, @@ -821,7 +794,6 @@ fetch_props_func(apr_hash_t **props, svn_fs_root_t *fs_root; svn_error_t *err; - SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool)); SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, svn_fs_txn_base_revision(eb->txn), scratch_pool)); @@ -852,7 +824,6 @@ fetch_kind_func(svn_kind_t *kind, if (!SVN_IS_VALID_REVNUM(base_revision)) base_revision = svn_fs_txn_base_revision(eb->txn); - SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool)); SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool)); SVN_ERR(svn_fs_check_path(&node_kind, fs_root, path, scratch_pool)); @@ -879,7 +850,6 @@ fetch_base_func(const char **filename, if (!SVN_IS_VALID_REVNUM(base_revision)) base_revision = svn_fs_txn_base_revision(eb->txn); - SVN_ERR(rationalize_shim_path(&path, eb, path, scratch_pool, scratch_pool)); SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, base_revision, scratch_pool)); err = svn_fs_file_contents(&contents, fs_root, path, scratch_pool); @@ -981,6 +951,7 @@ svn_repos_get_commit_editor5(const svn_d shim_callbacks->fetch_baton = eb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, + eb->repos_url, eb->base_path, shim_callbacks, pool, pool)); return SVN_NO_ERROR; Modified: subversion/branches/ev2-export/subversion/libsvn_repos/dump.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_repos/dump.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_repos/dump.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_repos/dump.c Thu Apr 12 22:48:32 2012 @@ -1009,7 +1009,7 @@ get_dump_editor(const svn_delta_editor_t shim_callbacks->fetch_baton = eb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - shim_callbacks, pool, pool)); + NULL, NULL, shim_callbacks, pool, pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_subr/config.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/config.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/config.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/config.c Thu Apr 12 22:48:32 2012 @@ -34,6 +34,7 @@ #include "config_impl.h" #include "svn_private_config.h" +#include "private/svn_dep_compat.h" @@ -561,6 +562,7 @@ svn_config_get(svn_config_t *cfg, const const char *section, const char *option, const char *default_value) { + *valuep = default_value; if (cfg) { cfg_section_t *sec; @@ -570,23 +572,21 @@ svn_config_get(svn_config_t *cfg, const make_string_from_option(valuep, cfg, sec, opt, NULL); } else - { - apr_pool_t *tmp_pool = svn_pool_create(cfg->x_pool); - const char *x_default; - expand_option_value(cfg, sec, default_value, &x_default, tmp_pool); - if (x_default) - { - svn_stringbuf_set(cfg->tmp_value, x_default); - *valuep = cfg->tmp_value->data; - } - else - *valuep = default_value; - svn_pool_destroy(tmp_pool); - } - } - else - { - *valuep = default_value; + /* before attempting to expand an option, check for the placeholder. + * If none is there, there is no point in calling expand_option_value. + */ + if (default_value && strchr(default_value, '%')) + { + apr_pool_t *tmp_pool = svn_pool_create(cfg->x_pool); + const char *x_default; + expand_option_value(cfg, sec, default_value, &x_default, tmp_pool); + if (x_default) + { + svn_stringbuf_set(cfg->tmp_value, x_default); + *valuep = cfg->tmp_value->data; + } + svn_pool_destroy(tmp_pool); + } } } @@ -697,6 +697,33 @@ svn_config_set_bool(svn_config_t *cfg, } svn_error_t * +svn_config_get_int64(svn_config_t *cfg, + apr_int64_t *valuep, + const char *section, + const char *option, + apr_int64_t default_value) +{ + const char *tmp_value; + svn_config_get(cfg, &tmp_value, section, option, NULL); + if (tmp_value) + return svn_cstring_strtoi64(valuep, tmp_value, + APR_INT64_MIN, APR_INT64_MAX, 10); + + *valuep = default_value; + return SVN_NO_ERROR; +} + +void +svn_config_set_int64(svn_config_t *cfg, + const char *section, + const char *option, + apr_int64_t value) +{ + svn_config_set(cfg, section, option, + apr_psprintf(cfg->pool, "%" APR_INT64_T_FMT, value)); +} + +svn_error_t * svn_config_get_yes_no_ask(svn_config_t *cfg, const char **valuep, const char *section, const char *option, const char* default_value) Modified: subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/crypto.c Thu Apr 12 22:48:32 2012 @@ -23,11 +23,13 @@ #include "crypto.h" -#if APU_HAVE_CRYPTO +#ifdef SVN_HAVE_CRYPTO #include #include +#endif /* SVN_HAVE_CRYPTO */ #include "svn_types.h" +#include "svn_checksum.h" #include "svn_private_config.h" #include "private/svn_atomic.h" @@ -44,6 +46,7 @@ /* A structure for containing Subversion's cryptography-related bits (so we can avoid passing around APR-isms outside this module). */ struct svn_crypto__ctx_t { +#ifdef SVN_HAVE_CRYPTO apr_crypto_t *crypto; /* APR cryptography context. */ #if 0 @@ -53,12 +56,16 @@ struct svn_crypto__ctx_t { ### apr_generate_random_bytes() to generate entropy for seeding ### apr_random_t. See httpd/server/core.c:ap_init_rng() */ apr_random_t *rand; -#endif +#endif /* 0 */ +#else /* SVN_HAVE_CRYPTO */ + int unused_but_required_to_satisfy_c_compilers; +#endif /* SVN_HAVE_CRYPTO */ }; -/*** Initialization ***/ +/*** Helper Functions ***/ +#ifdef SVN_HAVE_CRYPTO /* One-time initialization of the cryptography subsystem. */ @@ -90,10 +97,6 @@ crypto_init(void *baton, apr_pool_t *any } - -/*** Helper Functions ***/ - - /* If APU_ERR is non-NULL, create and return a Subversion error using APR_ERR and APU_ERR. */ static svn_error_t * @@ -142,7 +145,6 @@ get_random_bytes(const unsigned char **r apr_size_t rand_len, apr_pool_t *result_pool) { -#if APR_HAS_RANDOM apr_status_t apr_err; unsigned char *bytes; @@ -153,10 +155,42 @@ get_random_bytes(const unsigned char **r *rand_bytes = bytes; return SVN_NO_ERROR; -#else - return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, - _("No support for random data generation found")); -#endif +} + + +/* Return an svn_string_t allocated from RESULT_POOL, with its .data + and .len members set to DATA and LEN, respective. + + WARNING: No lifetime management of DATA is offered here, so you + probably want to ensure that that information is allocated in a + sufficiently long-lived pool (such as, for example, RESULT_POOL). */ +static const svn_string_t * +wrap_as_string(const unsigned char *data, + apr_size_t len, + apr_pool_t *result_pool) +{ + svn_string_t *s = apr_palloc(result_pool, sizeof(*s)); + + s->data = (const char *)data; /* better already be in RESULT_POOL */ + s->len = len; + return s; +} + + +#endif /* SVN_HAVE_CRYPTO */ + + + +/*** Semi-public APIs ***/ + +/* Return TRUE iff Subversion's cryptographic support is available. */ +svn_boolean_t svn_crypto__is_available(void) +{ +#ifdef SVN_HAVE_CRYPTO + return TRUE; +#else /* SVN_HAVE_CRYPTO */ + return FALSE; +#endif /* SVN_HAVE_CRYPTO */ } @@ -166,6 +200,7 @@ svn_error_t * svn_crypto__context_create(svn_crypto__ctx_t **ctx, apr_pool_t *result_pool) { +#ifdef SVN_HAVE_CRYPTO apr_status_t apr_err; const apu_err_t *apu_err = NULL; apr_crypto_t *apr_crypto; @@ -203,25 +238,10 @@ svn_crypto__context_create(svn_crypto__c (*ctx)->crypto = apr_crypto; return SVN_NO_ERROR; -} - - -/* Return an svn_string_t allocated from RESULT_POOL, with its .data - and .len members set to DATA and LEN, respective. - - WARNING: No lifetime management of DATA is offered here, so you - probably want to ensure that that information is allocated in a - sufficiently long-lived pool (such as, for example, RESULT_POOL). */ -static const svn_string_t * -wrap_as_string(const unsigned char *data, - apr_size_t len, - apr_pool_t *result_pool) -{ - svn_string_t *s = apr_palloc(result_pool, sizeof(*s)); - - s->data = (const char *)data; /* better already be in RESULT_POOL */ - s->len = len; - return s; +#else /* SVN_HAVE_CRYPTO */ + return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, + "Cryptographic support is not available"); +#endif /* SVN_HAVE_CRYPTO */ } @@ -235,6 +255,7 @@ svn_crypto__encrypt_password(const svn_s apr_pool_t *result_pool, apr_pool_t *scratch_pool) { +#ifdef SVN_HAVE_CRYPTO svn_error_t *err = SVN_NO_ERROR; const unsigned char *salt_vector; const unsigned char *iv_vector; @@ -359,6 +380,10 @@ svn_crypto__encrypt_password(const svn_s cleanup: apr_crypto_block_cleanup(block_ctx); return err; +#else /* SVN_HAVE_CRYPTO */ + return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, + "Cryptographic support is not available"); +#endif /* SVN_HAVE_CRYPTO */ } @@ -372,6 +397,7 @@ svn_crypto__decrypt_password(const char apr_pool_t *result_pool, apr_pool_t *scratch_pool) { +#ifdef SVN_HAVE_CRYPTO svn_error_t *err = SVN_NO_ERROR; apr_status_t apr_err; apr_crypto_block_t *block_ctx = NULL; @@ -448,6 +474,232 @@ svn_crypto__decrypt_password(const char cleanup: apr_crypto_block_cleanup(block_ctx); return err; +#else /* SVN_HAVE_CRYPTO */ + return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, + "Cryptographic support is not available"); +#endif /* SVN_HAVE_CRYPTO */ } -#endif /* APU_HAVE_CRYPTO */ + +svn_error_t * +svn_crypto__generate_secret_checktext(const svn_string_t **ciphertext, + const svn_string_t **iv, + const svn_string_t **salt, + const char **checktext, + svn_crypto__ctx_t *ctx, + const svn_string_t *master, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) +{ +#ifdef SVN_HAVE_CRYPTO + svn_error_t *err = SVN_NO_ERROR; + const unsigned char *salt_vector; + const unsigned char *iv_vector; + const unsigned char *stuff_vector; + apr_size_t iv_len; + apr_crypto_key_t *key = NULL; + apr_status_t apr_err; + apr_crypto_block_t *block_ctx = NULL; + apr_size_t block_size; + apr_size_t result_len; + unsigned char *result; + apr_size_t ignored_result_len = 0; + apr_size_t stuff_len; + svn_checksum_t *stuff_sum; + + SVN_ERR_ASSERT(ctx != NULL); + + /* Generate the salt. */ + SVN_ERR(get_random_bytes(&salt_vector, ctx, SALT_LEN, result_pool)); + + /* Initialize the passphrase. */ + apr_err = apr_crypto_passphrase(&key, &iv_len, + master->data, master->len, + salt_vector, SALT_LEN, + APR_KEY_AES_256, APR_MODE_CBC, + FALSE /* doPad */, NUM_ITERATIONS, + ctx->crypto, + scratch_pool); + if (apr_err != APR_SUCCESS) + return svn_error_trace(crypto_error_create( + ctx, apr_err, + _("Error creating derived key"))); + if (! key) + return svn_error_create(APR_EGENERAL, NULL, + _("Error creating derived key")); + if (iv_len == 0) + return svn_error_create(APR_EGENERAL, NULL, + _("Unexpected IV length returned")); + + /* Generate the proper length IV. */ + SVN_ERR(get_random_bytes(&iv_vector, ctx, iv_len, result_pool)); + + /* Initialize block encryption. */ + apr_err = apr_crypto_block_encrypt_init(&block_ctx, &iv_vector, key, + &block_size, scratch_pool); + if ((apr_err != APR_SUCCESS) || (! block_ctx)) + return svn_error_trace(crypto_error_create( + ctx, apr_err, + _("Error initializing block encryption"))); + + /* Generate a blob of random data, block-aligned per the + requirements of the encryption algorithm, but with a minimum size + of our choosing. */ +#define MIN_STUFF_LEN 32 + if (MIN_STUFF_LEN % block_size) + stuff_len = MIN_STUFF_LEN + (block_size - (MIN_STUFF_LEN % block_size)); + else + stuff_len = MIN_STUFF_LEN; + SVN_ERR(get_random_bytes(&stuff_vector, ctx, stuff_len, scratch_pool)); + + /* ### FIXME: This should be a SHA-256. */ + SVN_ERR(svn_checksum(&stuff_sum, svn_checksum_sha1, stuff_vector, + stuff_len, scratch_pool)); + + /* Get the length that we need to allocate. */ + apr_err = apr_crypto_block_encrypt(NULL, &result_len, stuff_vector, + stuff_len, block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error fetching result length")); + goto cleanup; + } + + /* Allocate our result buffer. */ + result = apr_palloc(result_pool, result_len); + + /* Encrypt the block. */ + apr_err = apr_crypto_block_encrypt(&result, &result_len, stuff_vector, + stuff_len, block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error during block encryption")); + goto cleanup; + } + + /* Finalize the block encryption. Since we padded everything, this should + not produce any more encrypted output. */ + apr_err = apr_crypto_block_encrypt_finish(NULL, + &ignored_result_len, + block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error finalizing block encryption")); + goto cleanup; + } + + *ciphertext = wrap_as_string(result, result_len, result_pool); + *iv = wrap_as_string(iv_vector, iv_len, result_pool); + *salt = wrap_as_string(salt_vector, SALT_LEN, result_pool); + *checktext = svn_checksum_to_cstring(stuff_sum, result_pool); + + cleanup: + apr_crypto_block_cleanup(block_ctx); + return err; +#else /* SVN_HAVE_CRYPTO */ + return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, + "Cryptographic support is not available"); +#endif /* SVN_HAVE_CRYPTO */ +} + + +svn_error_t * +svn_crypto__verify_secret(svn_boolean_t *is_valid, + svn_crypto__ctx_t *ctx, + const svn_string_t *master, + const svn_string_t *ciphertext, + const svn_string_t *iv, + const svn_string_t *salt, + const char *checktext, + apr_pool_t *scratch_pool) +{ +#ifdef SVN_HAVE_CRYPTO + svn_error_t *err = SVN_NO_ERROR; + apr_status_t apr_err; + apr_crypto_block_t *block_ctx = NULL; + apr_size_t block_size, iv_len; + apr_crypto_key_t *key = NULL; + unsigned char *result; + apr_size_t result_len = 0, final_len = 0; + svn_checksum_t *result_sum; + + *is_valid = FALSE; + + /* Initialize the passphrase. */ + apr_err = apr_crypto_passphrase(&key, &iv_len, + master->data, master->len, + (unsigned char *)salt->data, salt->len, + APR_KEY_AES_256, APR_MODE_CBC, + FALSE /* doPad */, NUM_ITERATIONS, + ctx->crypto, scratch_pool); + if (apr_err != APR_SUCCESS) + return svn_error_trace(crypto_error_create( + ctx, apr_err, + _("Error creating derived key"))); + if (! key) + return svn_error_create(APR_EGENERAL, NULL, + _("Error creating derived key")); + if (iv_len == 0) + return svn_error_create(APR_EGENERAL, NULL, + _("Unexpected IV length returned")); + if (iv_len != iv->len) + return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL, + _("Provided IV has incorrect length")); + + apr_err = apr_crypto_block_decrypt_init(&block_ctx, &block_size, + (unsigned char *)iv->data, + key, scratch_pool); + if ((apr_err != APR_SUCCESS) || (! block_ctx)) + return svn_error_trace(crypto_error_create( + ctx, apr_err, + _("Error initializing block decryption"))); + + apr_err = apr_crypto_block_decrypt(NULL, &result_len, + (unsigned char *)ciphertext->data, + ciphertext->len, block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error fetching result length")); + goto cleanup; + } + + result = apr_palloc(scratch_pool, result_len); + apr_err = apr_crypto_block_decrypt(&result, &result_len, + (unsigned char *)ciphertext->data, + ciphertext->len, block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error during block decryption")); + goto cleanup; + } + + apr_err = apr_crypto_block_decrypt_finish(result + result_len, &final_len, + block_ctx); + if (apr_err != APR_SUCCESS) + { + err = crypto_error_create(ctx, apr_err, + _("Error finalizing block decryption")); + goto cleanup; + } + + /* ### FIXME: This should be a SHA-256. */ + SVN_ERR(svn_checksum(&result_sum, svn_checksum_sha1, result, + result_len + final_len, scratch_pool)); + + *is_valid = strcmp(checktext, + svn_checksum_to_cstring(result_sum, scratch_pool)) == 0; + + cleanup: + apr_crypto_block_cleanup(block_ctx); + return err; +#else /* SVN_HAVE_CRYPTO */ + *is_valid = FALSE; + return svn_error_create(SVN_ERR_UNSUPPORTED_FEATURE, NULL, + "Cryptographic support is not available"); +#endif /* SVN_HAVE_CRYPTO */ +} Modified: subversion/branches/ev2-export/subversion/libsvn_subr/crypto.h URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/crypto.h?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/crypto.h (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/crypto.h Thu Apr 12 22:48:32 2012 @@ -24,9 +24,15 @@ #ifndef SVN_LIBSVN_SUBR_CRYPTO_H #define SVN_LIBSVN_SUBR_CRYPTO_H -#include /* for APU_HAVE_CRYPTO */ - +/* Test for APR crypto and RNG support */ +#undef SVN_HAVE_CRYPTO +#include /* for APR_HAS_RANDOM */ +#include /* for APU_HAVE_CRYPTO */ +#if APR_HAS_RANDOM #if APU_HAVE_CRYPTO +#define SVN_HAVE_CRYPTO +#endif +#endif #include "svn_types.h" #include "svn_string.h" @@ -40,6 +46,10 @@ extern "C" { typedef struct svn_crypto__ctx_t svn_crypto__ctx_t; +/* Return TRUE iff Subversion's cryptographic support is available. */ +svn_boolean_t svn_crypto__is_available(void); + + /* Set *CTX to new Subversion cryptographic context, based on an APR-managed OpenSSL cryptography context object allocated within RESULT_POOL. */ @@ -85,10 +95,47 @@ svn_crypto__decrypt_password(const char apr_pool_t *result_pool, apr_pool_t *scratch_pool); +/* Generate the stuff Subversion needs to store in order to validate a + user-provided MASTER password: + + Set *CIPHERTEXT to a block of encrypted data. + + Set *IV and *SALT to the initialization vector and salt used for + encryption. + + Set *CHECKTEXT to the check text used for validation. + + CTX is a Subversion cryptographic context. MASTER is the + encryption secret. +*/ +svn_error_t * +svn_crypto__generate_secret_checktext(const svn_string_t **ciphertext, + const svn_string_t **iv, + const svn_string_t **salt, + const char **checktext, + svn_crypto__ctx_t *ctx, + const svn_string_t *master, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); + +/* Set *IS_VALID to TRUE iff the encryption secret MASTER successfully + validates using Subversion cryptographic context CTX against + CIPHERTEXT, IV, SALT, and CHECKTEXT (which where probably generated + via previous call to svn_crypto__generate_secret_checktext()). + + Use SCRATCH_POOL for necessary allocations. */ +svn_error_t * +svn_crypto__verify_secret(svn_boolean_t *is_valid, + svn_crypto__ctx_t *ctx, + const svn_string_t *master, + const svn_string_t *ciphertext, + const svn_string_t *iv, + const svn_string_t *salt, + const char *checktext, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* APU_HAVE_CRYPTO */ - -#endif /* SVN_CRYPTO_H */ +#endif /* SVN_LIBSVN_SUBR_CRYPTO_H */ Modified: subversion/branches/ev2-export/subversion/libsvn_subr/gpg_agent.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/gpg_agent.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/gpg_agent.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/gpg_agent.c Thu Apr 12 22:48:32 2012 @@ -332,7 +332,6 @@ password_get_gpg_agent(svn_boolean_t *do /* Create the CACHE_ID which will be generated based on REALMSTRING similar to other password caching mechanisms. */ - digest = svn_checksum_create(svn_checksum_md5, pool); svn_checksum(&digest, svn_checksum_md5, realmstring, strlen(realmstring), pool); cache_id = svn_checksum_to_cstring(digest, pool); Modified: subversion/branches/ev2-export/subversion/libsvn_subr/pool.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/pool.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/pool.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/pool.c Thu Apr 12 22:48:32 2012 @@ -28,6 +28,7 @@ #include #include +#include #include "svn_pools.h" @@ -97,3 +98,44 @@ svn_pool_create_ex(apr_pool_t *pool, apr } #endif /* APR_POOL_DEBUG */ + +apr_allocator_t * +svn_pool_create_allocator(svn_boolean_t thread_safe) +{ + apr_allocator_t *allocator; + apr_pool_t *pool; + + /* create the allocator and limit it's internal free list to keep + * memory usage in check */ + + if (apr_allocator_create(&allocator)) + abort_on_pool_failure(EXIT_FAILURE); + + apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); + + /* create the root pool */ + + pool = svn_pool_create_ex(NULL, allocator); + apr_allocator_owner_set(allocator, pool); + +#if APR_POOL_DEBUG + apr_pool_tag (pool, "svn root pool"); +#endif + + /* By default, allocators are *not* thread-safe. We must provide a mutex + * if we want thread-safety for that mutex. */ + +#if APR_HAS_THREADS + if (thread_safe) + { + apr_thread_mutex_t *mutex; + apr_thread_mutex_create (&mutex, APR_THREAD_MUTEX_DEFAULT, pool); + apr_allocator_mutex_set (allocator, mutex); + } +#endif + + /* better safe than sorry */ + SVN_ERR_ASSERT_NO_RETURN(allocator != NULL); + + return allocator; +} Modified: subversion/branches/ev2-export/subversion/libsvn_subr/stream.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/stream.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/stream.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/stream.c Thu Apr 12 22:48:32 2012 @@ -222,9 +222,15 @@ svn_stream_printf(svn_stream_t *stream, va_list ap; apr_size_t len; - va_start(ap, fmt); - message = apr_pvsprintf(pool, fmt, ap); - va_end(ap); + /* any format controls or is this a static string? */ + if (strchr(fmt, '%')) + { + va_start(ap, fmt); + message = apr_pvsprintf(pool, fmt, ap); + va_end(ap); + } + else + message = fmt; len = strlen(message); return svn_stream_write(stream, message, &len); Modified: subversion/branches/ev2-export/subversion/libsvn_subr/svn_temp_serializer.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/svn_temp_serializer.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/svn_temp_serializer.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/svn_temp_serializer.c Thu Apr 12 22:48:32 2012 @@ -352,7 +352,7 @@ svn_temp_deserializer__resolve(void *buf } const void * -svn_temp_deserializer__ptr(const void *buffer, const void **ptr) +svn_temp_deserializer__ptr(const void *buffer, const void *const *ptr) { return (apr_size_t)*ptr == 0 ? NULL Modified: subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_subr/win32_crypto.c Thu Apr 12 22:48:32 2012 @@ -28,28 +28,77 @@ /*** Includes. ***/ #include +#include #include "svn_auth.h" #include "svn_error.h" #include "svn_utf.h" #include "svn_config.h" #include "svn_user.h" +#include "svn_base64.h" #include "private/svn_auth_private.h" #include "svn_private_config.h" #include -#include - -/*-----------------------------------------------------------------------*/ -/* Windows simple provider, encrypts the password on Win2k and later. */ -/*-----------------------------------------------------------------------*/ + /* The description string that's combined with unencrypted data by the Windows CryptoAPI. Used during decryption to verify that the encrypted data were valid. */ static const WCHAR description[] = L"auth_svn.simple.wincrypt"; + +/* Return a copy of ORIG, encrypted using the Windows CryptoAPI and + allocated from POOL. */ +const svn_string_t * +encrypt_data(const svn_string_t *orig, + apr_pool_t *pool) +{ + DATA_BLOB blobin; + DATA_BLOB blobout; + const svn_string_t *crypted = NULL; + + blobin.cbData = orig->len; + blobin.pbData = (BYTE *)orig->data; + if (CryptProtectData(&blobin, description, NULL, NULL, NULL, + CRYPTPROTECT_UI_FORBIDDEN, &blobout)) + { + crypted = svn_string_ncreate(blobout.pbData, blobout.cbData, pool); + LocalFree(blobout.pbData); + } + return crypted; +} + +/* Return a copy of CRYPTED, decrypted using the Windows CryptoAPI and + allocated from POOL. */ +const svn_string_t * +decrypt_data(const svn_string_t *crypted, + apr_pool_t *pool) +{ + DATA_BLOB blobin; + DATA_BLOB blobout; + LPWSTR descr; + const svn_string_t *orig = NULL; + + blobin.cbData = crypted->len; + blobin.pbData = (BYTE *)crypted->data; + if (CryptUnprotectData(&blobin, &descr, NULL, NULL, NULL, + CRYPTPROTECT_UI_FORBIDDEN, &blobout)) + { + if (0 == lstrcmpW(descr, description)) + orig = svn_string_ncreate(blobout.pbData, blobout.cbData, pool); + LocalFree(blobout.pbData); + LocalFree(descr); + } + return orig; +} + + +/*-----------------------------------------------------------------------*/ +/* Windows simple provider, encrypts the password on Win2k and later. */ +/*-----------------------------------------------------------------------*/ + /* Implementation of svn_auth__password_set_t that encrypts the incoming password using the Windows CryptoAPI. */ static svn_error_t * @@ -62,22 +111,15 @@ windows_password_encrypter(svn_boolean_t svn_boolean_t non_interactive, apr_pool_t *pool) { - DATA_BLOB blobin; - DATA_BLOB blobout; - svn_boolean_t crypted; + const svn_string_t *coded; - blobin.cbData = strlen(in); - blobin.pbData = (BYTE*) in; - crypted = CryptProtectData(&blobin, description, NULL, NULL, NULL, - CRYPTPROTECT_UI_FORBIDDEN, &blobout); - if (crypted) + coded = encrypt_data(svn_string_create(in, pool), pool); + if (coded) { - char *coded = apr_palloc(pool, apr_base64_encode_len(blobout.cbData)); - apr_base64_encode(coded, (const char*)blobout.pbData, blobout.cbData); + coded = svn_base64_encode_string2(coded, FALSE, pool); SVN_ERR(svn_auth__simple_password_set(done, creds, realmstring, username, - coded, parameters, + coded->data, parameters, non_interactive, pool)); - LocalFree(blobout.pbData); } return SVN_NO_ERROR; @@ -96,33 +138,25 @@ windows_password_decrypter(svn_boolean_t svn_boolean_t non_interactive, apr_pool_t *pool) { - DATA_BLOB blobin; - DATA_BLOB blobout; - LPWSTR descr; - svn_boolean_t decrypted; - char *in; + const svn_string_t *orig; + const char *in; SVN_ERR(svn_auth__simple_password_get(done, &in, creds, realmstring, username, parameters, non_interactive, pool)); if (!done) return SVN_NO_ERROR; - blobin.cbData = strlen(in); - blobin.pbData = apr_palloc(pool, apr_base64_decode_len(in)); - apr_base64_decode((char*)blobin.pbData, in); - decrypted = CryptUnprotectData(&blobin, &descr, NULL, NULL, NULL, - CRYPTPROTECT_UI_FORBIDDEN, &blobout); - if (decrypted) + orig = svn_base64_decode_string(svn_string_create(in, pool), pool); + orig = decrypt_data(orig, pool); + if (orig) { - if (0 == lstrcmpW(descr, description)) - *out = apr_pstrndup(pool, (const char*)blobout.pbData, blobout.cbData); - else - decrypted = FALSE; - LocalFree(blobout.pbData); - LocalFree(descr); + *out = orig->data; + *done = TRUE; + } + else + { + *done = FALSE; } - - *done = decrypted; return SVN_NO_ERROR; } @@ -200,22 +234,16 @@ windows_ssl_client_cert_pw_encrypter(svn svn_boolean_t non_interactive, apr_pool_t *pool) { - DATA_BLOB blobin; - DATA_BLOB blobout; - svn_boolean_t crypted; + const svn_string_t *coded; - blobin.cbData = strlen(in); - blobin.pbData = (BYTE*) in; - crypted = CryptProtectData(&blobin, description, NULL, NULL, NULL, - CRYPTPROTECT_UI_FORBIDDEN, &blobout); - if (crypted) + coded = encrypt_data(svn_string_create(in, pool), pool); + if (coded) { - char *coded = apr_palloc(pool, apr_base64_encode_len(blobout.cbData)); - apr_base64_encode(coded, (const char*)blobout.pbData, blobout.cbData); + coded = svn_base64_encode_string2(coded, FALSE, pool); SVN_ERR(svn_auth__ssl_client_cert_pw_set(done, creds, realmstring, - username, coded, parameters, - non_interactive, pool)); - LocalFree(blobout.pbData); + username, coded->data, + parameters, non_interactive, + pool)); } return SVN_NO_ERROR; @@ -234,11 +262,8 @@ windows_ssl_client_cert_pw_decrypter(svn svn_boolean_t non_interactive, apr_pool_t *pool) { - DATA_BLOB blobin; - DATA_BLOB blobout; - LPWSTR descr; - svn_boolean_t decrypted; - char *in; + const svn_string_t *orig; + const char *in; SVN_ERR(svn_auth__ssl_client_cert_pw_get(done, &in, creds, realmstring, username, parameters, @@ -246,22 +271,17 @@ windows_ssl_client_cert_pw_decrypter(svn if (!done) return SVN_NO_ERROR; - blobin.cbData = strlen(in); - blobin.pbData = apr_palloc(pool, apr_base64_decode_len(in)); - apr_base64_decode((char*)blobin.pbData, in); - decrypted = CryptUnprotectData(&blobin, &descr, NULL, NULL, NULL, - CRYPTPROTECT_UI_FORBIDDEN, &blobout); - if (decrypted) + orig = svn_base64_decode_string(svn_string_create(in, pool), pool); + orig = decrypt_data(orig, pool); + if (orig) { - if (0 == lstrcmpW(descr, description)) - *out = apr_pstrndup(pool, (const char*)blobout.pbData, blobout.cbData); - else - decrypted = FALSE; - LocalFree(blobout.pbData); - LocalFree(descr); + *out = orig->data; + *done = TRUE; + } + else + { + *done = FALSE; } - - *done = decrypted; return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_wc/diff_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/diff_editor.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/diff_editor.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/diff_editor.c Thu Apr 12 22:48:32 2012 @@ -1946,7 +1946,8 @@ svn_wc__get_diff_editor(const svn_delta_ SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - shim_callbacks, result_pool, scratch_pool)); + NULL, NULL, shim_callbacks, + result_pool, scratch_pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_wc/node.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/node.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/node.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/node.c Thu Apr 12 22:48:32 2012 @@ -882,7 +882,6 @@ get_base_rev(svn_revnum_t *base_revision const char *local_abspath, apr_pool_t *scratch_pool) { - svn_boolean_t have_base; svn_error_t *err; err = svn_wc__db_base_get_info(NULL, NULL, base_revision, NULL, @@ -896,13 +895,7 @@ get_base_rev(svn_revnum_t *base_revision svn_error_clear(err); - SVN_ERR(svn_wc__db_read_info(NULL, NULL, base_revision, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, &have_base, NULL, - NULL, NULL, NULL, NULL, NULL, - db, local_abspath, - scratch_pool, scratch_pool)); + *base_revision = SVN_INVALID_REVNUM; return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_wc/status.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/status.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/status.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/status.c Thu Apr 12 22:48:32 2012 @@ -2588,7 +2588,7 @@ svn_wc__get_status_editor(const svn_delt shim_callbacks->fetch_baton = sfb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - shim_callbacks, + NULL, NULL, shim_callbacks, result_pool, scratch_pool)); return SVN_NO_ERROR; Modified: subversion/branches/ev2-export/subversion/libsvn_wc/update_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/update_editor.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/update_editor.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/update_editor.c Thu Apr 12 22:48:32 2012 @@ -4996,7 +4996,8 @@ make_editor(svn_revnum_t *target_revisio shim_callbacks->fetch_baton = sfb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - shim_callbacks, result_pool, scratch_pool)); + NULL, NULL, shim_callbacks, + result_pool, scratch_pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.c Thu Apr 12 22:48:32 2012 @@ -3662,11 +3662,42 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro dst_parent_relpath, presence_map, dst_presence)); - /* ### What about other results from scan_addition()? - * ### 'cp A B; mv B C' currently results in C being marked moved-here - * ### with no corresponding moved-from. */ - if (is_move && status != svn_wc__db_status_added) - SVN_ERR(svn_sqlite__bind_int64(stmt, 7, 1)); + if (is_move) + { + if (dst_op_depth == relpath_depth(dst_relpath)) + { + /* We're moving the root of the move operation. + * + * When an added node or the op-root of a copy is moved, + * there is no 'moved-from' corresponding to the moved-here + * node. So the net effect is the same as copy+delete. + * Perform a normal copy operation in these cases. */ + if (!(status == svn_wc__db_status_added || + (status == svn_wc__db_status_copied && op_root))) + SVN_ERR(svn_sqlite__bind_int64(stmt, 7, 1)); + } + else + { + svn_sqlite__stmt_t *info_stmt; + svn_boolean_t have_row; + + /* We're moving a child along with the root of the move. + * + * Set moved-here depending on dst_parent, propagating + * the above decision to moved-along children. + * We can't use scan_addition() to detect moved-here because + * the delete-half of the move might not yet exist. */ + SVN_ERR(svn_sqlite__get_statement(&info_stmt, dst_wcroot->sdb, + STMT_SELECT_NODE_INFO)); + SVN_ERR(svn_sqlite__bindf(info_stmt, "is", dst_wcroot->wc_id, + dst_parent_relpath)); + SVN_ERR(svn_sqlite__step(&have_row, info_stmt)); + SVN_ERR_ASSERT(have_row); + if (svn_sqlite__column_boolean(info_stmt, 15)) + SVN_ERR(svn_sqlite__bind_int64(stmt, 7, 1)); + SVN_ERR(svn_sqlite__reset(info_stmt)); + } + } SVN_ERR(svn_sqlite__step_done(stmt)); Modified: subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.h URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.h?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.h (original) +++ subversion/branches/ev2-export/subversion/libsvn_wc/wc_db.h Thu Apr 12 22:48:32 2012 @@ -2600,10 +2600,10 @@ svn_wc__db_scan_addition(svn_wc__db_stat MOVED_TO_ABSPATH will specify the path where this node was moved to if the node has moved-away. - If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the root - of the copy operation that created the move destination. - If LOCAL_ABSPATH itself is the root of the copy, MOVED_TO_OP_ROOT_ABSPATH - equals MOVED_TO_ABSPATH. + If the node was moved-away, MOVED_TO_OP_ROOT_ABSPATH will specify the + target path of the root of the move operation. If LOCAL_ABSPATH itself + is the source path of the root of the move operation, then + MOVED_TO_OP_ROOT_ABSPATH equals MOVED_TO_ABSPATH. All OUT parameters may be set to NULL to indicate a lack of interest in that piece of information. Modified: subversion/branches/ev2-export/subversion/svn/diff-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/diff-cmd.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svn/diff-cmd.c (original) +++ subversion/branches/ev2-export/subversion/svn/diff-cmd.c Thu Apr 12 22:48:32 2012 @@ -249,6 +249,12 @@ svn_cl__diff(apr_getopt_t *os, SVN_ERR(svn_cl__args_to_target_array_print_reserved(&tmp2, os, tmp, ctx, FALSE, pool)); + + /* Check if either or both targets were skipped (e.g. because they + * were .svn directories). */ + if (tmp2->nelts < 2) + return svn_error_create(SVN_ERR_CL_INSUFFICIENT_ARGS, NULL, NULL); + SVN_ERR(svn_opt_parse_path(&old_rev, &old_target, APR_ARRAY_IDX(tmp2, 0, const char *), pool)); Modified: subversion/branches/ev2-export/subversion/svn/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svn/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svn/main.c (original) +++ subversion/branches/ev2-export/subversion/svn/main.c Thu Apr 12 22:48:32 2012 @@ -1542,7 +1542,6 @@ int main(int argc, const char *argv[]) { svn_error_t *err; - apr_allocator_t *allocator; apr_pool_t *pool; int opt_id; apr_getopt_t *os; @@ -1567,14 +1566,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); - + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int)); /* Check library versions */ Modified: subversion/branches/ev2-export/subversion/svnadmin/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnadmin/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnadmin/main.c (original) +++ subversion/branches/ev2-export/subversion/svnadmin/main.c Thu Apr 12 22:48:32 2012 @@ -1768,7 +1768,6 @@ main(int argc, const char *argv[]) { svn_error_t *err; apr_status_t apr_err; - apr_allocator_t *allocator; apr_pool_t *pool; const svn_opt_subcommand_desc2_t *subcommand = NULL; @@ -1785,13 +1784,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int)); Modified: subversion/branches/ev2-export/subversion/svndumpfilter/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svndumpfilter/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svndumpfilter/main.c (original) +++ subversion/branches/ev2-export/subversion/svndumpfilter/main.c Thu Apr 12 22:48:32 2012 @@ -1262,7 +1262,6 @@ main(int argc, const char *argv[]) { svn_error_t *err; apr_status_t apr_err; - apr_allocator_t *allocator; apr_pool_t *pool; const svn_opt_subcommand_desc2_t *subcommand = NULL; @@ -1280,13 +1279,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); /* Check library versions */ err = check_lib_versions(); Modified: subversion/branches/ev2-export/subversion/svnlook/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnlook/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnlook/main.c (original) +++ subversion/branches/ev2-export/subversion/svnlook/main.c Thu Apr 12 22:48:32 2012 @@ -2251,7 +2251,6 @@ main(int argc, const char *argv[]) { svn_error_t *err; apr_status_t apr_err; - apr_allocator_t *allocator; apr_pool_t *pool; const svn_opt_subcommand_desc2_t *subcommand = NULL; @@ -2268,13 +2267,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int)); Modified: subversion/branches/ev2-export/subversion/svnrdump/dump_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnrdump/dump_editor.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnrdump/dump_editor.c (original) +++ subversion/branches/ev2-export/subversion/svnrdump/dump_editor.c Thu Apr 12 22:48:32 2012 @@ -1063,7 +1063,7 @@ svn_rdump__get_dump_editor(const svn_del shim_callbacks->fetch_baton = eb; SVN_ERR(svn_editor__insert_shims(editor, edit_baton, *editor, *edit_baton, - shim_callbacks, pool, pool)); + NULL, NULL, shim_callbacks, pool, pool)); return SVN_NO_ERROR; } Modified: subversion/branches/ev2-export/subversion/svnrdump/svnrdump.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnrdump/svnrdump.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnrdump/svnrdump.c (original) +++ subversion/branches/ev2-export/subversion/svnrdump/svnrdump.c Thu Apr 12 22:48:32 2012 @@ -694,7 +694,6 @@ main(int argc, const char **argv) apr_getopt_t *os; const char *first_arg; apr_array_header_t *received_opts; - apr_allocator_t *allocator; int i; if (svn_cmdline_init ("svnrdump", stderr) != EXIT_SUCCESS) @@ -703,13 +702,7 @@ main(int argc, const char **argv) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); opt_baton = apr_pcalloc(pool, sizeof(*opt_baton)); opt_baton->start_revision.kind = svn_opt_revision_unspecified; Modified: subversion/branches/ev2-export/subversion/svnserve/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnserve/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnserve/main.c (original) +++ subversion/branches/ev2-export/subversion/svnserve/main.c Thu Apr 12 22:48:32 2012 @@ -413,7 +413,6 @@ int main(int argc, const char *argv[]) apr_sockaddr_t *sa; apr_pool_t *pool; apr_pool_t *connection_pool; - apr_allocator_t *allocator; svn_error_t *err; apr_getopt_t *os; int opt; @@ -928,22 +927,12 @@ int main(int argc, const char *argv[]) return ERROR_SUCCESS; #endif - /* If we are using fulltext caches etc. we will allocate many large - chunks of memory of various sizes outside the cache for those - fulltexts. Make sure we use the memory wisely: use an allocator - that causes memory fragments to be given back to the OS early. */ - - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - /* Non-standard pool handling. The main thread never blocks to join the connection threads so it cannot clean up after each one. So separate pools that can be cleared at thread exit are used. */ - connection_pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, connection_pool); + connection_pool + = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); status = apr_socket_accept(&usock, sock, connection_pool); if (handling_mode == connection_mode_fork) Modified: subversion/branches/ev2-export/subversion/svnsync/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnsync/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnsync/main.c (original) +++ subversion/branches/ev2-export/subversion/svnsync/main.c Thu Apr 12 22:48:32 2012 @@ -1888,7 +1888,6 @@ main(int argc, const char *argv[]) const char *password = NULL, *source_password = NULL, *sync_password = NULL; apr_array_header_t *config_options = NULL; const char *source_prop_encoding = NULL; - apr_allocator_t *allocator; if (svn_cmdline_init("svnsync", stderr) != EXIT_SUCCESS) { @@ -1902,13 +1901,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); err = svn_ra_initialize(pool); if (err) Modified: subversion/branches/ev2-export/subversion/svnversion/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/svnversion/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/svnversion/main.c (original) +++ subversion/branches/ev2-export/subversion/svnversion/main.c Thu Apr 12 22:48:32 2012 @@ -122,7 +122,6 @@ main(int argc, const char *argv[]) { const char *wc_path, *trail_url; const char *local_abspath; - apr_allocator_t *allocator; apr_pool_t *pool; svn_wc_revision_status_t *res; svn_boolean_t no_newline = FALSE, committed = FALSE; @@ -150,13 +149,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); /* Check library versions */ err = check_lib_versions(); Modified: subversion/branches/ev2-export/subversion/tests/cmdline/basic_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/basic_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/basic_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/basic_tests.py Thu Apr 12 22:48:32 2012 @@ -25,7 +25,9 @@ ###################################################################### # General modules -import shutil, stat, re, os +import shutil, stat, re, os, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -659,8 +661,8 @@ def basic_conflict(sbox): # probably reveal the cause for the failure, if they were # uncommented: # - # print("Not all extra reject files have been accounted for:") - # print(extra_files) + # logger.warn("Not all extra reject files have been accounted for:") + # logger.warn(extra_files) ### we should raise a less generic error here. which? raise svntest.Failure @@ -780,17 +782,17 @@ def basic_revert(sbox): fp = open(beta_path, 'r') lines = fp.readlines() if not ((len (lines) == 1) and (lines[0] == "This is the file 'beta'.\n")): - print("Revert failed to restore original text.") + logger.warn("Revert failed to restore original text.") raise svntest.Failure fp = open(iota_path, 'r') lines = fp.readlines() if not ((len (lines) == 1) and (lines[0] == "This is the file 'iota'.\n")): - print("Revert failed to restore original text.") + logger.warn("Revert failed to restore original text.") raise svntest.Failure fp = open(rho_path, 'r') lines = fp.readlines() if not ((len (lines) == 1) and (lines[0] == "This is the file 'rho'.\n")): - print("Revert failed to restore original text.") + logger.warn("Revert failed to restore original text.") raise svntest.Failure fp = open(zeta_path, 'r') lines = fp.readlines() @@ -989,7 +991,7 @@ def verify_file_deleted(message, path): except IOError: return if message is not None: - print(message) + logger.warn(message) ###TODO We should raise a less generic error here. which? raise svntest.Failure @@ -1168,11 +1170,11 @@ def basic_delete(sbox): # check unversioned and added dirs has been removed if verify_dir_deleted(Q_path): - print("Failed to remove unversioned dir") + logger.warn("Failed to remove unversioned dir") ### we should raise a less generic error here. which? raise svntest.Failure if verify_dir_deleted(X_path): - print("Failed to remove added dir") + logger.warn("Failed to remove added dir") ### we should raise a less generic error here. which? raise svntest.Failure @@ -1673,8 +1675,8 @@ def basic_info(sbox): if line.startswith('Path: '): paths.append(line[6:].rstrip()) if paths != expected_paths: - print("Reported paths: %s" % paths) - print("Expected paths: %s" % expected_paths) + logger.warn("Reported paths: %s" % paths) + logger.warn("Expected paths: %s" % expected_paths) raise svntest.Failure sbox.build(read_only = True) @@ -1697,7 +1699,7 @@ def repos_root(sbox): if line == "Repository Root: " + sbox.repo_url + "\n": break else: - print("Bad or missing repository root") + logger.warn("Bad or missing repository root") raise svntest.Failure sbox.build(read_only = True) @@ -1920,7 +1922,7 @@ def delete_keep_local_twice(sbox): svntest.actions.run_and_verify_svn(None, None, [], 'rm', '--keep-local', dir) if not os.path.isdir(dir): - print('Directory was really deleted') + logger.warn('Directory was really deleted') raise svntest.Failure def windows_paths_in_repos(sbox): @@ -2194,8 +2196,8 @@ def automatic_conflict_resolution(sbox): # probably reveal the cause for the failure, if they were # uncommented: # - # print("Not all extra reject files have been accounted for:") - # print(extra_files) + # logger.warn("Not all extra reject files have been accounted for:") + # logger.warn(extra_files) ### we should raise a less generic error here. which? raise svntest.Failure