Author: rhuijben
Date: Tue Feb 3 12:50:10 2015
New Revision: 1656713
URL: http://svn.apache.org/r1656713
Log:
Resolve a hang in svnserve<->libsvn_ra_svn communication when calling
svn_ra_get_dir2() on a non existing target without obtaining its properties.
* subversion/svnserve/serve.c
(get_dir): Fetch entries before starting the response, to allow sending
errors that occured when fetching entries.
Found by: schabi
Reproducable by:
{
apr_hash_t *tmp;
SVN_ERR(svn_ra_get_dir2(ra_session, &tmp, NULL, NULL,
"non/existing/subdir", 1, SVN_DIRENT_KIND, pool));
}
which is not easy to integrate in our test suite.
Modified:
subversion/trunk/subversion/svnserve/serve.c
Modified: subversion/trunk/subversion/svnserve/serve.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1656713&r1=1656712&r2=1656713&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Tue Feb 3 12:50:10 2015
@@ -1725,6 +1725,11 @@ static svn_error_t *get_dir(svn_ra_svn_c
&ab, root, full_path,
pool));
+ /* Fetch the directories' entries before starting the response, to allow
+ proper error handling in cases like when FULL_PATH doesn't exist */
+ if (want_contents)
+ SVN_CMD_ERR(svn_fs_dir_entries(&entries, root, full_path, pool));
+
/* Begin response ... */
SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(r(!", "success", rev));
SVN_ERR(svn_ra_svn__write_proplist(conn, pool, props));
@@ -1736,8 +1741,6 @@ static svn_error_t *get_dir(svn_ra_svn_c
/* Use epoch for a placeholder for a missing date. */
const char *missing_date = svn_time_to_cstring(0, pool);
- SVN_CMD_ERR(svn_fs_dir_entries(&entries, root, full_path, pool));
-
/* Transform the hash table's FS entries into dirents. This probably
* belongs in libsvn_repos. */
subpool = svn_pool_create(pool);