{"thread":{"id":"5240","subject":"Validation of a commit object?","startedAt":"2006-08-14T06:28:30Z","lastAt":"2006-08-14T21:32:06Z","messageCount":3,"participants":["Shawn Pearce","Alex Riesen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25223","messageId":"20060814062830.GF18667@spearce.org","threadId":"5240","inReplyTo":null,"subject":"Validation of a commit object?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-08-14T06:28:30Z","receivedAt":"2006-08-14T06:28:30Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"In looking at fsck-objects.c the only thing it tries to validate\nabout a commit is:\n\n - the commit has a tree (\"tree NNNNNN\\n\");\n - the commit maybe has parent(s) (\"parent NNNNN\\n\");\n - the commit has \"author \".\n\nThat's it.\n\nIts OK for an author line to be completely corrupt and have no\ntimestamp, no name, no timezone.  Or to have a timestamp such as\n\"bobthetalkingdog\".\n\nIts OK for a committer line to just plain not exist or to be\nequally corrupt.\n\n\nI'm thinking that can't be right.  Shouldn't fsck-objects be doing\nbetter checking on commits?\n\nThe reason I ask is I'm working on my (bastard) fast-import program\nfor Jon's Mozilla CVS -> GIT conversion effort and I'm taking the\nauthor and committer lines blind from the Python code.  If the\nPython code gives me a bad line its going to go into the pack that\nway, with that possibly resulting in a totally corrupt repository.\nI hoped to apply the same verification that fsck-objects applies\nbut apparently it doesn't do anything.  :-)\n\nI'm willing to write some better validation in fsck-objects.c\nand submit the patch if folks think we should do stronger checks\nin there.\n\n-- \nShawn.\n"},{"id":"25233","messageId":"81b0412b0608140139l2937669arbef1e303d1c739bb@mail.gmail.com","threadId":"5240","inReplyTo":"20060814062830.GF18667@spearce.org","subject":"Re: Validation of a commit object?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2006-08-14T08:39:42Z","receivedAt":"2006-08-14T08:39:42Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 8/14/06, Shawn Pearce <spearce@spearce.org> wrote:\n> The reason I ask is I'm working on my (bastard) fast-import program\n> for Jon's Mozilla CVS -> GIT conversion effort and I'm taking the\n> author and committer lines blind from the Python code.  If the\n> Python code gives me a bad line its going to go into the pack that\n> way, with that possibly resulting in a totally corrupt repository.\n\nApart from timestamp, which is used in merge base and rev-list\ncalculations, it does not look like \"a totally corrupt repository\".\n\"Slightly corrupt\", perhaps - you still can work with it, so long\nthe blobs, commits and trees make sense.\n"},{"id":"25313","messageId":"7vr6zjdmw9.fsf@assigned-by-dhcp.cox.net","threadId":"5240","inReplyTo":"20060814062830.GF18667@spearce.org","subject":"Re: Validation of a commit object?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T21:32:06Z","receivedAt":"2006-08-14T21:32:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Pearce <spearce@spearce.org> writes:\n\n> I'm thinking that can't be right.  Shouldn't fsck-objects be doing\n> better checking on commits?\n>\n> The reason I ask is I'm working on my (bastard) fast-import program\n> for Jon's Mozilla CVS -> GIT conversion effort and I'm taking the\n> author and committer lines blind from the Python code.  If the\n> Python code gives me a bad line its going to go into the pack that\n> way, with that possibly resulting in a totally corrupt repository.\n> I hoped to apply the same verification that fsck-objects applies\n> but apparently it doesn't do anything.  :-)\n>\n> I'm willing to write some better validation in fsck-objects.c\n> and submit the patch if folks think we should do stronger checks\n> in there.\n\nHistorical repositories (e.g. very early days of git, linux-2.6\njust after 2.6.12-rc2, and sparse) used to have commit objects\nthat recorded committer dates in RFC2822 format not the current\nunixtime format.  I think all of them have been converted later,\nbut not warning or checking these fields may be related to it.\n\nIn general stricter check is always preferred.  I just wanted to\nmention the older repositories as something we might want to\nkeep in mind.\n"}]}