Hi,
I was following the git core tutorial and git-read-tree got me segfault.
I accidentaly executed the git-read-tree without "-m -u" options and
got segfault.
I can reproduce with the latest git using following script.
-----------------------------------------------
#!/bin/sh
GIT=$1
rm -rf crash; mkdir -p crash; cd crash
$GIT init
echo "xxx" > xxx
$GIT add xxx
$GIT commit -m "xxx"
$GIT checkout -b yyy
echo "yyy" > yyy
$GIT add yyy
$GIT commit -m "yyy"
echo "yyy1" >> yyy
$GIT commit -a -m "yyy1"
$GIT checkout master
echo "xxx1" >> xxx
$GIT commit -a -m "xxx1"
mb=$($GIT merge-base HEAD yyy)
$GIT read-tree $mb HEAD yyy
-----------------------------------------------
regards,
jirka
Hi,
On Tue, 10 Mar 2009, Jiri Olsa wrote:
Hi,
I was following the git core tutorial and git-read-tree got me segfault.
I accidentaly executed the git-read-tree without "-m -u" options and
got segfault.
I can reproduce with the latest git using following script.
I can reproduce with the script, too...
Working on it,
Dscho
Hi,
On Tue, 10 Mar 2009, Jiri Olsa wrote:
mb=$($GIT merge-base HEAD yyy)
$GIT read-tree $mb HEAD yyy
While I agree that it is a bad thing for Git to segfault, I think this
here is a pilot error. You try to read 3 trees at the same time, but not
perform a merge. IMHO you want to add -m at least.
Ciao,
Dscho
On Tue, Mar 10, 2009 at 9:21 PM, Johannes Schindelin
[off-list ref] wrote:
Hi,
On Tue, 10 Mar 2009, Jiri Olsa wrote:
quoted
mb=$($GIT merge-base HEAD yyy)
$GIT read-tree $mb HEAD yyy
While I agree that it is a bad thing for Git to segfault, I think this
here is a pilot error. You try to read 3 trees at the same time, but not
perform a merge. IMHO you want to add -m at least.
agreed, I've already said I executed it like this by an accident...
it was easy to recreate so I shared... I'm not saying it is a show stopper :)
jirka
Ciao,
Dscho
Hi,
On Wed, 11 Mar 2009, Jiri Olsa wrote:
On Tue, Mar 10, 2009 at 9:21 PM, Johannes Schindelin
[off-list ref] wrote:
quoted
On Tue, 10 Mar 2009, Jiri Olsa wrote:
quoted
mb=$($GIT merge-base HEAD yyy)
$GIT read-tree $mb HEAD yyy
While I agree that it is a bad thing for Git to segfault, I think this
here is a pilot error. You try to read 3 trees at the same time, but
not perform a merge. IMHO you want to add -m at least.
agreed, I've already said I executed it like this by an accident...
Hey, you did the right thing! And you even provided a script to recreate,
so that it was really easy to see what is happening.
it was easy to recreate so I shared... I'm not saying it is a show
stopper :)
Well, Git should not crash. But read-tree is real low-level, so I am
torn. OTOH, something like this may be the correct thing to do:
-- snipsnap --
Subject: [PATCH] Make read-tree with multiple trees imply -m
Noticed by Jiri Olsa.
Signed-off-by: Johannes Schindelin <redacted>
---
builtin-read-tree.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 8e02738..547ac25 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -221,6 +221,11 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
opts.head_idx = 1;
}
+ if (nr_trees > 1 && !o->merge) {
+ warning("Assuming -m with multiple trees");
+ o->merge = 1;
+ }
+
for (i = 0; i < nr_trees; i++) {
struct tree *tree = trees[i];
parse_tree(tree);