From: "Mantas Mikulėnas" <grawity@gmail.com>
To: git@vger.kernel.org
Subject: Crashes while trying to show tag objects with bad timestamps
Date: Sat, 23 Feb 2013 00:30:28 +0200 [thread overview]
Message-ID: <kg8ri2$vjb$1@ger.gmane.org> (raw)
When messing around with various repositories, I noticed that git 1.8
(currently using 1.8.2.rc0.22.gb3600c3) has problems parsing tag objects
that have invalid timestamps.
Times in tag objects appear to be kept as Unix timestamps, but I didn't
realize this at first, and ran something roughly equivalent to:
git cat-file -p $tagname | git hash-object -w -t tag --stdin
creating a tag object the "tagger" line containing formatted time
instead of a Unix timestamp.
Git doesn't handle the resulting tag objects nicely at all. For example,
running `git cat-file -p` on the new object outputs a really odd
timestamp "Thu Jun Thu Jan 1 00:16:09 1970 +0016" (I'm guessing it
parses the year as Unix time), and `git show` outright crashes
(backtrace included below.)
I would have expected both commands to print a "tag object corrupt"
message, or maybe even a more specific "bad timestamp in tagger line"...
To reproduce:
printf '%s\n' \
'object 4b825dc642cb6eb9a060e54bf8d69288fbee4904' 'type tree' \
'tag test' 'tagger User <user@none> Thu Jun 9 16:44:04 2005 +0000' \
'' 'Test tag' | git hash-object -w -t tag --stdin | xargs git show
> #0 0x00007f42560bb5f3 in ____strtoull_l_internal () from /usr/lib/libc.so.6
> No symbol table info available.
> #1 0x00000000004b4c81 in pp_user_info (pp=pp@entry=0x7fff3c30f1a0,
> what=what@entry=0x50c13b "Tagger", sb=sb@entry=0x7fff3c30f140,
> line=0xc267c7 "Jilles Tjoelker <jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n", encoding=0x507e20 "UTF-8") at pretty.c:431
> name = {alloc = 24, len = 15, buf = 0xc24690 "Jilles Tjoelker"}
> mail = {alloc = 24, len = 15, buf = 0xc24750 "jilles@stack.nl"}
> ident = {
> name_begin = 0xc267c7 "Jilles Tjoelker <jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n",
> name_end = 0xc267d6 " <jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n",
> mail_begin = 0xc267d8 "jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n", mail_end = 0xc267e7 "> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n",
> date_begin = 0x0, date_end = 0x0, tz_begin = 0x0, tz_end = 0x0}
> linelen = <optimized out>
> line_end = <optimized out>
> date = <optimized out>
> mailbuf = 0xc267d8 "jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n"
> namebuf = 0xc267c7 "Jilles Tjoelker <jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n"
> namelen = 33
> maillen = 15
> max_length = 78
> time = <optimized out>
> tz = <optimized out>
> #2 0x0000000000439af5 in show_tagger (buf=<optimized out>, len=<optimized out>,
> rev=<optimized out>) at builtin/log.c:400
> pp = {fmt = CMIT_FMT_MEDIUM, abbrev = 0, subject = 0x0, after_subject = 0x0,
> preserve_subject = 0, date_mode = DATE_NORMAL, date_mode_explicit = 0,
> need_8bit_cte = 0, notes_message = 0x0, reflog_info = 0x0,
> output_encoding = 0x0, mailmap = 0x0, color = 0}
> out = {alloc = 0, len = 0, buf = 0x7a8188 <strbuf_slopbuf> ""}
> #3 show_tag_object (rev=0x7fff3c30f1f0,
> sha1=0xc2be44 "\230\211\275\331\365Q\306z\017\071d\331\035\062\247a\347~M8P", <incomplete sequence \303>) at builtin/log.c:427
> new_offset = 151
> type = OBJ_TAG
> buf = 0xc26770 "object ffa28d13e40e03bd367d0219c7eb516be0f180d2\ntype commit\ntag hyperion-1.0rc1\ntagger Jilles Tjoelker <jilles@stack.nl> Thu Jun 9 16:44:04 2005 +0000\n\nTag 1.0rc1.\n\n"
> size = 165
> offset = <optimized out>
--
Mantas Mikulėnas <grawity@gmail.com>
next reply other threads:[~2013-02-22 22:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 22:30 Mantas Mikulėnas [this message]
2013-02-22 22:46 ` Crashes while trying to show tag objects with bad timestamps Jeff King
2013-02-22 22:53 ` Junio C Hamano
2013-02-22 23:04 ` Jeff King
2013-02-22 23:14 ` Mantas Mikulėnas
2013-02-25 18:21 ` Jeff King
2013-02-22 23:20 ` Junio C Hamano
2013-02-25 18:30 ` Jeff King
2013-02-25 18:38 ` [PATCH 1/4] handle malformed dates in ident lines Jeff King
2013-02-25 18:39 ` [PATCH/RFC 2/4] skip_prefix: return a non-const pointer Jeff King
2013-02-25 18:46 ` [PATCH 3/4] fsck: check "tagger" lines Jeff King
2013-02-25 18:50 ` [PATCH 4/4] cat-file: print tags raw for "cat-file -p" Jeff King
2013-02-25 19:33 ` Mantas Mikulėnas
2013-02-22 23:01 ` [RFC/PATCH] hash-object doc: "git hash-object -w" can write invalid objects Jonathan Nieder
2013-02-22 23:07 ` Junio C Hamano
2013-02-22 23:09 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='kg8ri2$vjb$1@ger.gmane.org' \
--to=grawity@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).