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

Re: [Junio C Hamano] Re: Consolidate SHA1 object file close

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 17, 2008, 16:30 UTC
Message-ID
<alpine.LFD.1.10.0806170919370.25099@woody.linux-foundation.org>
In-Reply-To
<7v4p7s8xjc.fsf@gitster.siamese.dyndns.org>
On Mon, 16 Jun 2008, Junio C Hamano wrote:
> 
> However, this may be more important fix.  We want to make sure that
> adjust_shared_perm() is called on the success codepath, especially not
> when mkdir() does _not_ fail.
Oops. Yes.

The old code this came from actually did it differently: it failed if mkdir _succeeded_ but then adjust_shared_perm() failed. If the mkdir failed, it would just try again. That was what confused me - it was a copy-and-paste thing, but with me misreading the source of it and being confused.

IOW, the old code looked like
	if (!mkdir(filename, 0777) && adjust_shared_perm(filename)) {
		.. failure path ..

which is just really odd. A failing mkdir would be a "success" from this standpoint, leading to another "link()" being attempted. I think it may have wanted to return the errno from the link() or something.

Your fix is obviously superior. And equally obviously we don't seem to have any tests for this case. Maybe because I have a umask of 0002, so the mkdir() would already make it group-writable?

		Linus
Previous: Junio C HamanoNext: Pierre Habouzit
Message 5 of 6 in “[Junio C Hamano] Re: Consolidate SHA1 object file close”
  1. Junio C HamanoJun 14, 2008
  2. Linus TorvaldsJun 15, 2008
  3. Nicolas PitreJun 16, 2008
  4. Junio C HamanoJun 17, 2008
  5. Linus TorvaldsJun 17, 2008
  6. Pierre HabouzitJul 4, 2008

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.