* git describe --tags --long barfs on new tags?
@ 2008-07-02 14:45 Mark Burton
2008-07-02 19:56 ` Mikael Magnusson
0 siblings, 1 reply; 5+ messages in thread
From: Mark Burton @ 2008-07-02 14:45 UTC (permalink / raw)
To: git
Howdy folks,
Discovered this today:
~/git[master]$ git tag mb
~/git[master]$ git describe
v1.5.6.1-156-ge903b40
~/git[master]$ git describe --tags
mb
~/git[master]$ git describe --tags --long
Segmentation fault (core dumped)
Hope this is useful info.
BTW - just started using git and I am very impressed with it - took me a while to get my head around the "index" but now I wonder what the problem was.
Cheers,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git describe --tags --long barfs on new tags?
2008-07-02 14:45 git describe --tags --long barfs on new tags? Mark Burton
@ 2008-07-02 19:56 ` Mikael Magnusson
2008-07-03 2:32 ` [PATCH] Fix describe --tags --long so it does not segfault Shawn O. Pearce
2008-07-03 2:49 ` git describe --tags --long barfs on new tags? Abhijit Menon-Sen
0 siblings, 2 replies; 5+ messages in thread
From: Mikael Magnusson @ 2008-07-02 19:56 UTC (permalink / raw)
To: Mark Burton; +Cc: git
2008/7/2 Mark Burton <markb@ordern.com>:
>
> Howdy folks,
>
> Discovered this today:
>
> ~/git[master]$ git tag mb
> ~/git[master]$ git describe
> v1.5.6.1-156-ge903b40
> ~/git[master]$ git describe --tags
> mb
> ~/git[master]$ git describe --tags --long
> Segmentation fault (core dumped)
>
> Hope this is useful info.
>
> BTW - just started using git and I am very impressed with it - took me a while to get my head around the "index" but now I wonder what the problem was.
Here's a backtrace, i tried to follow the code but got confused and gave up.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa7cd26c0 (LWP 9670)]
0x080615f2 in describe (arg=0x80e4e9e "HEAD", last_one=1) at
builtin-describe.c:207
207 show_suffix(0, n->tag->tagged->sha1);
(gdb) bt
#0 0x080615f2 in describe (arg=0x80e4e9e "HEAD", last_one=1) at
builtin-describe.c:207
#1 0x08061bd8 in cmd_describe (argc=0, argv=0xafcd25f4, prefix=0x0)
at builtin-describe.c:360
#2 0x0804b1bf in handle_internal_command (argc=3, argv=0xafcd25f4) at git.c:252
#3 0x0804b888 in main (argc=3, argv=0x41c294c0) at git.c:463
(gdb) print n
$1 = <value optimized out>
(gdb) print cmit
$3 = (struct commit *) 0x81476a8
(gdb) print cmit->util
$4 = (void *) 0x8147430
(gdb) print *(struct commit_name*)cmit->util
$5 = {tag = 0x0, prio = 1, sha1 =
"\tEt\"±d6ª\033\005\230\237\035ëR\226¼á\017\230",
path = 0x814744c "mb"}
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Fix describe --tags --long so it does not segfault
2008-07-02 19:56 ` Mikael Magnusson
@ 2008-07-03 2:32 ` Shawn O. Pearce
2008-07-03 4:23 ` Junio C Hamano
2008-07-03 2:49 ` git describe --tags --long barfs on new tags? Abhijit Menon-Sen
1 sibling, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2008-07-03 2:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Mikael Magnusson, Mark Burton
If we match a lightweight (non-annotated tag) as the name to
output and --long was requested we do not have a tag, nor do
we have a tagged object to display. Instead we must use the
object we were passed as input for the long format display.
Reported-by: Mark Burton <markb@ordern.com>
Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Thanks Mikael, the backtrace really made it easy to figure out
what the breakage was here.
builtin-describe.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1..e515f9c 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
*/
display_name(n);
if (longformat)
- show_suffix(0, n->tag->tagged->sha1);
+ show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
printf("\n");
return;
}
--
1.5.6.74.g8a5e
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix describe --tags --long so it does not segfault
2008-07-03 2:32 ` [PATCH] Fix describe --tags --long so it does not segfault Shawn O. Pearce
@ 2008-07-03 4:23 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2008-07-03 4:23 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Mikael Magnusson, Mark Burton
"Shawn O. Pearce" <spearce@spearce.org> writes:
> If we match a lightweight (non-annotated tag) as the name to
> output and --long was requested we do not have a tag, nor do
> we have a tagged object to display. Instead we must use the
> object we were passed as input for the long format display.
>
> Reported-by: Mark Burton <markb@ordern.com>
> Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> ---
>
> Thanks Mikael, the backtrace really made it easy to figure out
> what the breakage was here.
Thanks. I'll squash this in and apply to 'maint'. Perhaps 1.5.6.2
after the 4th holiday.
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index c6be259..2fb672c 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -139,4 +139,6 @@ check_describe "test1-lightweight-*" --tags --match="test1-*"
check_describe "test2-lightweight-*" --tags --match="test2-*"
+check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
+
test_done
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: git describe --tags --long barfs on new tags?
2008-07-02 19:56 ` Mikael Magnusson
2008-07-03 2:32 ` [PATCH] Fix describe --tags --long so it does not segfault Shawn O. Pearce
@ 2008-07-03 2:49 ` Abhijit Menon-Sen
1 sibling, 0 replies; 5+ messages in thread
From: Abhijit Menon-Sen @ 2008-07-03 2:49 UTC (permalink / raw)
To: git; +Cc: Mark Burton, Mikael Magnuson
(Sorry for the broken References. I deleted the message before realising
that I wanted to reply to it; and I couldn't easily find an mbox archive
to snarf the whole message from.)
> ~/git[master]$ git tag mb
> ~/git[master]$ git describe
> v1.5.6.1-156-ge903b40
> ~/git[master]$ git describe --tags
> mb
> ~/git[master]$ git describe --tags --long
> Segmentation fault (core dumped)
Not on new tags, but on un-annotated ones (which the --tags brings into
consideration). The appended patch fixes the problem for me, but I'd be
grateful if someone could confirm that it's the right thing to do.
-- ams
diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1..7ed4757 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -203,8 +203,12 @@ static void describe(const char *arg, int last_one)
* Exact match to an existing ref.
*/
display_name(n);
- if (longformat)
- show_suffix(0, n->tag->tagged->sha1);
+ if (longformat) {
+ const unsigned char *sha1 = n->sha1;
+ if (n->tag)
+ sha1 = n->tag->tagged->sha1;
+ show_suffix(0, sha1);
+ }
printf("\n");
return;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-03 8:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-02 14:45 git describe --tags --long barfs on new tags? Mark Burton
2008-07-02 19:56 ` Mikael Magnusson
2008-07-03 2:32 ` [PATCH] Fix describe --tags --long so it does not segfault Shawn O. Pearce
2008-07-03 4:23 ` Junio C Hamano
2008-07-03 2:49 ` git describe --tags --long barfs on new tags? Abhijit Menon-Sen
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).