You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/03/28 15:12:56 UTC

svn commit: r1306303 - in /subversion/branches/1.7.x-r1306111: ./ subversion/libsvn_ra_svn/client.c subversion/svnserve/serve.c

Author: danielsh
Date: Wed Mar 28 13:12:56 2012
New Revision: 1306303

URL: http://svn.apache.org/viewvc?rev=1306303&view=rev
Log:
Backport r1306111, reimplementing the serve.c part.

Modified:
    subversion/branches/1.7.x-r1306111/   (props changed)
    subversion/branches/1.7.x-r1306111/subversion/libsvn_ra_svn/client.c
    subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c

Propchange: subversion/branches/1.7.x-r1306111/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1306111

Modified: subversion/branches/1.7.x-r1306111/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1306111/subversion/libsvn_ra_svn/client.c?rev=1306303&r1=1306302&r2=1306303&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1306111/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/1.7.x-r1306111/subversion/libsvn_ra_svn/client.c Wed Mar 28 13:12:56 2012
@@ -1152,7 +1152,18 @@ static svn_error_t *ra_svn_get_dir(svn_r
       dirent->size = size;/* FIXME: svn_filesize_t */
       dirent->has_props = has_props;
       dirent->created_rev = crev;
-      SVN_ERR(svn_time_from_cstring(&dirent->time, cdate, pool));
+      /* NOTE: the tuple's format string says CDATE may be NULL. But this
+         function does not allow that. The server has always sent us some
+         random date, however, so this just happens to work. But let's
+         be wary of servers that are (improperly) fixed to send NULL.
+
+         Note: they should NOT be "fixed" to send NULL, as that would break
+         any older clients which received that NULL. But we may as well
+         be defensive against a malicous server.  */
+      if (cdate == NULL)
+        dirent->time = 0;
+      else
+        SVN_ERR(svn_time_from_cstring(&dirent->time, cdate, pool));
       dirent->last_author = cauthor;
       apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, dirent);
     }

Modified: subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c?rev=1306303&r1=1306302&r2=1306303&view=diff
==============================================================================
--- subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c (original)
+++ subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c Wed Mar 28 13:12:56 2012
@@ -1623,10 +1623,16 @@ static svn_error_t *get_dir(svn_ra_svn_c
     {
       for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
         {
+          static const char *missing_date = svn_time_to_cstring(0, pool);
           const char *name = svn__apr_hash_index_key(hi);
           svn_dirent_t *entry = svn__apr_hash_index_val(hi);
 
-          cdate = (entry->time == (time_t) -1) ? NULL
+          /* The client does not properly handle a missing CDATE. For                              
+             interoperability purposes, we must fill in some junk.                                 
+                                                                                                   
+             See libsvn_ra_svn/client.c:ra_svn_get_dir()  */                                       
+          cdate = (entry->time == (time_t) -1)
+            ? missing_date
             : svn_time_to_cstring(entry->time, pool);
           SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "cwnbr(?c)(?c)", name,
                                          svn_node_kind_to_word(entry->kind),



Re: svn commit: r1306303 - in /subversion/branches/1.7.x-r1306111: ./ subversion/libsvn_ra_svn/client.c subversion/svnserve/serve.c

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Mar 28, 2012 at 09:12,  <da...@apache.org> wrote:
>...
> +++ subversion/branches/1.7.x-r1306111/subversion/svnserve/serve.c Wed Mar 28 13:12:56 2012
> @@ -1623,10 +1623,16 @@ static svn_error_t *get_dir(svn_ra_svn_c
>     {
>       for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
>         {
> +          static const char *missing_date = svn_time_to_cstring(0, pool);

static mixed with pool probably isn't going to work well :-P ... how
about moving that up a couple lines to the scope enclosing the "for",
and dropping the static qualifier?

>...

Thanks,
-g