Index: subversion/libsvn_ra_neon/commit.c =================================================================== --- subversion/libsvn_ra_neon/commit.c (revision 37906) +++ subversion/libsvn_ra_neon/commit.c (working copy) @@ -1177,6 +1177,7 @@ resource_baton_t *file = file_baton; put_baton_t *baton; svn_stream_t *stream; + const char *tempfile_name; baton = apr_pcalloc(file->pool, sizeof(*baton)); baton->ras = file->cc->ras; @@ -1195,10 +1196,31 @@ /* Create a temp file in the system area to hold the contents. Note that we need a file since we will be rewinding it. The file will be closed and deleted when the pool is cleaned up. */ - SVN_ERR(svn_io_open_unique_file3(&baton->tmpfile, NULL, NULL, - svn_io_file_del_on_pool_cleanup, - file->pool, pool)); + /* Avoid temp file name collisions by requesting unique temp file name + based on BASE_CHECKSUM or (for newly added paths) the checksum of + FILE->RSRC->LOCAL_PATH. */ + if (base_checksum) + { + tempfile_name = base_checksum; + } + else + { + svn_checksum_t *checksum; + SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, + file->rsrc->local_path, + strlen(file->rsrc->local_path), + pool)); + tempfile_name = apr_psprintf(pool, "tempfile.%s", + svn_checksum_to_cstring_display(checksum, + pool)); + } + + SVN_ERR(svn_io_open_uniquely_named(&baton->tmpfile, NULL, NULL, + tempfile_name, ".tmp", + svn_io_file_del_on_pool_cleanup, + file->pool, pool)); + stream = svn_stream_create(baton, pool); svn_stream_set_write(stream, commit_stream_write); Index: subversion/libsvn_ra_serf/commit.c =================================================================== --- subversion/libsvn_ra_serf/commit.c (revision 37906) +++ subversion/libsvn_ra_serf/commit.c (working copy) @@ -1743,7 +1743,9 @@ file_context_t *ctx = file_baton; const svn_ra_callbacks2_t *wc_callbacks; void *wc_callback_baton; + const char *tempfile_name; + /* Store the stream in a temporary file; we'll give it to serf when we * close this file. * @@ -1755,10 +1757,28 @@ wc_callbacks = ctx->commit->session->wc_callbacks; wc_callback_baton = ctx->commit->session->wc_callback_baton; - SVN_ERR(svn_io_open_unique_file3(&ctx->svndiff, NULL, NULL, - svn_io_file_del_on_pool_cleanup, - ctx->pool, ctx->pool)); + /* Avoid temp file name collisions by requesting unique temp file name + based on BASE_CHECKSUM or (for newly added paths) the checksum of + CTX->NAME. */ + if (base_checksum) + { + tempfile_name = base_checksum; + } + else + { + svn_checksum_t *checksum; + SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, + ctx->name, strlen(ctx->name), ctx->pool)); + tempfile_name = apr_psprintf(ctx->pool, "tempfile.%s", + svn_checksum_to_cstring_display(checksum, + ctx->pool)); + } + SVN_ERR(svn_io_open_uniquely_named(&ctx->svndiff, NULL, NULL, + tempfile_name, ".tmp", + svn_io_file_del_on_pool_cleanup, + ctx->pool, ctx->pool)); + ctx->stream = svn_stream_create(ctx, pool); svn_stream_set_write(ctx->stream, svndiff_stream_write);