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

Re: Careful object writing..

From
Linus Torvalds <torvalds@osdl.org>
Date
May 3, 2005, 19:47 UTC
Message-ID
<Pine.LNX.4.58.0505031242330.26698@ppc970.osdl.org>
In-Reply-To
<20050503192753.GA6435@taniwha.stupidest.org>
On Tue, 3 May 2005, Chris Wedgwood wrote:
> 
> how is this better than a single rename?  i take it there is something
> fundamental from clue.101 i slept though here?

A rename will overwrite any old object, which means that you cannot do any collision checks. In contrast, a "link()" will return EEXIST if somebody else raced with you and created a new object, and you can do collision checks instead of overwriting another persons object.

> also, if you are *really* paranoid you want to fsync *before* you do
> the link/unklink or rename --- which is what MTAs do[1]

Me, I refuse to slow down my habits for old filesystems. You can either fsck, or use a logging filesystem.

I don't see anybody not using logging filesystems these days, so..
> also, shouldn't HEAD (and similar)[2] be updated with a temporary and
> a rename too?
Maybe. Much less important, though.
Show 5 quoted lines
> > NOTE NOTE NOTE! I have _not_ updated all the helper stuff that also
> > write objects.
> 
> i thought this was all common code?  if it's not maybe now is the time
> to change that?
It is all common code, except:
 - things like "fetch from another host" will use rsync/wget/xxx to 
   actually get the files. To those programs, we're not talking about git 
   objects, we're just talking "regular files"
 - rpull.c has a special different routine to write its objects. I don't 
   use it, so..
Anyway, it should be reasonably easily fixable.
		Linus
Previous: Chris WedgwoodNext: Chris Wedgwood
Message 3 of 19 in “Careful object writing..”
  1. Linus TorvaldsMay 3, 2005
  2. Chris WedgwoodMay 3, 2005
  3. Linus TorvaldsMay 3, 2005
  4. Chris WedgwoodMay 3, 2005
  5. Linus TorvaldsMay 3, 2005
  6. Daniel BarkalowMay 3, 2005
  7. Jan HarkesMay 3, 2005
  8. Linus TorvaldsMay 3, 2005
  9. Jan HarkesMay 3, 2005
  10. Linus TorvaldsMay 3, 2005
  11. Linus TorvaldsMay 3, 2005
  12. H. Peter AnvinMay 3, 2005
  13. Alex RiesenMay 3, 2005
  14. Linus TorvaldsMay 3, 2005
  15. Alex RiesenMay 3, 2005
  16. Junio C HamanoMay 3, 2005
  17. Careful object pullingDaniel Barkalow, May 4, 2005
  18. Morten WelinderMay 4, 2005
  19. Daniel BarkalowMay 4, 2005

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.