git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-svn: avoid crashing svnserve when creating new directories

From
EWEric Wong <normalperson@yhbt.net>
Date
May 19, 2007, 09:58 UTC
Message-ID
<20070519095837.GA387@muzzle>
In-Reply-To
<20070519061422.GA17528@muzzle>

When sorting directory names by depth (slash ("/") count) and closing the deepest directories first (as the protocol requires), we failed to put the root baton (with an empty string as its key "") after top-level directories (which did not have any slashes).

This resulted in svnserve being in a situation it couldn't handle and caused a segmentation fault on the remote server.

This bug did not affect users of DAV and filesystem repositories.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e38811a..6d0cdac 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2841,8 +2841,10 @@ sub close_edit {
 	my ($self) = @_;
 	my ($p,$bat) = ($self->{pool}, $self->{bat});
 	foreach (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$bat) {
+		next if $_ eq '';
 		$self->close_directory($bat->{$_}, $p);
 	}
+	$self->close_directory($bat->{''}, $p);
 	$self->SUPER::close_edit($p);
 	$p->clear;
 }
-- 
Eric Wong
Previous: Eric WongNext: Matthieu Moy
Message 7 of 18 in “[BUG] git-svn dcommit fails (connection closed unexpectedly)”
  1. Matthieu MoyMay 11, 2007
  2. Lars HjemliMay 11, 2007
  3. Lars HjemliMay 11, 2007
  4. Matthieu MoyMay 11, 2007
  5. Matthieu MoyMay 14, 2007
  6. Eric WongMay 19, 2007
  7. git-svn: avoid crashing svnserve when creating new directoriesEric Wong, May 19, 2007
  8. Matthieu MoyMay 19, 2007
  9. Eric WongMay 19, 2007
  10. Matthieu MoyMay 19, 2007
  11. Eric WongMay 13, 2007
  12. Martin EisenhardtMay 13, 2007
  13. Karl HasselströmMay 13, 2007
  14. Eric WongMay 13, 2007
  15. Eric WongMay 14, 2007
  16. Linus TorvaldsMay 14, 2007
  17. Matthieu MoyMay 14, 2007
  18. Matthieu MoyMay 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.