git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Tree with leading '0' modes in 1.7.0.3

From
A Large Angry SCM <gitzilla@gmail.com>
Date
Mar 27, 2010, 20:13 UTC
Message-ID
<4BAE6704.8030101@gmail.com>
In-Reply-To
<20100327191405.GF10910@spearce.org>
Shawn O. Pearce wrote:
Show 29 quoted lines
> Nicolas Pitre <nico@fluxnic.net> wrote:
>> On Sat, 27 Mar 2010, Scott Chacon wrote:
>>>> My stance has always been that the C Git is authoritative with regards to
>>>> formats and protocols. ??It's up to Github to fix their screw-up.
>>> It is fixed and will be deployed soon, but really, there is no reason
>>> to be snippy.  It is a simple and minor mistake effecting very few
>>> repositories (maybe 100 out of 730k)
> 
> What is the C Git stance on these 100 repositories then?  Are they
> now considered corrupt?  Or is 100 enough in the wild that we have
> to accept the problem, just like we accept the 10664 mode issue from
> "ancient" Linux?
> 
> I would love to say "those are corrupt, sorry, fix your repository".
> 
> But we have traditionally tried to help our users, and not cause
> them pain.  Forcing a rewrite on these 100 projects to fix up the
> corruption is going to be painful for them.  
> 
>>> , and the only reason it's an
>>> issue at all is that JGit is not following the authoritative CGit
>>> implementation of basically ignoring it.
>> But again CGit's fsck is not ignoring this discrepancy.  And if the CGit 
>> core is otherwise silently accepting it then it is a mistake.
> 
> Right.  I tend to agree.  CGit was too lax here, fsck shouldn't
> be issuing a warning, it should be a fatal error.  Both CGit and
> JGit are too lax by not failing when reading that tree during
> normal processing.

CGit should treat the object as corrupt, output a message to that effect, and continue checking the rest of the objects. Everything else that traverses graph should exit with an error as soon as it tries detects a corrupt object.

This would allow someone to use git-for-each-ref and git-rev-list to prune the graph by deleting refs without trashing the entire repository.

Show 22 quoted lines
>>> Also, if we're all concerned about "Git reimplementation du jour"
>>> deviations, then we need to focus on libifying Git so there isn't a
>>> need for such re-implementations.  I'm hoping to help with a possible
>>> GSoC project on libgit2, but the lack of a linkable library will
>>> ensure that re-implementations in nearly every useful language will
>>> continue.
>> Don't get me wrong.  I'm not against Git reimplementations per se, as 
>> long as they rigorously implement the exact format and protocol from 
>> CGit.  In that sense it is important that the CGit fsck and verify-pack 
>> tools be exploited on objects/packs produced by alternate Git 
>> implementation systematically to find such issues.
> 
> When JGit had the tree sort order wrong, JGit was in the wrong,
> and any repository which contained those corrupt trees had to be
> fixed by rewriting them.  IIRC it was only the JGit repository
> itself that had this problem in the wild.  But we fixed our code.
> 
> IMHO, this leading '0' thing is a similar breakage.  We shouldn't
> relax CGit or JGit to accept it just because the Ruby implementation
> of Git got the tree encoding wrong.  If anything, we should teach
> these implementations to catch these sorts of problems earlier.
> 
I agree. Now how can the git community help them help themselves?
Previous: A Large Angry SCMNext: Junio C Hamano
Message 28 of 33 in “Tree with leading '0' modes in 1.7.0.3”
  1. Shawn O. PearceMar 26, 2010
  2. Jonathan NiederMar 26, 2010
  3. Shawn O. PearceMar 26, 2010
  4. Jonathan NiederMar 26, 2010
  5. Junio C HamanoMar 26, 2010
  6. Mike.lifeguardMar 26, 2010
  7. Shawn O. PearceMar 26, 2010
  8. Mike.lifeguardMar 26, 2010
  9. Jonathan NiederMar 26, 2010
  10. Junio C HamanoMar 26, 2010
  11. Avery PennarunMar 26, 2010
  12. Mike.lifeguardMar 27, 2010
  13. Shawn O. PearceMar 27, 2010
  14. Nicolas PitreMar 27, 2010
  15. Shawn O. PearceMar 27, 2010
  16. Nicolas PitreMar 27, 2010
  17. Avery PennarunMar 27, 2010
  18. Scott ChaconMar 27, 2010
  19. Nicolas PitreMar 27, 2010
  20. Shawn O. PearceMar 27, 2010
  21. A Large Angry SCMMar 27, 2010
  22. Shawn O. PearceMar 27, 2010
  23. A Large Angry SCMMar 27, 2010
  24. A Large Angry SCMMar 27, 2010
  25. A Large Angry SCMMar 27, 2010
  26. Sitaram ChamartyMar 28, 2010
  27. A Large Angry SCMMar 28, 2010
  28. A Large Angry SCMMar 27, 2010
  29. Junio C HamanoMar 27, 2010
  30. Avery PennarunMar 27, 2010
  31. Junio C HamanoMar 27, 2010
  32. Shawn O. PearceMar 27, 2010
  33. Junio C HamanoMar 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.