[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Regression in dirent_walker with malformed DAV responses

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 03 Nov 2014 11:12:00 +0000

James McCoy <jamessan_at_debian.org> writes:

> HTTP/1.1 207 Multi-Status
> Date: Sat, 01 Nov 2014 03:59:48 GMT
> Server: Oracle-Application-Server-11g
> Content-Length: 670
> Content-Type: text/xml; charset="utf-8"
> Content-Language: en
>
> <?xml version="1.0" encoding="utf-8"?>
> <D:multistatus xmlns:D="DAV:" xmlns:ns1="http://subversion.tigris.org/xmlns/dav/" xmlns:ns0="DAV:">
> <D:response xmlns:lp1="DAV:" xmlns:lp2="http://subversion.tigris.org/xmlns/dav/">
> <D:href>/svn/vbox/!svn/bc/53112/trunk/COPYING</D:href>
> <D:propstat>
> <D:prop>
> <lp1:resourcetype/>
> <lp1:getcontentlength>%ld</lp1:getcontentlength>

I wonder how the server generated that? In our code it is generated in
liveprops.c:insert_prop_internal

      value = apr_psprintf(scratch_pool, "%" SVN_FILESIZE_T_FMT, len);

where SVN_FILESIZE_T_FMT is a format specifier such as "ld". If the
Solaris port has defined SVN_FILESIZE_T_FMT as "%ld", rather than "ld",
the resulting format string would be "%%ld" and would lead to the ouput
shown above. The difficulty here is that breaking the DAV code like
that would also break the FSFS backend code and the repositories would
not work. Perhaps this server isn't using our code?

The patch below makes the client more lenient. Do people think the
client should be working around server bugs like this?

Index: subversion/libsvn_ra_serf/stat.c
===================================================================
--- subversion/libsvn_ra_serf/stat.c (revision 1635524)
+++ subversion/libsvn_ra_serf/stat.c (working copy)
@@ -185,7 +185,15 @@ dirent_walker(void *baton,
           /* 'getcontentlength' property is empty for directories. */
           if (val->len)
             {
- SVN_ERR(svn_cstring_atoi64(&dwb->entry->size, val->data));
+ svn_error_t *err = svn_cstring_atoi64(&dwb->entry->size,
+ val->data);
+ if (err)
+ {
+ /* There have been servers that send a literal "%ld"
+ rather than a value: https://bugs.debian.org/767530 */
+ svn_error_clear(err);
+ dwb->entry->size = 0;
+ }
             }
         }
       else if (strcmp(name, "resourcetype") == 0)

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2014-11-03 12:13:21 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.