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

Re: [PATCH][merge-tracking]Data loss due to line buffered SAX stream on mergeinfo retrieval.

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-11-20 18:56:44 CET

Found one small issue with this patch and fixed the same.

Attaching the new patch and log.

With regards
Kamesh Jayachandran
Kamesh Jayachandran wrote:
> Hi All,
> Find the patch and log.
>
> You could see this issue with url to url copy over ra_dav if source of
> copy is having multiple mergeinfos.
>
>
> With regards
> Kamesh Jayachandran
> ------------------------------------------------------------------------
>
> [[[
> Data loss due to line buffered SAX stream on cdata_handler.
>
> * subversion/libsvn_ra_dav/mergeinfo.c
> (cdata_handler):
> This function is called for each line in the data for a given tag
> and hence we need to concatenate the current data with the
> previously accumulated data.
>
> Patch by: Kamesh Jayachandran <kamesh@collab.net>
> ]]]
>
> ------------------------------------------------------------------------
>
> Index: subversion/libsvn_ra_dav/mergeinfo.c
> ===================================================================
> --- subversion/libsvn_ra_dav/mergeinfo.c (revision 22315)
> +++ subversion/libsvn_ra_dav/mergeinfo.c (working copy)
> @@ -127,6 +127,8 @@
> {
> struct mergeinfo_baton *mb = baton;
> apr_size_t nlen = len;
> + char tmpc;
> + char *mutable_cdata = (char*)cdata;
>
> switch (state)
> {
> @@ -134,7 +136,13 @@
> mb->curr_path = apr_pstrndup(mb->pool, cdata, nlen);
> break;
> case ELEM_merge_info_info:
> - mb->curr_info = apr_pstrndup(mb->pool, cdata, nlen);
> + /* if the data is having multiple lines we need to concatenate the
> + * current data with the previous one.
> + */
> + tmpc = mutable_cdata[nlen];
> + mutable_cdata[len]='\0';
> + mb->curr_info = apr_pstrcat(mb->pool, mb->curr_info, cdata, NULL);
> + mutable_cdata[nlen] = tmpc;
> break;
> default:
> break;
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

[[[
Data loss due to line buffered SAX stream on cdata_handler.

* subversion/libsvn_ra_dav/mergeinfo.c
  (cdata_handler):
   This function is called for each line in the data for a given tag
   and hence we need to concatenate the current data with the
   previously accumulated data.

Patch by: Kamesh Jayachandran <kamesh@collab.net>
]]]

Index: subversion/libsvn_ra_dav/mergeinfo.c
===================================================================
--- subversion/libsvn_ra_dav/mergeinfo.c (revision 22315)
+++ subversion/libsvn_ra_dav/mergeinfo.c (working copy)
@@ -127,6 +127,8 @@
 {
   struct mergeinfo_baton *mb = baton;
   apr_size_t nlen = len;
+ char tmpc;
+ char *mutable_cdata = (char*)cdata;
 
   switch (state)
     {
@@ -134,7 +136,16 @@
       mb->curr_path = apr_pstrndup(mb->pool, cdata, nlen);
       break;
     case ELEM_merge_info_info:
- mb->curr_info = apr_pstrndup(mb->pool, cdata, nlen);
+ /* if the data is having multiple lines we need to concatenate the
+ * current data with the previous one.
+ */
+ tmpc = mutable_cdata[nlen];
+ mutable_cdata[len]='\0';
+ if (mb->curr_info)
+ mb->curr_info = apr_pstrcat(mb->pool, mb->curr_info, cdata, NULL);
+ else
+ mb->curr_info = apr_pstrdup(mb->pool, cdata);
+ mutable_cdata[nlen] = tmpc;
       break;
     default:
       break;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 20 18:58:15 2006

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.