[PATCH jn/svn-fe-maint 0/2] intermittent repo_tree corruption
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Dec 5, 2010, 09:33 UTC
- Message-ID
- <20101205093357.GD4332@burratino>
- In-Reply-To
- <20101130194833.GA9064@burratino>
[mailer usage fail. resending to git@vger; sorry for the noise]
Hi David,
Jonathan Nieder wrote:
> Jonathan Nieder wrote:
Show 7 quoted lines
>> +++ b/vcs-svn/svndump.c
>> @@ -181,12 +181,22 @@ static void handle_node(void)
> [...]
>> + if (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)
>> + die("invalid dump: cannot modify a directory into a file");
>
> This is tripping for me in a revision like so:[...]
> Node-path: lxanew/DCNsnetwork.cpp > Node-kind: file > Node-action: add
[...]
> DCNsnetwork.cpp was added in r688, which looks like so:
[...]
> Node-path: DCNsnetwork.cpp > Node-kind: file > Node-action: add
This is a bad one. Currently, repo_copy builds new nodes for all directories containing the destination directory, like so:
for each path component: find that node, creating if missing make sure it is in the active commit (cloning if not) set mode to MODE_DIR and set up the next iteration to look there. set mode and content based on source path
Unfortunately the "create if missing" and "make sure it is the active commit" steps call realloc without updating the corresponding pointers.
svn-fe2 (as contained in git 1.7.3) and svn-fe3 are both affected, presumably. Probably existing testing missed this because the repo_tree pool quickly grows large enough that glibc allocates with mmap(), with little need to change addresses within a huge 64-bit address space.
Jonathan Nieder (2): treap: make treap_insert return inserted node vcs-svn: fix intermittent repo_tree corruption
test-treap.c | 11 ++++++++--- vcs-svn/repo_tree.c | 4 ++-- vcs-svn/trp.h | 3 ++- vcs-svn/trp.txt | 10 ++++++++-- 4 files changed, 20 insertions(+), 8 deletions(-)
-- 1.7.2.4