You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kevin Pilch-Bisson <ke...@pilch-bisson.net> on 2001/03/29 14:46:37 UTC

segfault on commit

Here is what I did:

svnadmin create repos
svn co file:///home/kevin/projects/svn-test/repos -d wc-local
cd wc-local
echo "blah" > foo
svn add foo
svn ci

And I get a segfault:

some gdb output
Program received signal SIGSEGV, Segmentation fault.
0x4025d796 in decrement_dir_ref_count (db=0x0)
    at ../../../subversion/subversion/libsvn_fs/editor.c:89
89        db->ref_count--;

and a backtrace:
#0  0x4025d796 in decrement_dir_ref_count (db=0x0)
    at ../../../subversion/subversion/libsvn_fs/editor.c:89
#1  0x4025d7cc in decrement_dir_ref_count (db=0x8072434)
	at ../../../subversion/subversion/libsvn_fs/editor.c:102
#2  0x4025dd6f in close_file (file_baton=0x8074444)
	at ../../../subversion/subversion/libsvn_fs/editor.c:293
#3  0x400a524e in close_file (file_baton=0x8058084)
	at ../../../subversion/subversion/libsvn_delta/compose_editors.c:201
#4  0x400a524e in close_file (file_baton=0x8052254)
	at ../../../subversion/subversion/libsvn_delta/compose_editors.c:201
#5  0x4008c382 in do_postfix_text_deltas (affected_targets=0x8051fd4, editor=0x8051f9c, 
	pool=0x805171c) at ../../../subversion/subversion/libsvn_wc/adm_crawler.c:413
#6  0x4008d268 in svn_wc_crawl_local_mods (root_directory=0x805188c, edit_fns=0x8051f9c, 
	edit_baton=0x8051f84, pool=0x805171c)
	at ../../../subversion/subversion/libsvn_wc/adm_crawler.c:1071
#7  0x40019b65 in send_to_repos (before_editor=0x0, before_edit_baton=0x0, after_editor=0x80518ac, 
	after_edit_baton=0x80518a4, path=0x805188c, url=0x8051c1c, new_entry=0x0, log_msg=0x8051e2c, 
	xml_dst=0x0, revision=-1, pool=0x805171c)
	at ../../../subversion/subversion/libsvn_client/commit.c:483
#8  0x40019cd4 in svn_client_commit (before_editor=0x0, before_edit_baton=0x0,
	after_editor=0x80518ac, after_edit_baton=0x80518a4, path=0x805188c, log_msg=0x0, xml_dst=0x0,
	revision=-1, pool=0x805171c) at ../../../subversion/subversion/libsvn_client/commit.c:541
#9  0x8049a8d in svn_cl__commit (os=0x805181c, opt_state=0xbffffa60, pool=0x805171c)
	at ../../../subversion/subversion/client/commit-cmd.c:64
#10 0x80495a7 in main (argc=2, argv=0xbffffb04)
	at ../../../subversion/subversion/client/main.c:255

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson                    http://www.pilch-bisson.net
     "Historically speaking, the presences of wheels in Unix
     has never precluded their reinvention." - Larry Wall
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Re: segfault on commit

Posted by Ben Collins-Sussman <su...@newton.ch.collab.net>.
Daniel Stenberg <da...@haxx.se> writes:
 
> decrement_dir_ref_count() never checks the input for NULL and it will call
> itself until it crashes.
> 

Doh!  Thanks.  My brain-o... I forgot that the root dir_baton has no
parent.  :)

Re: segfault on commit

Posted by Daniel Stenberg <da...@haxx.se>.
On Thu, 29 Mar 2001, Kevin Pilch-Bisson wrote:

> Program received signal SIGSEGV, Segmentation fault.
> 0x4025d796 in decrement_dir_ref_count (db=0x0)
>     at ../../../subversion/subversion/libsvn_fs/editor.c:89
> 89        db->ref_count--;

decrement_dir_ref_count() never checks the input for NULL and it will call
itself until it crashes.

Something like this might do:

RCS file: /cvs/subversion/subversion/libsvn_fs/editor.c,v
retrieving revision 1.32
diff -u -r1.32 editor.c
--- editor.c    2001/03/28 21:50:30     1.32
+++ editor.c    2001/03/29 14:56:58
@@ -86,6 +86,11 @@
 static svn_error_t *
 decrement_dir_ref_count (struct dir_baton *db)
 {
+  if (db == NULL)
+    {
+      return SVN_NO_ERROR;
+    }
+
   db->ref_count--;

   /* Check to see if *any* child batons still depend on this


-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol