From: Linus Torvalds <torvalds@linux-foundation.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: Funny error with git gc...
Date: Sat, 23 May 2009 09:02:55 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0905230859290.3555@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.1.00.0905231050480.9099@intel-tinevez-2-302>
On Sat, 23 May 2009, Johannes Schindelin wrote:
> On Fri, 15 May 2009, Linus Torvalds wrote:
>
> > On Fri, 15 May 2009, Johannes Schindelin wrote:
> > >
> > > fd = mkstemp(template);
> > > + if (fd < 0) {
> > > + release_pack_memory((size_t)-1ll, -1);
> > > + fd = mkstemp(template);
> >
> > This is wrong. You can't use "template" twice. You need to re-initialize
> > it. The first one will blow away the XXXX pattern.
>
> Turns out that would be awkward, as the xmkstemp() function would have to
> copy the template just in case mkstemp() fails due to too many open files,
> and of course it would need to release the copy afterwards.
>
> OTOH we cannot just use the initialized filename, because there
> might be a race condition with another process, right?
Correct. You basically need to have the caller re-create the template. We
already do that in some other cases: see odb_mkstemp(), or
create_tempfile(). Both of them do that template re-creation on failure,
and try again.
You could save off the template into a local temporary array, of course.
Linus
next prev parent reply other threads:[~2009-05-23 16:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 18:02 Funny error with git gc Johannes Schindelin
2009-05-15 18:10 ` Junio C Hamano
2009-05-15 18:24 ` Avery Pennarun
2009-05-15 18:46 ` Linus Torvalds
2009-05-15 19:08 ` Johannes Schindelin
2009-05-15 19:12 ` Johannes Schindelin
2009-05-15 19:18 ` Johannes Schindelin
2009-05-15 20:08 ` Linus Torvalds
2009-05-23 8:53 ` Johannes Schindelin
2009-05-23 16:02 ` Linus Torvalds [this message]
2009-05-24 17:37 ` Johannes Schindelin
2009-05-15 19:16 ` Linus Torvalds
2009-05-15 19:24 ` Johannes Schindelin
2009-05-15 20:30 ` Daniel Barkalow
2009-05-18 8:28 ` Matthias Andree
2009-05-15 18:52 ` [MAKESHIFT PATCH] Cope better with a _lot_ of packs Johannes Schindelin
2009-05-15 19:17 ` Shawn O. Pearce
2009-05-21 1:22 ` Junio C Hamano
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=alpine.LFD.2.01.0905230859290.3555@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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