* git stash apply segfaulting when called in subdir
@ 2007-07-25 21:23 Uwe Kleine-König
2007-07-25 22:28 ` Junio C Hamano
2007-07-25 22:32 ` Steven Walter
0 siblings, 2 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2007-07-25 21:23 UTC (permalink / raw)
To: Git Mailing List
Hello,
I did not do much testing and didn't look into the issue yet:
zeisberg@cassiopeia:/tmp$ mkdir repo; cd repo; git init
Initialized empty Git repository in .git/
zeisberg@cassiopeia:/tmp/repo$ mkdir dir; echo one > file; echo two > dir/file
zeisberg@cassiopeia:/tmp/repo$ git add file dir/file
zeisberg@cassiopeia:/tmp/repo$ git commit -m tralala
Created initial commit 265b7d7: tralala
2 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 dir/file
create mode 100644 file
zeisberg@cassiopeia:/tmp/repo$ echo three >> file
zeisberg@cassiopeia:/tmp/repo$ git stash
Saved "WIP on master: 265b7d7... tralala"
HEAD is now at 265b7d7... tralala
zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
/home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
Best regards
Uwe
--
Uwe Kleine-König
http://www.google.com/search?q=1+newton+in+kg*m+%2F+s%5E2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-25 21:23 git stash apply segfaulting when called in subdir Uwe Kleine-König
@ 2007-07-25 22:28 ` Junio C Hamano
2007-07-25 23:01 ` Johannes Schindelin
2007-07-26 5:07 ` Jeff King
2007-07-25 22:32 ` Steven Walter
1 sibling, 2 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-07-25 22:28 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Git Mailing List
Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> writes:
> zeisberg@cassiopeia:/tmp$ mkdir repo; cd repo; git init
> Initialized empty Git repository in .git/
>
> zeisberg@cassiopeia:/tmp/repo$ mkdir dir; echo one > file; echo two > dir/file
>
> zeisberg@cassiopeia:/tmp/repo$ git add file dir/file
>
> zeisberg@cassiopeia:/tmp/repo$ git commit -m tralala
> Created initial commit 265b7d7: tralala
> 2 files changed, 2 insertions(+), 0 deletions(-)
> create mode 100644 dir/file
> create mode 100644 file
>
> zeisberg@cassiopeia:/tmp/repo$ echo three >> file
>
> zeisberg@cassiopeia:/tmp/repo$ git stash
> Saved "WIP on master: 265b7d7... tralala"
> HEAD is now at 265b7d7... tralala
>
> zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
> error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
> /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
This probably is a merge-recursive bug, but in the meantime,
I think this should fix it.
---
git-stash.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index de13dd1..d9cd42d 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -6,6 +6,7 @@ USAGE='[ | list | show | apply | clear]'
SUBDIRECTORY_OK=Yes
. git-sh-setup
require_work_tree
+cd_to_toplevel
TMP="$GIT_DIR/.git-stash.$$"
trap 'rm -f "$TMP-*"' 0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-25 21:23 git stash apply segfaulting when called in subdir Uwe Kleine-König
2007-07-25 22:28 ` Junio C Hamano
@ 2007-07-25 22:32 ` Steven Walter
1 sibling, 0 replies; 7+ messages in thread
From: Steven Walter @ 2007-07-25 22:32 UTC (permalink / raw)
To: Uwe Kleine-König, Git Mailing List
On Wed, Jul 25, 2007 at 11:23:11PM +0200, Uwe Kleine-König wrote:
> zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
> error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
> /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
I've been seeing this, as well.
--
-Steven Walter <stevenrwalter@gmail.com>
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects."
-Robert Heinlein
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-25 22:28 ` Junio C Hamano
@ 2007-07-25 23:01 ` Johannes Schindelin
2007-07-26 5:07 ` Jeff King
1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-07-25 23:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Uwe Kleine-König, Git Mailing List
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2348 bytes --]
Hi,
On Wed, 25 Jul 2007, Junio C Hamano wrote:
> Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> writes:
>
> > zeisberg@cassiopeia:/tmp$ mkdir repo; cd repo; git init
> > Initialized empty Git repository in .git/
> >
> > zeisberg@cassiopeia:/tmp/repo$ mkdir dir; echo one > file; echo two > dir/file
> >
> > zeisberg@cassiopeia:/tmp/repo$ git add file dir/file
> >
> > zeisberg@cassiopeia:/tmp/repo$ git commit -m tralala
> > Created initial commit 265b7d7: tralala
> > 2 files changed, 2 insertions(+), 0 deletions(-)
> > create mode 100644 dir/file
> > create mode 100644 file
> >
> > zeisberg@cassiopeia:/tmp/repo$ echo three >> file
> >
> > zeisberg@cassiopeia:/tmp/repo$ git stash
> > Saved "WIP on master: 265b7d7... tralala"
> > HEAD is now at 265b7d7... tralala
> >
> > zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
> > error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
> > /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
>
> This probably is a merge-recursive bug, but in the meantime,
> I think this should fix it.
>
> ---
>
> git-stash.sh | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/git-stash.sh b/git-stash.sh
> index de13dd1..d9cd42d 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -6,6 +6,7 @@ USAGE='[ | list | show | apply | clear]'
> SUBDIRECTORY_OK=Yes
> . git-sh-setup
> require_work_tree
> +cd_to_toplevel
>
> TMP="$GIT_DIR/.git-stash.$$"
> trap 'rm -f "$TMP-*"' 0
It does... And here is a test case:
-- snipsnap --
[PATCH] Test "stash apply" in a subdirectory
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
t/t3903-stash.sh | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 392ac1c..9e363fd 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -66,4 +66,18 @@ test_expect_success 'apply stashed changes (including index)' '
test 1 = $(git show HEAD:file)
'
+test_expect_success 'apply in subdir' '
+ git --git-dir=new init &&
+ cd new &&
+ mkdir dir &&
+ echo one > file &&
+ echo two > dir/file &&
+ git add file dir/file &&
+ git commit -m first &&
+ echo three >> file &&
+ git stash &&
+ cd dir &&
+ git stash apply
+'
+
test_done
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-25 22:28 ` Junio C Hamano
2007-07-25 23:01 ` Johannes Schindelin
@ 2007-07-26 5:07 ` Jeff King
2007-07-26 5:40 ` Johannes Schindelin
1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2007-07-26 5:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Uwe Kleine-König, Git Mailing List
On Wed, Jul 25, 2007 at 03:28:12PM -0700, Junio C Hamano wrote:
> > zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
> > error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
> > /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
>
> This probably is a merge-recursive bug, but in the meantime,
> I think this should fix it.
The merge-recursive bug is simply a failure to check for invalid input.
Patch to at least print and die rather than segfault is below.
Technically the error could be from a tag dereference, too, so maybe the
error message should be more exact?
-- >8 --
merge-recursive: don't segfault on missing input objects
This should generally never happen, but it's nicer to report
an error than to segfault.
Signed-off-by: Jeff King <peff@peff.net>
---
merge-recursive.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index c8539ec..2764e61 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1692,6 +1692,8 @@ static struct commit *get_ref(const char *ref)
if (get_sha1(ref, sha1))
die("Could not resolve ref '%s'", ref);
object = deref_tag(parse_object(sha1), ref, strlen(ref));
+ if (!object)
+ die("Object does not exist: %s", ref);
if (object->type == OBJ_TREE)
return make_virtual_commit((struct tree*)object,
better_branch_name(ref));
--
1.5.3.rc3.818.gc1dc7-dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-26 5:07 ` Jeff King
@ 2007-07-26 5:40 ` Johannes Schindelin
2007-07-26 5:48 ` Jeff King
0 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2007-07-26 5:40 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Uwe Kleine-König, Git Mailing List
Hi,
On Thu, 26 Jul 2007, Jeff King wrote:
> On Wed, Jul 25, 2007 at 03:28:12PM -0700, Junio C Hamano wrote:
>
> > > zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply
> > > error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789'
> > > /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree
> >
> > This probably is a merge-recursive bug, but in the meantime,
> > I think this should fix it.
>
> The merge-recursive bug is simply a failure to check for invalid input.
No it is not.
The objects are there. But the objects cannot be found, since
merge-recursive cannot go to top level.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git stash apply segfaulting when called in subdir
2007-07-26 5:40 ` Johannes Schindelin
@ 2007-07-26 5:48 ` Jeff King
0 siblings, 0 replies; 7+ messages in thread
From: Jeff King @ 2007-07-26 5:48 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Junio C Hamano, Uwe Kleine-König, Git Mailing List
On Thu, Jul 26, 2007 at 06:40:44AM +0100, Johannes Schindelin wrote:
> > The merge-recursive bug is simply a failure to check for invalid input.
>
> No it is not.
>
> The objects are there. But the objects cannot be found, since
> merge-recursive cannot go to top level.
Fair enough, I should have looked a little further. However, I still
wonder if it's better to report an error than to segfault.
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-07-26 5:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-25 21:23 git stash apply segfaulting when called in subdir Uwe Kleine-König
2007-07-25 22:28 ` Junio C Hamano
2007-07-25 23:01 ` Johannes Schindelin
2007-07-26 5:07 ` Jeff King
2007-07-26 5:40 ` Johannes Schindelin
2007-07-26 5:48 ` Jeff King
2007-07-25 22:32 ` Steven Walter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).