{"thread":{"id":"14242","subject":"[PATCH?] Fix 'git show' on signed tag of signed tag of commit","startedAt":"2008-07-01T09:47:04Z","lastAt":"2008-07-01T23:55:13Z","messageCount":3,"participants":["Thomas Rast","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"81855","messageId":"1214905624-29517-1-git-send-email-trast@student.ethz.ch","threadId":"14242","inReplyTo":null,"subject":"[PATCH?] Fix 'git show' on signed tag of signed tag of commit","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-07-01T09:47:04Z","receivedAt":"2008-07-01T09:47:04Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The cmd_show loop resolves tags by showing them, then pointing the\nobject to the 'tagged' member.  However, this object is not fully\ninitialized; it only contains the SHA1.  (This resulted in a segfault\nif there were two levels of tags.)  We apply parse_object to get a\nfull object.\n\nNoticed by Kalle Olavi Niemitalo on IRC.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nI'm not 100% sure this is the right fix; I just had a quick stab at\nthe code, made a fix and tested it.  It probably leaks memory too, not\nsure if this is a problem.\n\n- Thomas\n\n\n builtin-log.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 9817d6f..9979e37 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -360,7 +360,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)\n \t\t\t\t\tt->tag,\n \t\t\t\t\tdiff_get_color_opt(&rev.diffopt, DIFF_RESET));\n \t\t\tret = show_object(o->sha1, 1, &rev);\n-\t\t\tobjects[i].item = (struct object *)t->tagged;\n+\t\t\tobjects[i].item = parse_object(t->tagged->sha1);\n \t\t\ti--;\n \t\t\tbreak;\n \t\t}\n-- \n1.5.6.1.246.g5fc88.dirty\n"},{"id":"81890","messageId":"alpine.LSU.1.00.0807011836500.32725@wbgn129.biozentrum.uni-wuerzburg.de","threadId":"14242","inReplyTo":"1214905624-29517-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH?] Fix 'git show' on signed tag of signed tag of commit","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-07-01T16:39:11Z","receivedAt":"2008-07-01T16:39:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 1 Jul 2008, Thomas Rast wrote:\n\n> The cmd_show loop resolves tags by showing them, then pointing the\n> object to the 'tagged' member.  However, this object is not fully\n> initialized; it only contains the SHA1.  (This resulted in a segfault\n> if there were two levels of tags.)  We apply parse_object to get a\n> full object.\n> \n> Noticed by Kalle Olavi Niemitalo on IRC.\n> \n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n> ---\n> \n> I'm not 100% sure this is the right fix; I just had a quick stab at the \n> code, made a fix and tested it.  It probably leaks memory too, not sure \n> if this is a problem.\n\nAFAICT this is the correct way to solve the problem.\n\nWe do not \"leak\" memory here, since we just assume objects to be \nsingletons (they are immutable, after all).\n\nFWIW I had a \"release_all_objects()\" function in my personal fork for a \nlong time, which was quite painful to write.  But maintaining the \"move \nall builtins into libgit.a and avoid fork()&&exec()ing them\" patch was the \nonly user, and since it became way too painful to maintain out of the \ntree, I dropped both.\n\nCiao,\nDscho\n"},{"id":"81909","messageId":"7vbq1hkvmm.fsf@gitster.siamese.dyndns.org","threadId":"14242","inReplyTo":"1214905624-29517-1-git-send-email-trast@student.ethz.ch","subject":"Re: [PATCH?] Fix 'git show' on signed tag of signed tag of commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-01T23:55:13Z","receivedAt":"2008-07-01T23:55:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Rast <trast@student.ethz.ch> writes:\n\n> The cmd_show loop resolves tags by showing them, then pointing the\n> object to the 'tagged' member.  However, this object is not fully\n> initialized; it only contains the SHA1.  (This resulted in a segfault\n> if there were two levels of tags.)  We apply parse_object to get a\n> full object.\n>\n> Noticed by Kalle Olavi Niemitalo on IRC.\n>\n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n> ---\n>\n> I'm not 100% sure this is the right fix; I just had a quick stab at\n> the code, made a fix and tested it.  It probably leaks memory too, not\n> sure if this is a problem.\n\nThe code looks good.  It should not have been accessing the object without\nmaking sure it has been parsed.\n\nAnd it's not a leak.  Once you instantiate \"struct object\" derived class,\nwe hold onto it (at least to its skeleton).\n\nThanks.\n"}]}