You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/09/11 17:51:34 UTC
svn commit: r1702504 [14/19] - in /subversion/branches/reuse-ra-session: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
contrib/hook-scripts/ notes/ subversion/bindings/ctypes-python/csvn/ext/
subversion/bindings/javahl/native/ ...
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/stream.c Fri Sep 11 15:51:30 2015
@@ -197,8 +197,15 @@ svn_error_t *
svn_stream_skip(svn_stream_t *stream, apr_size_t len)
{
if (stream->skip_fn == NULL)
- return svn_error_trace(
- skip_default_handler(stream->baton, len, stream->read_full_fn));
+ {
+ svn_read_fn_t read_fn = stream->read_full_fn ? stream->read_full_fn
+ : stream->read_fn;
+ if (read_fn == NULL)
+ return svn_error_create(SVN_ERR_STREAM_NOT_SUPPORTED, NULL, NULL);
+
+ return svn_error_trace(skip_default_handler(stream->baton, len,
+ read_fn));
+ }
return svn_error_trace(stream->skip_fn(stream->baton, len));
}
@@ -938,8 +945,9 @@ static svn_error_t *
data_available_handler_apr(void *baton, svn_boolean_t *data_available)
{
struct baton_apr *btn = baton;
- apr_pollfd_t pfd;
apr_status_t status;
+#if !defined(WIN32) || APR_FILES_AS_SOCKETS
+ apr_pollfd_t pfd;
int n;
pfd.desc_type = APR_POLL_FILE;
@@ -969,6 +977,24 @@ data_available_handler_apr(void *baton,
"failed")),
NULL);
}
+#else
+ HANDLE h;
+ DWORD dwAvail;
+ status = apr_os_file_get(&h, btn->file);
+
+ if (status)
+ return svn_error_wrap_apr(status, NULL);
+
+ if (PeekNamedPipe(h, NULL, 0, NULL, &dwAvail, NULL))
+ {
+ *data_available = (dwAvail > 0);
+ return SVN_NO_ERROR;
+ }
+
+ return svn_error_create(SVN_ERR_STREAM_NOT_SUPPORTED,
+ svn_error_wrap_apr(apr_get_os_error(), NULL),
+ _("Windows doesn't support polling on files"));
+#endif
}
static svn_boolean_t
@@ -1032,10 +1058,12 @@ svn_stream_open_unique(svn_stream_t **st
}
-svn_stream_t *
-svn_stream_from_aprfile2(apr_file_t *file,
- svn_boolean_t disown,
- apr_pool_t *pool)
+/* Helper function that creates a stream from an APR file. */
+static svn_stream_t *
+make_stream_from_apr_file(apr_file_t *file,
+ svn_boolean_t disown,
+ svn_boolean_t supports_seek,
+ apr_pool_t *pool)
{
struct baton_apr *baton;
svn_stream_t *stream;
@@ -1049,9 +1077,14 @@ svn_stream_from_aprfile2(apr_file_t *fil
stream = svn_stream_create(baton, pool);
svn_stream_set_read2(stream, read_handler_apr, read_full_handler_apr);
svn_stream_set_write(stream, write_handler_apr);
- svn_stream_set_skip(stream, skip_handler_apr);
- svn_stream_set_mark(stream, mark_handler_apr);
- svn_stream_set_seek(stream, seek_handler_apr);
+
+ if (supports_seek)
+ {
+ svn_stream_set_skip(stream, skip_handler_apr);
+ svn_stream_set_mark(stream, mark_handler_apr);
+ svn_stream_set_seek(stream, seek_handler_apr);
+ }
+
svn_stream_set_data_available(stream, data_available_handler_apr);
svn_stream__set_is_buffered(stream, is_buffered_handler_apr);
stream->file = file;
@@ -1062,6 +1095,14 @@ svn_stream_from_aprfile2(apr_file_t *fil
return stream;
}
+svn_stream_t *
+svn_stream_from_aprfile2(apr_file_t *file,
+ svn_boolean_t disown,
+ apr_pool_t *pool)
+{
+ return make_stream_from_apr_file(file, disown, TRUE, pool);
+}
+
apr_file_t *
svn_stream__aprfile(svn_stream_t *stream)
{
@@ -1687,6 +1728,114 @@ svn_stream_from_string(const svn_string_
return stream;
}
+/* Baton structure for buffering read stream wrappers.
+ *
+ * We read from INNER and append the data to BUFFER. From BUFFER, we serve
+ * read requests. Old buffer contents gets discarded once it is no longer
+ * needed.
+ */
+struct buffering_stream_wrapper_baton
+{
+ /* Our data source. */
+ svn_stream_t *inner;
+
+ /* Contains the data pre-read from INNER. Some of this may already have
+ * been delivered. */
+ svn_stringbuf_t *buffer;
+
+ /* Current read position relative to the start of BUFFER->DATA. */
+ apr_size_t buffer_pos;
+};
+
+/* Implements svn_stream_t.read_fn for buffering read stream wrappers. */
+static svn_error_t *
+read_handler_buffering_wrapper(void *baton,
+ char *buffer,
+ apr_size_t *len)
+{
+ struct buffering_stream_wrapper_baton *btn = baton;
+ apr_size_t left_to_read = btn->buffer->len - btn->buffer_pos;
+
+ /* This is the "normal" and potential incomplete read function.
+ * So, we only need to replenish our buffers if we ran completely dry. */
+ if (left_to_read == 0)
+ {
+ apr_size_t count = btn->buffer->blocksize;
+
+ /* Read from the INNER stream. */
+ SVN_ERR(svn_stream_read2(btn->inner, btn->buffer->data, &count));
+ btn->buffer->len = count;
+ btn->buffer_pos = 0;
+
+ /* We may now have more data that we could return. */
+ left_to_read = btn->buffer->len;
+ }
+
+ /* Cap the read request to what we can deliver from the buffer. */
+ if (left_to_read < *len)
+ *len = left_to_read;
+
+ /* Copy the data from the buffer and move the read pointer accordingly. */
+ memcpy(buffer, btn->buffer->data + btn->buffer_pos, *len);
+ btn->buffer_pos += *len;
+
+ return SVN_NO_ERROR;
+}
+
+/* Implements svn_stream_t.data_available_fn for buffering read stream
+ * wrappers. */
+static svn_error_t *
+data_available_handler_buffering_wrapper(void *baton,
+ svn_boolean_t *data_available)
+{
+ /* If we still have some unread data, this becomes easy to answer. */
+ struct buffering_stream_wrapper_baton *btn = baton;
+ if (btn->buffer->len > btn->buffer_pos)
+ {
+ *data_available = TRUE;
+ return SVN_NO_ERROR;
+ }
+
+ /* Otherwise, because we would always read from the inner streams' current
+ * position to fill the buffer, asking the inner stream when the buffer is
+ * exhausted gives the correct answer. */
+ return svn_error_trace(svn_stream_data_available(btn->inner,
+ data_available));
+}
+
+/* Implements svn_stream_t.is_buffered_fn for buffering read stream wrappers.
+ */
+static svn_boolean_t
+is_buffered_handler_buffering_wrapper(void *baton)
+{
+ return TRUE;
+}
+
+svn_stream_t *
+svn_stream_wrap_buffered_read(svn_stream_t *inner,
+ apr_pool_t *result_pool)
+{
+ svn_stream_t *stream;
+ struct buffering_stream_wrapper_baton *baton;
+
+ /* Create the wrapper stream state.
+ * The buffer is empty and we are at position 0. */
+ baton = apr_pcalloc(result_pool, sizeof(*baton));
+ baton->inner = inner;
+ baton->buffer = svn_stringbuf_create_ensure(SVN__STREAM_CHUNK_SIZE,
+ result_pool);
+ baton->buffer_pos = 0;
+
+ /* Create the wrapper stream object and set up the vtable. */
+ stream = svn_stream_create(baton, result_pool);
+ svn_stream_set_read2(stream, read_handler_buffering_wrapper, NULL);
+ svn_stream_set_data_available(stream,
+ data_available_handler_buffering_wrapper);
+ svn_stream__set_is_buffered(stream, is_buffered_handler_buffering_wrapper);
+
+ return stream;
+}
+
svn_error_t *
svn_stream_for_stdin(svn_stream_t **in, apr_pool_t *pool)
@@ -1698,7 +1847,11 @@ svn_stream_for_stdin(svn_stream_t **in,
if (apr_err)
return svn_error_wrap_apr(apr_err, "Can't open stdin");
- *in = svn_stream_from_aprfile2(stdin_file, TRUE, pool);
+ /* STDIN may or may not support positioning requests, but generally
+ it does not, or the behavior is implementation-specific. Hence,
+ we cannot safely advertise mark(), seek() and non-default skip()
+ support. */
+ *in = make_stream_from_apr_file(stdin_file, TRUE, FALSE, pool);
return SVN_NO_ERROR;
}
@@ -1714,7 +1867,11 @@ svn_stream_for_stdout(svn_stream_t **out
if (apr_err)
return svn_error_wrap_apr(apr_err, "Can't open stdout");
- *out = svn_stream_from_aprfile2(stdout_file, TRUE, pool);
+ /* STDOUT may or may not support positioning requests, but generally
+ it does not, or the behavior is implementation-specific. Hence,
+ we cannot safely advertise mark(), seek() and non-default skip()
+ support. */
+ *out = make_stream_from_apr_file(stdout_file, TRUE, FALSE, pool);
return SVN_NO_ERROR;
}
@@ -1730,7 +1887,11 @@ svn_stream_for_stderr(svn_stream_t **err
if (apr_err)
return svn_error_wrap_apr(apr_err, "Can't open stderr");
- *err = svn_stream_from_aprfile2(stderr_file, TRUE, pool);
+ /* STDERR may or may not support positioning requests, but generally
+ it does not, or the behavior is implementation-specific. Hence,
+ we cannot safely advertise mark(), seek() and non-default skip()
+ support. */
+ *err = make_stream_from_apr_file(stderr_file, TRUE, FALSE, pool);
return SVN_NO_ERROR;
}
@@ -1982,48 +2143,6 @@ struct install_baton_t
#ifdef WIN32
-#if _WIN32_WINNT < 0x600 /* Does the SDK assume Windows Vista+? */
-typedef struct _FILE_RENAME_INFO {
- BOOL ReplaceIfExists;
- HANDLE RootDirectory;
- DWORD FileNameLength;
- WCHAR FileName[1];
-} FILE_RENAME_INFO, *PFILE_RENAME_INFO;
-
-typedef struct _FILE_DISPOSITION_INFO {
- BOOL DeleteFile;
-} FILE_DISPOSITION_INFO, *PFILE_DISPOSITION_INFO;
-
-#define FileRenameInfo 3
-#define FileDispositionInfo 4
-
-typedef BOOL (WINAPI *SetFileInformationByHandle_t)(HANDLE hFile,
- int FileInformationClass,
- LPVOID lpFileInformation,
- DWORD dwBufferSize);
-
-static volatile SetFileInformationByHandle_t SetFileInformationByHandle_p = 0;
-#define SetFileInformationByHandle (*SetFileInformationByHandle_p)
-
-static volatile svn_atomic_t SetFileInformationByHandle_a = 0;
-
-
-static svn_error_t *
-find_SetFileInformationByHandle(void *baton, apr_pool_t *scratch_pool)
-{
- HMODULE kernel32 = GetModuleHandle("Kernel32.dll");
-
- if (kernel32)
- {
- SetFileInformationByHandle_p =
- (SetFileInformationByHandle_t)
- GetProcAddress(kernel32, "SetFileInformationByHandle");
- }
-
- return SVN_NO_ERROR;
-}
-#endif /* WIN32 < Vista */
-
/* Create and open a tempfile in DIRECTORY. Return its handle and path */
static svn_error_t *
create_tempfile(HANDLE *hFile,
@@ -2092,6 +2211,8 @@ create_tempfile(HANDLE *hFile,
return SVN_NO_ERROR;
}
+#endif /* WIN32 */
+
/* Implements svn_close_fn_t */
static svn_error_t *
install_close(void *baton)
@@ -2104,8 +2225,6 @@ install_close(void *baton)
return SVN_NO_ERROR;
}
-#endif /* WIN32 */
-
svn_error_t *
svn_stream__create_for_install(svn_stream_t **install_stream,
const char *tmp_abspath,
@@ -2128,8 +2247,8 @@ svn_stream__create_for_install(svn_strea
/* Wrap as a standard APR file to allow sharing implementation.
But do note that some file functions (such as retrieving the name)
- don't work on this wrapper. */
- /* ### Buffered, or not? */
+ don't work on this wrapper.
+ Use buffered mode to match svn_io_open_unique_file3() behavior. */
status = apr_os_file_put(&file, &hInstall,
APR_WRITE | APR_BINARY | APR_BUFFERED,
result_pool);
@@ -2160,12 +2279,8 @@ svn_stream__create_for_install(svn_strea
ib->tmp_path = tmp_path;
-#ifdef WIN32
/* Don't close the file on stream close; flush instead */
svn_stream_set_close(*install_stream, install_close);
-#else
- /* ### Install pool cleanup handler for tempfile? */
-#endif
return SVN_NO_ERROR;
}
@@ -2181,105 +2296,48 @@ svn_stream__install_stream(svn_stream_t
SVN_ERR_ASSERT(svn_dirent_is_absolute(final_abspath));
#ifdef WIN32
-
-#if _WIN32_WINNT < 0x600
- SVN_ERR(svn_atomic__init_once(&SetFileInformationByHandle_a,
- find_SetFileInformationByHandle,
- NULL, scratch_pool));
-
- if (!SetFileInformationByHandle_p)
- SVN_ERR(svn_io_file_close(ib->baton_apr.file, scratch_pool));
- else
-#endif /* WIN32 < Windows Vista */
+ err = svn_io__win_rename_open_file(ib->baton_apr.file, ib->tmp_path,
+ final_abspath, scratch_pool);
+ if (make_parents && err && APR_STATUS_IS_ENOENT(err->apr_err))
{
- WCHAR *w_final_abspath;
- size_t path_len;
- size_t rename_size;
- FILE_RENAME_INFO *rename_info;
- HANDLE hFile;
-
- apr_os_file_get(&hFile, ib->baton_apr.file);
-
- SVN_ERR(svn_io__utf8_to_unicode_longpath(&w_final_abspath,
- svn_dirent_local_style(
- final_abspath,
- scratch_pool),
- scratch_pool));
- path_len = wcslen(w_final_abspath);
- rename_size = sizeof(*rename_info) + sizeof(WCHAR) * path_len;
-
- /* The rename info struct doesn't need hacks for long paths,
- so no ugly escaping calls here */
- rename_info = apr_pcalloc(scratch_pool, rename_size);
- rename_info->ReplaceIfExists = TRUE;
- rename_info->FileNameLength = path_len;
- memcpy(rename_info->FileName, w_final_abspath, path_len * sizeof(WCHAR));
-
- if (!SetFileInformationByHandle(hFile, FileRenameInfo, rename_info,
- rename_size))
- {
- svn_boolean_t retry = FALSE;
- err = svn_error_wrap_apr(apr_get_os_error(), NULL);
-
- /* ### rhuijben: I wouldn't be surprised if we later find out that we
- have to fall back to close+rename on some specific
- error values here, to support some non standard NAS
- and filesystem scenarios. */
-
- if (make_parents && err && APR_STATUS_IS_ENOENT(err->apr_err))
- {
- svn_error_t *err2;
-
- err2 = svn_io_make_dir_recursively(svn_dirent_dirname(final_abspath,
- scratch_pool),
- scratch_pool);
-
- if (err2)
- return svn_error_trace(svn_error_compose_create(err, err2));
- else
- svn_error_clear(err);
-
- retry = TRUE;
- err = NULL;
- }
- else if (err && (APR_STATUS_IS_EACCES(err->apr_err)
- || APR_STATUS_IS_EEXIST(err->apr_err)))
- {
- svn_error_clear(err);
- retry = TRUE;
- err = NULL;
+ svn_error_t *err2;
- /* Set the destination file writable because Windows will not allow
- us to rename when final_abspath is read-only. */
- SVN_ERR(svn_io_set_file_read_write(final_abspath, TRUE,
- scratch_pool));
- }
+ err2 = svn_io_make_dir_recursively(svn_dirent_dirname(final_abspath,
+ scratch_pool),
+ scratch_pool);
- if (retry)
- {
- if (!SetFileInformationByHandle(hFile, FileRenameInfo,
- rename_info, rename_size))
- {
- err = svn_error_wrap_apr(
- apr_get_os_error(),
- _("Can't move '%s' to '%s'"),
- svn_dirent_local_style(ib->tmp_path,
- scratch_pool),
- svn_dirent_local_style(final_abspath,
- scratch_pool));
- }
- }
- }
+ if (err2)
+ return svn_error_trace(svn_error_compose_create(err, err2));
else
- err = NULL;
+ svn_error_clear(err);
+
+ err = svn_io__win_rename_open_file(ib->baton_apr.file, ib->tmp_path,
+ final_abspath, scratch_pool);
+ }
+ /* ### rhuijben: I wouldn't be surprised if we later find out that we
+ have to fall back to close+rename on some specific
+ error values here, to support some non standard NAS
+ and filesystem scenarios. */
+ if (err && err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
+ {
+ /* Rename open files is not supported on this platform: fallback to
+ svn_io_file_rename2(). */
+ svn_error_clear(err);
+ err = SVN_NO_ERROR;
+ }
+ else
+ {
return svn_error_compose_create(err,
svn_io_file_close(ib->baton_apr.file,
scratch_pool));
}
#endif
- err = svn_io_file_rename(ib->tmp_path, final_abspath, scratch_pool);
+ /* Close temporary file. */
+ SVN_ERR(svn_io_file_close(ib->baton_apr.file, scratch_pool));
+
+ err = svn_io_file_rename2(ib->tmp_path, final_abspath, FALSE, scratch_pool);
/* A missing directory is too common to not cover here. */
if (make_parents && err && APR_STATUS_IS_ENOENT(err->apr_err))
@@ -2297,7 +2355,7 @@ svn_stream__install_stream(svn_stream_t
/* We could create a directory: retry install */
svn_error_clear(err);
- SVN_ERR(svn_io_file_rename(ib->tmp_path, final_abspath, scratch_pool));
+ SVN_ERR(svn_io_file_rename2(ib->tmp_path, final_abspath, FALSE, scratch_pool));
}
else
SVN_ERR(err);
@@ -2312,19 +2370,12 @@ svn_stream__install_get_info(apr_finfo_t
apr_pool_t *scratch_pool)
{
struct install_baton_t *ib = install_stream->baton;
-
-#ifdef WIN32
- /* On WIN32 the file is still open, so we can obtain the information
- from the handle without race conditions */
apr_status_t status;
status = apr_file_info_get(finfo, wanted, ib->baton_apr.file);
if (status)
return svn_error_wrap_apr(status, NULL);
-#else
- SVN_ERR(svn_io_stat(finfo, ib->tmp_path, wanted, scratch_pool));
-#endif
return SVN_NO_ERROR;
}
@@ -2336,39 +2387,25 @@ svn_stream__install_delete(svn_stream_t
struct install_baton_t *ib = install_stream->baton;
#ifdef WIN32
- BOOL done;
-
-#if _WIN32_WINNT < 0x600
-
- SVN_ERR(svn_atomic__init_once(&SetFileInformationByHandle_a,
- find_SetFileInformationByHandle,
- NULL, scratch_pool));
+ svn_error_t *err;
- if (!SetFileInformationByHandle_p)
- done = FALSE;
- else
-#endif /* WIN32 < Windows Vista */
+ /* Mark the file as delete on close to avoid having to reopen
+ the file as part of the delete handling. */
+ err = svn_io__win_delete_file_on_close(ib->baton_apr.file, ib->tmp_path,
+ scratch_pool);
+ if (err == SVN_NO_ERROR)
{
- FILE_DISPOSITION_INFO disposition_info;
- HANDLE hFile;
-
- apr_os_file_get(&hFile, ib->baton_apr.file);
-
- disposition_info.DeleteFile = TRUE;
-
- /* Mark the file as delete on close to avoid having to reopen
- the file as part of the delete handling. */
- done = SetFileInformationByHandle(hFile, FileDispositionInfo,
- &disposition_info,
- sizeof(disposition_info));
+ SVN_ERR(svn_io_file_close(ib->baton_apr.file, scratch_pool));
+ return SVN_NO_ERROR; /* File is already gone */
}
- SVN_ERR(svn_io_file_close(ib->baton_apr.file, scratch_pool));
-
- if (done)
- return SVN_NO_ERROR; /* File is already gone */
+ /* Deleting file on close may be unsupported, so ignore errors and
+ fallback to svn_io_remove_file2(). */
+ svn_error_clear(err);
#endif
+ SVN_ERR(svn_io_file_close(ib->baton_apr.file, scratch_pool));
+
return svn_error_trace(svn_io_remove_file2(ib->tmp_path, FALSE,
scratch_pool));
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/subst.c Fri Sep 11 15:51:30 2015
@@ -1649,7 +1649,7 @@ detranslate_special_file(const char *src
cancel_func, cancel_baton, scratch_pool));
/* Do the atomic rename from our temporary location. */
- return svn_error_trace(svn_io_file_rename(dst_tmp, dst, scratch_pool));
+ return svn_error_trace(svn_io_file_rename2(dst_tmp, dst, FALSE, scratch_pool));
}
/* Creates a special file DST from the "normal form" located in SOURCE.
@@ -1691,17 +1691,16 @@ create_special_file_from_stream(svn_stre
".tmp", pool);
/* If we had an error, check to see if it was because symlinks are
- not supported on the platform. If so, fall back
- to using the internal representation. */
- if (err)
+ not supported on the platform. If so, fall back to using the
+ internal representation. */
+ if (err && err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
{
- if (err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)
- {
- svn_error_clear(err);
- create_using_internal_representation = TRUE;
- }
- else
- return err;
+ svn_error_clear(err);
+ create_using_internal_representation = TRUE;
+ }
+ else if (err)
+ {
+ return svn_error_trace(err);
}
}
else
@@ -1733,7 +1732,7 @@ create_special_file_from_stream(svn_stre
}
/* Do the atomic rename from our temporary location. */
- return svn_error_trace(svn_io_file_rename(dst_tmp, dst, pool));
+ return svn_error_trace(svn_io_file_rename2(dst_tmp, dst, FALSE, pool));
}
@@ -1824,7 +1823,7 @@ svn_subst_copy_and_translate4(const char
}
/* Now that dst_tmp contains the translated data, do the atomic rename. */
- SVN_ERR(svn_io_file_rename(dst_tmp, dst, pool));
+ SVN_ERR(svn_io_file_rename2(dst_tmp, dst, FALSE, pool));
/* Preserve the source file's permission bits. */
SVN_ERR(svn_io_copy_perms(src, dst, pool));
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/sysinfo.c Fri Sep 11 15:51:30 2015
@@ -45,6 +45,7 @@
#include "svn_version.h"
#include "private/svn_sqlite.h"
+#include "private/svn_subr_private.h"
#include "sysinfo.h"
#include "svn_private_config.h"
@@ -125,7 +126,7 @@ const apr_array_header_t *
svn_sysinfo__linked_libs(apr_pool_t *pool)
{
svn_version_ext_linked_lib_t *lib;
- apr_array_header_t *array = apr_array_make(pool, 3, sizeof(*lib));
+ apr_array_header_t *array = apr_array_make(pool, 5, sizeof(*lib));
lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
lib->name = "APR";
@@ -142,6 +143,11 @@ svn_sysinfo__linked_libs(apr_pool_t *poo
#endif
lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+ lib->name = "Expat";
+ lib->compiled_version = apr_pstrdup(pool, svn_xml__compiled_version());
+ lib->runtime_version = apr_pstrdup(pool, svn_xml__runtime_version());
+
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
lib->name = "SQLite";
lib->compiled_version = apr_pstrdup(pool, svn_sqlite__compiled_version());
#ifdef SVN_SQLITE_INLINE
@@ -150,6 +156,11 @@ svn_sysinfo__linked_libs(apr_pool_t *poo
lib->runtime_version = apr_pstrdup(pool, svn_sqlite__runtime_version());
#endif
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+ lib->name = "ZLib";
+ lib->compiled_version = apr_pstrdup(pool, svn_zlib__compiled_version());
+ lib->runtime_version = apr_pstrdup(pool, svn_zlib__runtime_version());
+
return array;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/temp_serializer.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/temp_serializer.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/temp_serializer.c Fri Sep 11 15:51:30 2015
@@ -366,7 +366,7 @@ svn_temp_serializer__get(svn_temp_serial
* proper pointer value.
*/
void
-svn_temp_deserializer__resolve(void *buffer, void **ptr)
+svn_temp_deserializer__resolve(const void *buffer, void **ptr)
{
/* All pointers are stored as offsets to the buffer start
* (of the respective serialized sub-struct). */
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/user.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/user.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/user.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/user.c Fri Sep 11 15:51:30 2015
@@ -28,6 +28,7 @@
#include "svn_user.h"
#include "svn_utf.h"
+#include "svn_dirent_uri.h"
/* Get the current user's name from the OS */
static const char *
@@ -68,8 +69,11 @@ svn_user_get_name(apr_pool_t *pool)
return utf8_or_nothing(username, pool);
}
-const char *
-svn_user_get_homedir(apr_pool_t *pool)
+/* Most of the guts of svn_user_get_homedir(): everything except
+ * canonicalizing the path.
+ */
+static const char *
+user_get_homedir(apr_pool_t *pool)
{
const char *username;
char *homedir;
@@ -84,3 +88,14 @@ svn_user_get_homedir(apr_pool_t *pool)
return NULL;
}
+
+const char *
+svn_user_get_homedir(apr_pool_t *pool)
+{
+ const char *homedir = user_get_homedir(pool);
+
+ if (homedir)
+ return svn_dirent_canonicalize(homedir, pool);
+
+ return NULL;
+}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/x509parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/x509parse.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/x509parse.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/x509parse.c Fri Sep 11 15:51:30 2015
@@ -691,8 +691,7 @@ x509_get_ext(apr_array_header_t *dnsname
else
{
/* We found a dNSName entry */
- x509_buf *dnsname = apr_palloc(dnsnames->pool,
- sizeof(x509_buf));
+ x509_buf *dnsname = apr_palloc(dnsnames->pool, sizeof(*dnsname));
dnsname->tag = ASN1_IA5_STRING; /* implicit based on dNSName */
dnsname->len = len;
dnsname->p = *p;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_subr/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_subr/xml.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_subr/xml.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_subr/xml.c Fri Sep 11 15:51:30 2015
@@ -34,6 +34,7 @@
#include "svn_ctype.h"
#include "private/svn_utf_private.h"
+#include "private/svn_subr_private.h"
#ifdef SVN_HAVE_OLD_EXPAT
#include <xmlparse.h>
@@ -45,6 +46,28 @@
#error Expat is unusable -- it has been compiled for wide characters
#endif
+const char *
+svn_xml__compiled_version(void)
+{
+ static const char xml_version_str[] = APR_STRINGIFY(XML_MAJOR_VERSION)
+ "." APR_STRINGIFY(XML_MINOR_VERSION)
+ "." APR_STRINGIFY(XML_MICRO_VERSION);
+
+ return xml_version_str;
+}
+
+const char *
+svn_xml__runtime_version(void)
+{
+ const char *expat_version = XML_ExpatVersion();
+
+ if (!strncmp(expat_version, "expat_", 6))
+ expat_version += 6;
+
+ return expat_version;
+}
+
+
/* The private internals for a parser object. */
struct svn_xml_parser_t
{
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/adm_crawler.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/adm_crawler.c Fri Sep 11 15:51:30 2015
@@ -1016,6 +1016,7 @@ svn_wc__internal_transmit_text_deltas(co
svn_checksum_t *local_sha1_checksum; /* calc'd SHA1 of LOCAL_STREAM */
svn_wc__db_install_data_t *install_data = NULL;
svn_error_t *err;
+ svn_error_t *err2;
svn_stream_t *base_stream; /* delta source */
svn_stream_t *local_stream; /* delta target: LOCAL_ABSPATH transl. to NF */
@@ -1112,7 +1113,15 @@ svn_wc__internal_transmit_text_deltas(co
scratch_pool, scratch_pool);
/* Close the two streams to force writing the digest */
- err = svn_error_compose_create(err, svn_stream_close(base_stream));
+ err2 = svn_stream_close(base_stream);
+ if (err2)
+ {
+ /* Set verify_checksum to NULL if svn_stream_close() returns error
+ because checksum will be uninitialized in this case. */
+ verify_checksum = NULL;
+ err = svn_error_compose_create(err, err2);
+ }
+
err = svn_error_compose_create(err, svn_stream_close(local_stream));
/* If we have an error, it may be caused by a corrupt text base,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/conflicts.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/conflicts.c Fri Sep 11 15:51:30 2015
@@ -2323,6 +2323,17 @@ svn_wc__read_conflicts(const apr_array_h
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_wc__read_conflict_descriptions2_t(const apr_array_header_t **conflicts,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ return svn_wc__read_conflicts(conflicts, NULL, wc_ctx->db, local_abspath,
+ FALSE, FALSE, result_pool, scratch_pool);
+}
+
/*** Resolving a conflict automatically ***/
@@ -2578,6 +2589,35 @@ resolve_prop_conflict_on_node(svn_boolea
return SVN_NO_ERROR;
}
+/*
+ * Record a tree conflict resolution failure due to error condition ERR
+ * in the RESOLVE_LATER hash table. If the hash table is not available
+ * (meaning the caller does not wish to retry resolution later), or if
+ * the error condition does not indicate circumstances where another
+ * existing tree conflict is blocking the resolution attempt, then
+ * return the error ERR itself.
+ */
+static svn_error_t *
+handle_tree_conflict_resolution_failure(const char *local_abspath,
+ svn_error_t *err,
+ apr_hash_t *resolve_later)
+{
+ const char *dup_abspath;
+
+ if (!resolve_later
+ || (err->apr_err != SVN_ERR_WC_OBSTRUCTED_UPDATE
+ && err->apr_err != SVN_ERR_WC_FOUND_CONFLICT))
+ return svn_error_trace(err); /* Give up. Do not retry resolution later. */
+
+ svn_error_clear(err);
+ dup_abspath = apr_pstrdup(apr_hash_pool_get(resolve_later),
+ local_abspath);
+
+ svn_hash_sets(resolve_later, dup_abspath, dup_abspath);
+
+ return SVN_NO_ERROR; /* Caller may retry after resolving other conflicts. */
+}
+
/*
* Resolve the tree conflict found in DB/LOCAL_ABSPATH according to
* CONFLICT_CHOICE.
@@ -2587,9 +2627,11 @@ resolve_prop_conflict_on_node(svn_boolea
*
* It is not an error if there is no tree conflict.
*
- * If the conflict can't be resolved yet because another tree conflict is
- * blocking a storage location, store the tree conflict in the RESOLVE_LATER
- * hash.
+ * If the conflict can't be resolved yet (e.g. because another tree conflict
+ * is blocking a storage location), and RESOLVE_LATER is not NULL, store the
+ * tree conflict in RESOLVE_LATER and do not mark the conflict resolved.
+ * Else if RESOLVE_LATER is NULL, do not mark the conflict resolved and
+ * return the error which prevented the conflict from being marked resolved.
*/
static svn_error_t *
resolve_tree_conflict_on_node(svn_boolean_t *did_resolve,
@@ -2664,22 +2706,8 @@ resolve_tree_conflict_on_node(svn_boolea
scratch_pool);
if (err)
- {
- const char *dup_abspath;
-
- if (!resolve_later
- || (err->apr_err != SVN_ERR_WC_OBSTRUCTED_UPDATE
- && err->apr_err != SVN_ERR_WC_FOUND_CONFLICT))
- return svn_error_trace(err);
-
- svn_error_clear(err);
- dup_abspath = apr_pstrdup(apr_hash_pool_get(resolve_later),
- local_abspath);
-
- svn_hash_sets(resolve_later, dup_abspath, dup_abspath);
-
- return SVN_NO_ERROR; /* Retry after other conflicts */
- }
+ SVN_ERR(handle_tree_conflict_resolution_failure(
+ local_abspath, err, resolve_later));
/* We might now have a moved-away on *this* path, let's
try to resolve that directly if that is the case */
@@ -2746,22 +2774,8 @@ resolve_tree_conflict_on_node(svn_boolea
scratch_pool);
if (err)
- {
- const char *dup_abspath;
-
- if (!resolve_later
- || (err->apr_err != SVN_ERR_WC_OBSTRUCTED_UPDATE
- && err->apr_err != SVN_ERR_WC_FOUND_CONFLICT))
- return svn_error_trace(err);
-
- svn_error_clear(err);
- dup_abspath = apr_pstrdup(apr_hash_pool_get(resolve_later),
- local_abspath);
-
- svn_hash_sets(resolve_later, dup_abspath, dup_abspath);
-
- return SVN_NO_ERROR; /* Retry after other conflicts */
- }
+ SVN_ERR(handle_tree_conflict_resolution_failure(
+ local_abspath, err, resolve_later));
else
*did_resolve = TRUE;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/copy.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/copy.c Fri Sep 11 15:51:30 2015
@@ -1104,8 +1104,8 @@ svn_wc__move2(svn_wc_context_t *wc_ctx,
{
svn_error_t *err;
- err = svn_error_trace(svn_io_file_rename(src_abspath, dst_abspath,
- scratch_pool));
+ err = svn_error_trace(svn_io_file_rename2(src_abspath, dst_abspath,
+ FALSE, scratch_pool));
/* Let's try if we can keep wc.db consistent even when the move
fails. Deleting the target is a wc.db only operation, while
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/node.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/node.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/node.c Fri Sep 11 15:51:30 2015
@@ -906,7 +906,8 @@ svn_wc__rename_wc(svn_wc_context_t *wc_c
{
SVN_ERR(svn_wc__db_drop_root(wc_ctx->db, wcroot_abspath, scratch_pool));
- SVN_ERR(svn_io_file_rename(from_abspath, dst_abspath, scratch_pool));
+ SVN_ERR(svn_io_file_rename2(from_abspath, dst_abspath, FALSE,
+ scratch_pool));
}
else
return svn_error_createf(
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/update_editor.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/update_editor.c Fri Sep 11 15:51:30 2015
@@ -1863,13 +1863,14 @@ add_directory(const char *path,
SVN_ERR_ASSERT(! (copyfrom_path || SVN_IS_VALID_REVNUM(copyfrom_rev)));
SVN_ERR(make_dir_baton(&db, path, eb, pb, TRUE, pool));
- SVN_ERR(calculate_repos_relpath(&db->new_repos_relpath, db->local_abspath,
- NULL, eb, pb, db->pool, scratch_pool));
*child_baton = db;
if (db->skip_this)
return SVN_NO_ERROR;
+ SVN_ERR(calculate_repos_relpath(&db->new_repos_relpath, db->local_abspath,
+ NULL, eb, pb, db->pool, scratch_pool));
+
SVN_ERR(mark_directory_edited(db, pool));
if (strcmp(eb->target_abspath, db->local_abspath) == 0)
@@ -3066,13 +3067,13 @@ add_file(const char *path,
SVN_ERR_ASSERT(! (copyfrom_path || SVN_IS_VALID_REVNUM(copyfrom_rev)));
SVN_ERR(make_file_baton(&fb, pb, path, TRUE, pool));
- SVN_ERR(calculate_repos_relpath(&fb->new_repos_relpath, fb->local_abspath,
- NULL, eb, pb, fb->pool, pool));
*file_baton = fb;
if (fb->skip_this)
return SVN_NO_ERROR;
+ SVN_ERR(calculate_repos_relpath(&fb->new_repos_relpath, fb->local_abspath,
+ NULL, eb, pb, fb->pool, pool));
SVN_ERR(mark_file_edited(fb, pool));
/* The file_pool can stick around for a *long* time, so we want to
@@ -3551,15 +3552,23 @@ lazy_open_target(svn_stream_t **stream,
apr_pool_t *scratch_pool)
{
struct handler_baton *hb = baton;
+ svn_wc__db_install_data_t *install_data;
+ /* By convention return value is undefined on error, but we rely
+ on HB->INSTALL_DATA value in window_handler() and abort
+ INSTALL_STREAM if is not NULL on error.
+ So we store INSTALL_DATA to local variable first, to leave
+ HB->INSTALL_DATA unchanged on error. */
SVN_ERR(svn_wc__db_pristine_prepare_install(stream,
- &hb->install_data,
+ &install_data,
&hb->new_text_base_sha1_checksum,
NULL,
hb->fb->edit_baton->db,
hb->fb->dir_baton->local_abspath,
result_pool, scratch_pool));
+ hb->install_data = install_data;
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/upgrade.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/upgrade.c Fri Sep 11 15:51:30 2015
@@ -1434,7 +1434,7 @@ rename_pristine_file(void *baton,
const char *new_abspath
= apr_pstrcat(pool, abspath, PRISTINE_STORAGE_EXT, SVN_VA_NULL);
- SVN_ERR(svn_io_file_rename(abspath, new_abspath, pool));
+ SVN_ERR(svn_io_file_rename2(abspath, new_abspath, FALSE, pool));
}
return SVN_NO_ERROR;
}
@@ -2513,7 +2513,7 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
/* Renaming the db file is what makes the pre-wcng into a wcng */
db_from = svn_wc__adm_child(data.root_abspath, SDB_FILE, scratch_pool);
db_to = svn_wc__adm_child(local_abspath, SDB_FILE, scratch_pool);
- SVN_ERR(svn_io_file_rename(db_from, db_to, scratch_pool));
+ SVN_ERR(svn_io_file_rename2(db_from, db_to, FALSE, scratch_pool));
/* Now we have a working wcng, tidy up the droppings */
SVN_ERR(svn_wc__db_open(&db, NULL /* ### config */, FALSE, FALSE,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.c Fri Sep 11 15:51:30 2015
@@ -6698,8 +6698,14 @@ svn_wc__db_op_mark_resolved_internal(svn
conflict_data = svn_sqlite__column_blob(stmt, 2, &conflict_len,
scratch_pool);
- conflicts = svn_skel__parse(conflict_data, conflict_len, scratch_pool);
SVN_ERR(svn_sqlite__reset(stmt));
+ SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
+
+ if (!conflict_data)
+ return SVN_NO_ERROR;
+
+ conflicts = svn_skel__parse(conflict_data, conflict_len, scratch_pool);
+
SVN_ERR(svn_wc__conflict_skel_resolve(&resolved_all, conflicts,
db, wcroot->abspath,
@@ -6731,8 +6737,6 @@ svn_wc__db_op_mark_resolved_internal(svn
SVN_ERR(svn_sqlite__step_done(stmt));
}
- SVN_ERR(add_work_items(wcroot->sdb, work_items, scratch_pool));
-
return SVN_NO_ERROR;
}
@@ -6799,6 +6803,75 @@ clear_moved_to(svn_wc__db_wcroot_t *wcro
return SVN_NO_ERROR;
}
+/* Helper function for op_revert_txn. Raises move tree conflicts on
+ descendants to ensure database stability on a non recursive revert
+ of an ancestor that contains a possible move related tree conflict.
+ */
+static svn_error_t *
+revert_maybe_raise_moved_away(svn_wc__db_wcroot_t * wcroot,
+ svn_wc__db_t *db,
+ const char *local_relpath,
+ int op_depth_below,
+ apr_pool_t *scratch_pool)
+{
+ svn_skel_t *conflict;
+ svn_wc_operation_t operation;
+ svn_boolean_t tree_conflicted;
+ const apr_array_header_t *locations;
+ svn_wc_conflict_reason_t reason;
+ svn_wc_conflict_action_t action;
+
+ SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, NULL, wcroot,
+ local_relpath,
+ scratch_pool, scratch_pool));
+
+ if (!conflict)
+ return SVN_NO_ERROR;
+
+ SVN_ERR(svn_wc__conflict_read_info(&operation, &locations, NULL, NULL,
+ &tree_conflicted,
+ db, wcroot->abspath,
+ conflict,
+ scratch_pool, scratch_pool));
+
+ if (!tree_conflicted
+ || (operation != svn_wc_operation_update
+ && operation != svn_wc_operation_switch))
+ {
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, &action,
+ NULL,
+ db, wcroot->abspath,
+ conflict,
+ scratch_pool,
+ scratch_pool));
+
+ if (reason == svn_wc_conflict_reason_deleted
+ || reason == svn_wc_conflict_reason_replaced)
+ {
+ SVN_ERR(svn_wc__db_op_raise_moved_away_internal(
+ wcroot, local_relpath, op_depth_below, db,
+ operation, action,
+ (locations && locations->nelts > 0)
+ ? APR_ARRAY_IDX(locations, 0,
+ const svn_wc_conflict_version_t *)
+ : NULL,
+ (locations && locations->nelts > 1)
+ ? APR_ARRAY_IDX(locations, 1,
+ const svn_wc_conflict_version_t *)
+ : NULL,
+ scratch_pool));
+
+ /* Transform the move information into revert information */
+ SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
+ STMT_MOVE_NOTIFY_TO_REVERT));
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* Baton for op_revert_txn and op_revert_recursive_txn */
struct revert_baton_t
{
@@ -6823,9 +6896,7 @@ op_revert_txn(void *baton,
svn_boolean_t moved_here;
int affected_rows;
const char *moved_to;
- int op_depth_increased = 0;
int op_depth_below;
- svn_skel_t *conflict;
/* ### Similar structure to op_revert_recursive_txn, should they be
combined? */
@@ -6887,16 +6958,11 @@ op_revert_txn(void *baton,
local_relpath, op_depth,
moved_to, NULL, scratch_pool));
}
- else
- {
- SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, NULL, wcroot,
- local_relpath,
- scratch_pool, scratch_pool));
- }
-
if (op_depth > 0 && op_depth == relpath_depth(local_relpath))
{
+ int op_depth_increased;
+
/* Can't do non-recursive revert if children exist */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_GE_OP_DEPTH_CHILDREN));
@@ -6935,54 +7001,12 @@ op_revert_txn(void *baton,
/* If this node was moved-here, clear moved-to at the move source. */
if (moved_here)
SVN_ERR(clear_moved_to(wcroot, local_relpath, scratch_pool));
- }
-
- if (op_depth_increased && conflict)
- {
- svn_wc_operation_t operation;
- svn_boolean_t tree_conflicted;
- const apr_array_header_t *locations;
-
- SVN_ERR(svn_wc__conflict_read_info(&operation, &locations, NULL, NULL,
- &tree_conflicted,
- db, wcroot->abspath,
- conflict,
- scratch_pool, scratch_pool));
- if (tree_conflicted
- && (operation == svn_wc_operation_update
- || operation == svn_wc_operation_switch))
- {
- svn_wc_conflict_reason_t reason;
- svn_wc_conflict_action_t action;
-
- SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason, &action,
- NULL,
- db, wcroot->abspath,
- conflict,
- scratch_pool,
- scratch_pool));
- if (reason == svn_wc_conflict_reason_deleted
- || reason == svn_wc_conflict_reason_replaced)
- {
- SVN_ERR(svn_wc__db_op_raise_moved_away_internal(
- wcroot, local_relpath, op_depth_below, db,
- operation, action,
- (locations && locations->nelts > 0)
- ? APR_ARRAY_IDX(locations, 0,
- const svn_wc_conflict_version_t *)
- : NULL,
- (locations && locations->nelts > 1)
- ? APR_ARRAY_IDX(locations, 1,
- const svn_wc_conflict_version_t *)
- : NULL,
- scratch_pool));
-
- /* Transform the move information into revert information */
- SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
- STMT_MOVE_NOTIFY_TO_REVERT));
- }
- }
+ /* If the node was moved itself, we don't have interesting moved
+ children (and the move itself was already broken) */
+ if (op_depth_increased && !moved_to)
+ SVN_ERR(revert_maybe_raise_moved_away(wcroot, db, local_relpath,
+ op_depth_below, scratch_pool));
}
if (rvb->clear_changelists)
@@ -15117,7 +15141,7 @@ make_copy_txn(svn_wc__db_wcroot_t *wcroo
const char *name = svn_relpath_skip_ancestor(last_repos_relpath,
repos_relpath);
- if (strcmp(name, svn_relpath_basename(local_relpath, NULL)) == 0)
+ if (name && strcmp(name, svn_relpath_basename(local_relpath, NULL)) == 0)
op_depth = last_op_depth;
}
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.h?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db.h Fri Sep 11 15:51:30 2015
@@ -1644,7 +1644,12 @@ svn_wc__db_op_mark_conflict(svn_wc__db_t
apr_pool_t *scratch_pool);
-/* ### caller maintains ACTUAL, and how the resolution occurred. we're just
+/* Clear all or some of the conflicts stored on LOCAL_ABSPATH, if any.
+
+ Any work items that are necessary as part of resolving this node
+ can be passed in WORK_ITEMS.
+
+### caller maintains ACTUAL, and how the resolution occurred. we're just
### recording state.
###
### I'm not sure that these three values are the best way to do this,
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_pristine.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_pristine.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_pristine.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/wc_db_pristine.c Fri Sep 11 15:51:30 2015
@@ -333,14 +333,12 @@ pristine_install_txn(svn_sqlite__db_t *s
* an orphan file and it doesn't matter if we overwrite it.) */
{
apr_finfo_t finfo;
- SVN_ERR(svn_stream__install_get_info(&finfo, install_stream, APR_FINFO_SIZE,
- scratch_pool));
- SVN_ERR(svn_io_set_file_read_write(pristine_abspath, TRUE, scratch_pool));
+ SVN_ERR(svn_stream__install_get_info(&finfo, install_stream,
+ APR_FINFO_SIZE, scratch_pool));
SVN_ERR(svn_stream__install_stream(install_stream, pristine_abspath,
- TRUE, scratch_pool));
+ TRUE, scratch_pool));
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_INSERT_PRISTINE));
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_PRISTINE));
SVN_ERR(svn_sqlite__bind_checksum(stmt, 1, sha1_checksum, scratch_pool));
SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, scratch_pool));
SVN_ERR(svn_sqlite__bind_int64(stmt, 3, finfo.size));
@@ -383,9 +381,10 @@ svn_wc__db_pristine_prepare_install(svn_
*install_data = apr_pcalloc(result_pool, sizeof(**install_data));
(*install_data)->wcroot = wcroot;
- SVN_ERR(svn_stream__create_for_install(stream,
- temp_dir_abspath,
- result_pool, scratch_pool));
+ SVN_ERR_W(svn_stream__create_for_install(stream,
+ temp_dir_abspath,
+ result_pool, scratch_pool),
+ _("Unable to create pristine install stream"));
(*install_data)->inner_stream = *stream;
@@ -569,7 +568,8 @@ maybe_transfer_one_pristine(svn_wc__db_w
/* Move the file to its target location. (If it is already there, it is
* an orphan file and it doesn't matter if we overwrite it.) */
- err = svn_io_file_rename(tmp_abspath, pristine_abspath, scratch_pool);
+ err = svn_io_file_rename2(tmp_abspath, pristine_abspath, FALSE,
+ scratch_pool);
/* Maybe the directory doesn't exist yet? */
if (err && APR_STATUS_IS_ENOENT(err->apr_err))
@@ -587,7 +587,8 @@ maybe_transfer_one_pristine(svn_wc__db_w
/* We could create a directory: retry install */
svn_error_clear(err);
- SVN_ERR(svn_io_file_rename(tmp_abspath, pristine_abspath, scratch_pool));
+ SVN_ERR(svn_io_file_rename2(tmp_abspath, pristine_abspath, FALSE,
+ scratch_pool));
}
else
SVN_ERR(err);
@@ -686,42 +687,6 @@ svn_wc__db_pristine_transfer(svn_wc__db_
-/* Remove the file at FILE_ABSPATH in such a way that we could re-create a
- * new file of the same name at any time thereafter.
- *
- * On Windows, the file will not disappear immediately from the directory if
- * it is still being read so the best thing to do is first rename it to a
- * unique name. */
-static svn_error_t *
-remove_file(const char *file_abspath,
- svn_wc__db_wcroot_t *wcroot,
- svn_boolean_t ignore_enoent,
- apr_pool_t *scratch_pool)
-{
-#ifdef WIN32
- svn_error_t *err;
- const char *temp_abspath;
- const char *temp_dir_abspath
- = pristine_get_tempdir(wcroot, scratch_pool, scratch_pool);
-
- /* To rename the file to a unique name in the temp dir, first create a
- * uniquely named file in the temp dir and then overwrite it. */
- SVN_ERR(svn_io_open_unique_file3(NULL, &temp_abspath, temp_dir_abspath,
- svn_io_file_del_none,
- scratch_pool, scratch_pool));
- err = svn_io_file_rename(file_abspath, temp_abspath, scratch_pool);
- if (err && ignore_enoent && APR_STATUS_IS_ENOENT(err->apr_err))
- svn_error_clear(err);
- else
- SVN_ERR(err);
- file_abspath = temp_abspath;
-#endif
-
- SVN_ERR(svn_io_remove_file2(file_abspath, ignore_enoent, scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
/* If the pristine text referenced by SHA1_CHECKSUM in WCROOT/SDB, whose path
* within the pristine store is PRISTINE_ABSPATH, has a reference count of
* zero, delete it (both the database row and the disk file).
@@ -757,8 +722,8 @@ pristine_remove_if_unreferenced_txn(svn_
svn_boolean_t ignore_enoent = TRUE;
#endif
- SVN_ERR(remove_file(pristine_abspath, wcroot, ignore_enoent,
- scratch_pool));
+ SVN_ERR(svn_io_remove_file2(pristine_abspath, ignore_enoent,
+ scratch_pool));
}
return SVN_NO_ERROR;
@@ -944,11 +909,28 @@ svn_wc__db_pristine_check(svn_boolean_t
{
const char *pristine_abspath;
svn_node_kind_t kind_on_disk;
+ svn_error_t *err;
SVN_ERR(get_pristine_fname(&pristine_abspath, wcroot->abspath,
sha1_checksum, scratch_pool, scratch_pool));
- SVN_ERR(svn_io_check_path(pristine_abspath, &kind_on_disk, scratch_pool));
- if (kind_on_disk != svn_node_file)
+ err = svn_io_check_path(pristine_abspath, &kind_on_disk, scratch_pool);
+#ifdef WIN32
+ if (err && err->apr_err == APR_FROM_OS_ERROR(ERROR_ACCESS_DENIED))
+ {
+ svn_error_clear(err);
+ /* Possible race condition: The filename is locked, but there is no
+ file or dir with this name. Let's fall back on checking the DB.
+
+ This case is triggered by the pristine store tests on deleting
+ a file that is still open via another handle, where this other
+ handle has a FILE_SHARE_DELETE share mode.
+ */
+ }
+ else
+#endif
+ if (err)
+ return svn_error_trace(err);
+ else if (kind_on_disk != svn_node_file)
{
*present = FALSE;
return SVN_NO_ERROR;
Modified: subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/reuse-ra-session/subversion/libsvn_wc/workqueue.c Fri Sep 11 15:51:30 2015
@@ -257,7 +257,8 @@ install_committed_file(svn_boolean_t *ov
if (! same)
{
- SVN_ERR(svn_io_file_rename(tmp_wfile, file_abspath, scratch_pool));
+ SVN_ERR(svn_io_file_rename2(tmp_wfile, file_abspath, FALSE,
+ scratch_pool));
*overwrote_working = TRUE;
}
@@ -1127,9 +1128,9 @@ run_prej_install(work_item_baton_t *wqb,
scratch_pool, scratch_pool));
/* ... and atomically move it into place. */
- SVN_ERR(svn_io_file_rename(tmp_prejfile_abspath,
- prejfile_abspath,
- scratch_pool));
+ SVN_ERR(svn_io_file_rename2(tmp_prejfile_abspath,
+ prejfile_abspath, FALSE,
+ scratch_pool));
return SVN_NO_ERROR;
}
Modified: subversion/branches/reuse-ra-session/subversion/mod_authz_svn/mod_authz_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_authz_svn/mod_authz_svn.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_authz_svn/mod_authz_svn.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_authz_svn/mod_authz_svn.c Fri Sep 11 15:51:30 2015
@@ -48,6 +48,23 @@
#include "svn_dirent_uri.h"
#include "private/svn_fspath.h"
+/* The apache headers define these and they conflict with our definitions. */
+#ifdef PACKAGE_BUGREPORT
+#undef PACKAGE_BUGREPORT
+#endif
+#ifdef PACKAGE_NAME
+#undef PACKAGE_NAME
+#endif
+#ifdef PACKAGE_STRING
+#undef PACKAGE_STRING
+#endif
+#ifdef PACKAGE_TARNAME
+#undef PACKAGE_TARNAME
+#endif
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif
+#include "svn_private_config.h"
#ifdef APLOG_USE_MODULE
APLOG_USE_MODULE(authz_svn);
@@ -67,6 +84,28 @@ typedef struct authz_svn_config_rec {
const char *force_username_case;
} authz_svn_config_rec;
+/* version where ap_some_auth_required breaks */
+#if AP_MODULE_MAGIC_AT_LEAST(20060110,0)
+/* first version with force_authn hook and ap_some_authn_required()
+ which allows us to work without ap_some_auth_required() */
+# if AP_MODULE_MAGIC_AT_LEAST(20120211,47) || defined(SVN_USE_FORCE_AUTHN)
+# define USE_FORCE_AUTHN 1
+# define IN_SOME_AUTHN_NOTE "authz_svn-in-some-authn"
+# define FORCE_AUTHN_NOTE "authz_svn-force-authn"
+# else
+ /* ap_some_auth_required() is busted and no viable alternative exists */
+# ifndef SVN_ALLOW_BROKEN_HTTPD_AUTH
+# error This Apache httpd has broken auth (CVE-2015-3184)
+# else
+ /* user wants to build anyway */
+# define USE_FORCE_AUTHN 0
+# endif
+# endif
+#else
+ /* old enough that ap_some_auth_required() still works */
+# define USE_FORCE_AUTHN 0
+#endif
+
/*
* Configuration
*/
@@ -832,6 +871,48 @@ access_checker(request_rec *r)
const char *dest_repos_path = NULL;
int status, authn_required;
+#if USE_FORCE_AUTHN
+ /* Use the force_authn() hook available in 2.4.x to work securely
+ * given that ap_some_auth_required() is no longer functional for our
+ * purposes in 2.4.x.
+ */
+ int authn_configured;
+
+ /* We are not configured to run */
+ if (!conf->anonymous || apr_table_get(r->notes, IN_SOME_AUTHN_NOTE)
+ || (! (conf->access_file || conf->repo_relative_access_file)))
+ return DECLINED;
+
+ /* Authentication is configured */
+ authn_configured = ap_auth_type(r) != NULL;
+ if (authn_configured)
+ {
+ /* If the user is trying to authenticate, let him. It doesn't
+ * make much sense to grant anonymous access but deny authenticated
+ * users access, even though you can do that with '$anon' in the
+ * access file.
+ */
+ if (apr_table_get(r->headers_in,
+ (PROXYREQ_PROXY == r->proxyreq)
+ ? "Proxy-Authorization" : "Authorization"))
+ {
+ /* Set the note to force authn regardless of what access_checker_ex
+ hook requires */
+ apr_table_setn(r->notes, FORCE_AUTHN_NOTE, (const char*)1);
+
+ /* provide the proper return so the access_checker hook doesn't
+ * prevent the code from continuing on to the other auth hooks */
+ if (ap_satisfies(r) != SATISFY_ANY)
+ return OK;
+ else
+ return HTTP_FORBIDDEN;
+ }
+ }
+
+#else
+ /* Support for older versions of httpd that have a working
+ * ap_some_auth_required() */
+
/* We are not configured to run */
if (!conf->anonymous
|| (! (conf->access_file || conf->repo_relative_access_file)))
@@ -846,9 +927,10 @@ access_checker(request_rec *r)
if (ap_satisfies(r) != SATISFY_ANY)
return DECLINED;
- /* If the user is trying to authenticate, let him. If anonymous
- * access is allowed, so is authenticated access, by definition
- * of the meaning of '*' in the access file.
+ /* If the user is trying to authenticate, let him. It doesn't
+ * make much sense to grant anonymous access but deny authenticated
+ * users access, even though you can do that with '$anon' in the
+ * access file.
*/
if (apr_table_get(r->headers_in,
(PROXYREQ_PROXY == r->proxyreq)
@@ -860,6 +942,7 @@ access_checker(request_rec *r)
return HTTP_FORBIDDEN;
}
}
+#endif
/* If anon access is allowed, return OK */
status = req_check_access(r, conf, &repos_path, &dest_repos_path);
@@ -868,7 +951,26 @@ access_checker(request_rec *r)
if (!conf->authoritative)
return DECLINED;
+#if USE_FORCE_AUTHN
+ if (authn_configured) {
+ /* We have to check to see if authn is required because if so we must
+ * return UNAUTHORIZED (401) rather than FORBIDDEN (403) since returning
+ * the 403 leaks information about what paths may exist to
+ * unauthenticated users. We must set a note here in order
+ * to use ap_some_authn_rquired() without triggering an infinite
+ * loop since the call will trigger this function to be called again. */
+ apr_table_setn(r->notes, IN_SOME_AUTHN_NOTE, (const char*)1);
+ authn_required = ap_some_authn_required(r);
+ apr_table_unset(r->notes, IN_SOME_AUTHN_NOTE);
+ if (authn_required)
+ {
+ ap_note_auth_failure(r);
+ return HTTP_UNAUTHORIZED;
+ }
+ }
+#else
if (!authn_required)
+#endif
log_access_verdict(APLOG_MARK, r, 0, FALSE, repos_path, dest_repos_path);
return HTTP_FORBIDDEN;
@@ -949,6 +1051,17 @@ auth_checker(request_rec *r)
return OK;
}
+#if USE_FORCE_AUTHN
+static int
+force_authn(request_rec *r)
+{
+ if (apr_table_get(r->notes, FORCE_AUTHN_NOTE))
+ return OK;
+
+ return DECLINED;
+}
+#endif
+
/*
* Module flesh
*/
@@ -965,6 +1078,9 @@ register_hooks(apr_pool_t *p)
* give SSLOptions +FakeBasicAuth a chance to work. */
ap_hook_check_user_id(check_user_id, mod_ssl, NULL, APR_HOOK_FIRST);
ap_hook_auth_checker(auth_checker, NULL, NULL, APR_HOOK_FIRST);
+#if USE_FORCE_AUTHN
+ ap_hook_force_authn(force_authn, NULL, NULL, APR_HOOK_FIRST);
+#endif
ap_register_provider(p,
AUTHZ_SVN__SUBREQ_BYPASS_PROV_GRP,
AUTHZ_SVN__SUBREQ_BYPASS_PROV_NAME,
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/activity.c Fri Sep 11 15:51:30 2015
@@ -165,7 +165,7 @@ dav_svn__delete_activity(const dav_svn_r
txn_name = read_txn(pathname, repos->pool);
if (txn_name == NULL)
{
- return dav_svn__new_error(repos->pool, HTTP_NOT_FOUND, 0,
+ return dav_svn__new_error(repos->pool, HTTP_NOT_FOUND, 0, 0,
"could not find activity.");
}
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/dav_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/dav_svn.h?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/dav_svn.h (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/dav_svn.h Fri Sep 11 15:51:30 2015
@@ -796,28 +796,35 @@ dav_svn__authz_read_func(dav_svn__authz_
If ERROR_ID is 0, SVN_ERR_RA_DAV_REQUEST_FAILED will be used as a
default value for the error code.
+
+ mod_dav is definitive documentation of the parameters, but a
+ guideline to the different error is:
+
+ STATUS is the HTTP status returned to the client.
+
+ ERROR_ID is an additional DAV-specific error such as a violation of
+ the DAV rules. mod_dav.h defines some values but callers can pass
+ others.
+
+ APRERR is any underlying OS/system error.
*/
dav_error *
dav_svn__new_error_svn(apr_pool_t *pool,
int status,
int error_id,
+ apr_status_t aprerr,
const char *desc);
/* A wrapper around mod_dav's dav_new_error, mod_dav_svn uses this
instead of the mod_dav function to enable special mod_dav_svn specific
- processing. See dav_new_error for parameter documentation.
- Note that DESC may be null (it's hard to track this down from
- dav_new_error()'s documentation, but see the dav_error type,
- which says that its desc field may be NULL).
-
- If ERROR_ID is 0, SVN_ERR_RA_DAV_REQUEST_FAILED will be used as a
- default value for the error code.
+ processing. See dav_svn__new_error_svn for additional details.
*/
dav_error *
dav_svn__new_error(apr_pool_t *pool,
int status,
int error_id,
+ apr_status_t aprerr,
const char *desc);
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/deadprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/deadprops.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/deadprops.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/deadprops.c Fri Sep 11 15:51:30 2015
@@ -199,7 +199,7 @@ save_value(dav_db *db, const dav_prop_na
/* ignore the unknown namespace of the incoming prop. */
propname = name->name;
else
- return dav_svn__new_error(db->p, HTTP_CONFLICT, 0,
+ return dav_svn__new_error(db->p, HTTP_CONFLICT, 0, 0,
"Properties may only be defined in the "
SVN_DAV_PROP_NS_SVN " and "
SVN_DAV_PROP_NS_CUSTOM " namespaces.");
@@ -328,7 +328,7 @@ db_open(apr_pool_t *p,
changing unversioned rev props. Remove this someday: see IZ #916. */
if (! (resource->baselined
&& resource->type == DAV_RESOURCE_TYPE_VERSION))
- return dav_svn__new_error(p, HTTP_CONFLICT, 0,
+ return dav_svn__new_error(p, HTTP_CONFLICT, 0, 0,
"Properties may only be changed on working "
"resources.");
}
@@ -479,7 +479,7 @@ decode_property_value(const svn_string_t
*out_propval_p = svn_base64_decode_string(maybe_encoded_propval,
pool);
else
- return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
"Unknown property encoding");
break;
}
@@ -526,7 +526,7 @@ db_store(dav_db *db,
if (absent && ! elem->first_child)
/* ### better error check */
- return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
apr_psprintf(pool,
"'%s' cannot be specified on the "
"value without specifying an "
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/lock.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/lock.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/lock.c Fri Sep 11 15:51:30 2015
@@ -147,7 +147,7 @@ unescape_xml(const char **output,
errbuf[0] = '\0';
(void)apr_xml_parser_geterror(xml_parser, errbuf, sizeof(errbuf));
return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR,
- DAV_ERR_LOCK_SAVE_LOCK, errbuf);
+ DAV_ERR_LOCK_SAVE_LOCK, apr_err, errbuf);
}
apr_xml_to_text(pool, xml_doc->root, APR_XML_X2T_INNER,
@@ -170,12 +170,12 @@ dav_lock_to_svn_lock(svn_lock_t **slock,
/* Sanity checks */
if (dlock->type != DAV_LOCKTYPE_WRITE)
return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Only 'write' locks are supported.");
if (dlock->scope != DAV_LOCKSCOPE_EXCLUSIVE)
return dav_svn__new_error(pool, HTTP_BAD_REQUEST,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Only exclusive locks are supported.");
lock = svn_lock_create(pool);
@@ -470,7 +470,7 @@ get_locks(dav_lockdb *lockdb,
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
serr = svn_fs_get_lock(&slock,
@@ -531,7 +531,7 @@ find_lock(dav_lockdb *lockdb,
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
serr = svn_fs_get_lock(&slock,
@@ -548,7 +548,7 @@ find_lock(dav_lockdb *lockdb,
/* Sanity check. */
if (strcmp(locktoken->uuid_str, slock->token) != 0)
return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Incoming token doesn't match existing "
"lock.");
@@ -612,7 +612,7 @@ has_locks(dav_lockdb *lockdb, const dav_
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
serr = svn_fs_get_lock(&slock,
@@ -655,13 +655,13 @@ append_locks(dav_lockdb *lockdb,
/* We don't allow anonymous locks */
if (! repos->username)
return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Anonymous lock creation is not allowed.");
/* Not a path in the repository so can't lock it. */
if (! resource->info->repos_path)
return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Attempted to lock path not in repository.");
/* If the resource's fs path is unreadable, we don't allow a lock to
@@ -669,12 +669,12 @@ append_locks(dav_lockdb *lockdb,
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
if (lock->next)
return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Tried to attach multiple locks to a resource.");
/* RFC2518bis (section 7.4) doesn't require us to support
@@ -693,13 +693,13 @@ append_locks(dav_lockdb *lockdb,
if (resource->info->repos->is_svn_client)
return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Subversion clients may not lock "
"nonexistent paths.");
else if (! resource->info->repos->autoversioning)
return dav_svn__new_error(resource->pool, HTTP_METHOD_NOT_ALLOWED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Attempted to lock non-existent path; "
"turn on autoversioning first.");
@@ -755,7 +755,7 @@ append_locks(dav_lockdb *lockdb,
else
return dav_svn__new_error(resource->pool,
HTTP_INTERNAL_SERVER_ERROR,
- 0,
+ 0, 0,
"Commit failed but there was no error "
"provided.");
}
@@ -784,7 +784,7 @@ append_locks(dav_lockdb *lockdb,
{
svn_error_clear(serr);
return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Anonymous lock creation is not allowed.");
}
else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED)
@@ -881,7 +881,7 @@ remove_lock(dav_lockdb *lockdb,
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
if (locktoken == NULL)
@@ -918,7 +918,7 @@ remove_lock(dav_lockdb *lockdb,
{
svn_error_clear(serr);
return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Anonymous lock removal is not allowed.");
}
else if (serr && serr->apr_err == SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED
@@ -1014,7 +1014,7 @@ refresh_locks(dav_lockdb *lockdb,
if (! dav_svn__allow_read_resource(resource, SVN_INVALID_REVNUM,
resource->pool))
return dav_svn__new_error(resource->pool, HTTP_FORBIDDEN,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Path is not accessible.");
/* Convert the path into an svn_lock_t. */
@@ -1032,7 +1032,7 @@ refresh_locks(dav_lockdb *lockdb,
if ((! slock)
|| (strcmp(token->uuid_str, slock->token) != 0))
return dav_svn__new_error(resource->pool, HTTP_PRECONDITION_FAILED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Lock refresh request doesn't match existing "
"lock.");
@@ -1053,7 +1053,7 @@ refresh_locks(dav_lockdb *lockdb,
{
svn_error_clear(serr);
return dav_svn__new_error(resource->pool, HTTP_NOT_IMPLEMENTED,
- DAV_ERR_LOCK_SAVE_LOCK,
+ DAV_ERR_LOCK_SAVE_LOCK, 0,
"Anonymous lock refreshing is not allowed.");
}
else if (serr && (svn_error_find_cause(serr, SVN_ERR_REPOS_HOOK_FAILURE) ||
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/merge.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/merge.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/merge.c Fri Sep 11 15:51:30 2015
@@ -307,7 +307,8 @@ dav_svn__merge_response(ap_filter_t *out
"<D:version-name>", rev, "</D:version-name>" DEBUG_CR,
NULL);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
if (creationdate)
@@ -318,7 +319,8 @@ dav_svn__merge_response(ap_filter_t *out
"</D:creationdate>" DEBUG_CR,
NULL);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
}
if (creator_displayname)
@@ -330,7 +332,8 @@ dav_svn__merge_response(ap_filter_t *out
"</D:creator-displayname>" DEBUG_CR,
NULL);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
}
status = ap_fputstrs(output, bb,
@@ -341,7 +344,8 @@ dav_svn__merge_response(ap_filter_t *out
NULL);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
/* ONLY have dir_delta drive the editor if the caller asked us to
@@ -375,13 +379,15 @@ dav_svn__merge_response(ap_filter_t *out
"</D:updated-set>" DEBUG_CR
"</D:merge-response>" DEBUG_CR);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
/* send whatever is left in the brigade */
status = ap_pass_brigade(output, bb);
if (status != APR_SUCCESS)
- return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(repos->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, status,
"Could not write output");
return NULL;
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/dated-rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/dated-rev.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/dated-rev.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/dated-rev.c Fri Sep 11 15:51:30 2015
@@ -80,7 +80,7 @@ dav_svn__dated_rev_report(const dav_reso
if (tm == (apr_time_t) -1)
{
- return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"The request does not contain a valid "
"'DAV:" SVN_DAV__CREATIONDATE "' element.");
}
@@ -90,7 +90,8 @@ dav_svn__dated_rev_report(const dav_reso
resource->pool)) != SVN_NO_ERROR)
{
svn_error_clear(err);
- return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, 0,
"Could not access revision times.");
}
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/deleted-rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/deleted-rev.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/deleted-rev.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/deleted-rev.c Fri Sep 11 15:51:30 2015
@@ -57,11 +57,11 @@ dav_svn__get_deleted_rev_report(const da
/* Sanity check. */
if (!resource->info->repos_path)
- return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"The request does not specify a repository path");
ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
if (ns == -1)
- return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"The request does not contain the 'svn:' "
"namespace, so it is not going to have "
"certain required elements");
@@ -102,7 +102,7 @@ dav_svn__get_deleted_rev_report(const da
&& SVN_IS_VALID_REVNUM(peg_rev)
&& SVN_IS_VALID_REVNUM(end_rev)))
{
- return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"Not all parameters passed");
}
@@ -113,7 +113,8 @@ dav_svn__get_deleted_rev_report(const da
if (err)
{
svn_error_clear(err);
- return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_svn__new_error(resource->pool, HTTP_INTERNAL_SERVER_ERROR,
+ 0, 0,
"Could not find revision path was deleted.");
}
Modified: subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/file-revs.c
URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/file-revs.c?rev=1702504&r1=1702503&r2=1702504&view=diff
==============================================================================
--- subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/file-revs.c (original)
+++ subversion/branches/reuse-ra-session/subversion/mod_dav_svn/reports/file-revs.c Fri Sep 11 15:51:30 2015
@@ -255,14 +255,14 @@ dav_svn__file_revs_report(const dav_reso
/* Sanity check. */
if (!resource->info->repos_path)
- return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"The request does not specify a repository path");
ns = dav_svn__find_ns(doc->namespaces, SVN_XML_NAMESPACE);
/* ### This is done on other places, but the document element is
in this namespace, so is this necessary at all? */
if (ns == -1)
{
- return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"The request does not contain the 'svn:' "
"namespace, so it is not going to have "
"certain required elements");
@@ -300,7 +300,7 @@ dav_svn__file_revs_report(const dav_reso
/* Check that all parameters are present and valid. */
if (! abs_path)
- return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0,
+ return dav_svn__new_error_svn(resource->pool, HTTP_BAD_REQUEST, 0, 0,
"Not all parameters passed");
frb.bb = apr_brigade_create(resource->pool,