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

[PATCH] Fixing crash when deleting wc prop via update

From: Yoshiki Hayashi <yoshiki_at_xemacs.org>
Date: 2002-01-23 11:48:26 CET

I looked Karl's comment on issue 597 (which is svn up -r 278
segfaults) and looked the backtrace. I think the problem of
segfault is different than original issue, so I'm posting
patch to here. (Should I reply to issuezilla instead?)

The backtrace is

#0 0x40147735 in svn_string_create_from_buf (strbuf=0x0, pool=0x80e3840)
    at subversion/libsvn_subr/svn_string.c:99
99 return svn_string_ncreate (strbuf->data, strbuf->len, pool);
(gdb) bt
#0 0x40147735 in svn_string_create_from_buf (strbuf=0x0, pool=0x80e3840)
    at subversion/libsvn_subr/svn_string.c:99
#1 0x4002b169 in change_dir_prop (dir_baton=0x80e3958, name=0x8077238,
    value=0x0) at subversion/libsvn_wc/get_editor.c:732
#2 0x400b6430 in change_dir_prop (dir_baton=0x8077f10, name=0x8077238,
    value=0x0) at subversion/libsvn_delta/compose_editors.c:401

The problem is, change_dir_prop always tries to create
svn_string_t even when local_value is NULL (which means
deleting property). Here's the patch to fix it.

It looks like test cases aren't covering this case.

* get_editor.c (change_dir_prop): When local_value is NULL,
  simply set propchange->value to NULL.

Index: ./subversion/libsvn_wc/get_editor.c
===================================================================
--- ./subversion/libsvn_wc/get_editor.c
+++ ./subversion/libsvn_wc/get_editor.c Wed Jan 23 19:32:32 2002
@@ -729,7 +729,10 @@
   /* Push a new propchange to the directory baton's array of propchanges */
   propchange = apr_array_push (db->propchanges);
   propchange->name = local_name->data;
- propchange->value = svn_string_create_from_buf (local_value, db->pool);
+ if (local_value)
+ propchange->value = svn_string_create_from_buf (local_value, db->pool);
+ else
+ propchange->value = NULL;
 
   /* Let close_dir() know that propchanges are waiting to be
      applied. */

-- 
Yoshiki Hayashi
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:58 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.