Author: svn-role Date: Thu Nov 20 04:01:23 2014 New Revision: 1640665 URL: http://svn.apache.org/r1640665 Log: Merge the 1.8.x-r1611379 branch:
* r1619380, r1619393 Fix diff of a locally copied directory with props: it showed all props as added instead of a diff against the copy-from props. Justification: Behaviour regression introduced in 1.8.0. Notes: r1619380 is the fix; r1619393 a test for it. The test on trunk@1619393 is tweaked to account for a trunk bug in the display of diff headers; the backport branch provides the correct version for 1.8.x. Branch: ^/subversion/branches/1.8.x-r1611379 Votes: +1: julianfoad, rhuijben, stefan2 Modified: subversion/branches/1.8.x/ (props changed) subversion/branches/1.8.x/STATUS subversion/branches/1.8.x/subversion/include/private/svn_io_private.h subversion/branches/1.8.x/subversion/libsvn_subr/io.c subversion/branches/1.8.x/subversion/libsvn_subr/named_atomic.c Propchange: subversion/branches/1.8.x/ ------------------------------------------------------------------------------ Merged /subversion/trunk:r1611379,1612405,1615354,1617687 Merged /subversion/branches/1.8.x-r1611379:r1612525-1640664 Modified: subversion/branches/1.8.x/STATUS URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1640665&r1=1640664&r2=1640665&view=diff ============================================================================== --- subversion/branches/1.8.x/STATUS (original) +++ subversion/branches/1.8.x/STATUS Thu Nov 20 04:01:23 2014 @@ -146,18 +146,3 @@ Veto-blocked changes: Approved changes: ================= - - * r1619380, r1619393 - Fix diff of a locally copied directory with props: it showed all props - as added instead of a diff against the copy-from props. - Justification: - Behaviour regression introduced in 1.8.0. - Notes: - r1619380 is the fix; r1619393 a test for it. - The test on trunk@1619393 is tweaked to account for a trunk bug in the - display of diff headers; the backport branch provides the correct - version for 1.8.x. - Branch: - ^/subversion/branches/1.8.x-r1611379 - Votes: - +1: julianfoad, rhuijben, stefan2 Modified: subversion/branches/1.8.x/subversion/include/private/svn_io_private.h URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/include/private/svn_io_private.h?rev=1640665&r1=1640664&r2=1640665&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/include/private/svn_io_private.h (original) +++ subversion/branches/1.8.x/subversion/include/private/svn_io_private.h Thu Nov 20 04:01:23 2014 @@ -64,6 +64,18 @@ svn_io__is_finfo_read_only(svn_boolean_t apr_pool_t *pool); +/** + * Lock file at @a lock_file. If that file does not exist, create an empty + * file. + * + * Lock will be automatically released when @a pool is cleared or destroyed. + * Use @a pool for memory allocations. + */ +svn_error_t * +svn_io__file_lock_autocreate(const char *lock_file, + apr_pool_t *pool); + + /** Buffer test handler function for a generic stream. @see svn_stream_t * and svn_stream__is_buffered(). * Modified: subversion/branches/1.8.x/subversion/libsvn_subr/io.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/io.c?rev=1640665&r1=1640664&r2=1640665&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_subr/io.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_subr/io.c Thu Nov 20 04:01:23 2014 @@ -2089,6 +2089,35 @@ svn_io_file_lock2(const char *lock_file, return svn_io_lock_open_file(lockfile_handle, exclusive, nonblocking, pool); } +svn_error_t * +svn_io__file_lock_autocreate(const char *lock_file, + apr_pool_t *pool) +{ + svn_error_t *err + = svn_io_file_lock2(lock_file, TRUE, FALSE, pool); + if (err && APR_STATUS_IS_ENOENT(err->apr_err)) + { + /* No lock file? No big deal; these are just empty files anyway. + Create it and try again. */ + svn_error_clear(err); + + /* This file creation is racy. + We don't care as long as file gets created at all. */ + err = svn_io_file_create(lock_file, "", pool); + if (err && APR_STATUS_IS_EEXIST(err->apr_err)) + { + svn_error_clear(err); + err = NULL; + } + + /* Finally, lock the file - if it exists */ + if (!err) + err = svn_io_file_lock2(lock_file, TRUE, FALSE, pool); + } + + return svn_error_trace(err); +} + /* Data consistency/coherency operations. */ Modified: subversion/branches/1.8.x/subversion/libsvn_subr/named_atomic.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/named_atomic.c?rev=1640665&r1=1640664&r2=1640665&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/libsvn_subr/named_atomic.c (original) +++ subversion/branches/1.8.x/subversion/libsvn_subr/named_atomic.c Thu Nov 20 04:01:23 2014 @@ -32,6 +32,7 @@ #include "svn_pools.h" #include "svn_dirent_uri.h" #include "svn_io.h" +#include "private/svn_io_private.h" /* Implementation aspects. * @@ -197,8 +198,8 @@ struct shared_data_t */ struct mutex_t { - /* Inter-process sync. is handled by through lock file. */ - apr_file_t *lock_file; + /* Inter-process sync. is handled by through a lock file. */ + const char *lock_name; /* Pool to be used with lock / unlock functions */ apr_pool_t *pool; @@ -275,14 +276,13 @@ static svn_error_t * lock(struct mutex_t *mutex) { svn_error_t *err; - - /* Get lock on the filehandle. */ SVN_ERR(svn_mutex__lock(thread_mutex)); - err = svn_io_lock_open_file(mutex->lock_file, TRUE, FALSE, mutex->pool); - return err - ? svn_mutex__unlock(thread_mutex, err) - : err; + err = svn_io__file_lock_autocreate(mutex->lock_name, mutex->pool); + if (err) + err = svn_mutex__unlock(thread_mutex, err); + + return svn_error_trace(err); } /* Utility that releases the lock previously acquired via lock(). If the @@ -292,37 +292,10 @@ lock(struct mutex_t *mutex) static svn_error_t * unlock(struct mutex_t *mutex, svn_error_t * outer_err) { - svn_error_t *unlock_err - = svn_io_unlock_open_file(mutex->lock_file, mutex->pool); - return svn_mutex__unlock(thread_mutex, - svn_error_compose_create(outer_err, - unlock_err)); + svn_pool_clear(mutex->pool); + return svn_mutex__unlock(thread_mutex, outer_err); } -#if APR_HAS_MMAP -/* The last user to close a particular namespace should also remove the - * lock file. Failure to do so, however, does not affect further uses - * of the same namespace. - */ -static apr_status_t -delete_lock_file(void *arg) -{ - struct mutex_t *mutex = arg; - const char *lock_name = NULL; - - /* locks have already been cleaned up. Simply close the file */ - apr_status_t status = apr_file_close(mutex->lock_file); - - /* Remove the file from disk. This will fail if there ares still other - * users of this lock file, i.e. namespace. */ - apr_file_name_get(&lock_name, mutex->lock_file); - if (lock_name) - apr_file_remove(lock_name, mutex->pool); - - return status; -} -#endif /* APR_HAS_MMAP */ - /* Validate the ATOMIC parameter, i.e it's address. Correct code will * never need this but if someone should accidentally to use a NULL or * incomplete structure, let's catch that here instead of segfaulting. @@ -411,29 +384,18 @@ svn_atomic_namespace__create(svn_atomic_ */ svn_atomic_namespace__t *new_ns = apr_pcalloc(result_pool, sizeof(**ns)); - /* construct the names of the system objects that we need + /* construct the name of the system objects that we need */ shm_name = apr_pstrcat(subpool, name, SHM_NAME_SUFFIX, NULL); - lock_name = apr_pstrcat(subpool, name, MUTEX_NAME_SUFFIX, NULL); + lock_name = apr_pstrcat(result_pool, name, MUTEX_NAME_SUFFIX, NULL); /* initialize the lock objects */ SVN_ERR(svn_atomic__init_once(&mutex_initialized, init_thread_mutex, NULL, result_pool)); - new_ns->mutex.pool = result_pool; - SVN_ERR(svn_io_file_open(&new_ns->mutex.lock_file, lock_name, - APR_READ | APR_WRITE | APR_CREATE, - APR_OS_DEFAULT, - result_pool)); - - /* Make sure the last user of our lock file will actually remove it. - * Please note that only the last file handle begin closed will actually - * remove the underlying file (see docstring for apr_file_remove). - */ - apr_pool_cleanup_register(result_pool, &new_ns->mutex, - delete_lock_file, - apr_pool_cleanup_null); + new_ns->mutex.pool = svn_pool_create(result_pool); + new_ns->mutex.lock_name = lock_name; /* Prevent concurrent initialization. */ @@ -482,17 +444,21 @@ svn_atomic_namespace__create(svn_atomic_ * with our data file) */ if (new_ns->data->count > MAX_ATOMIC_COUNT) - return svn_error_create(SVN_ERR_CORRUPTED_ATOMIC_STORAGE, 0, - _("Number of atomics in namespace is too large.")); - - /* Cache the number of existing, complete entries. There can't be - * incomplete ones from other processes because we hold the mutex. - * Our process will also not access this information since we are - * either being called from within svn_atomic__init_once or by - * svn_atomic_namespace__create for a new object. - */ - new_ns->min_used = new_ns->data->count; - *ns = new_ns; + { + err = svn_error_create(SVN_ERR_CORRUPTED_ATOMIC_STORAGE, 0, + _("Number of atomics in namespace is too large.")); + } + else + { + /* Cache the number of existing, complete entries. There can't be + * incomplete ones from other processes because we hold the mutex. + * Our process will also not access this information since we are + * either being called from within svn_atomic__init_once or by + * svn_atomic_namespace__create for a new object. + */ + new_ns->min_used = new_ns->data->count; + *ns = new_ns; + } } /* Unlock to allow other processes may access the shared memory as well.