git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Ralphson <mike.ralphson@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Todd Zullinger <tmz@pobox.com>,
	Rafael Darder Calvo <rdarder@spiralti.com>
Subject: Re: [PATCH v2] Make sure objects/pack exists before creating a new  pack
Date: Thu, 26 Feb 2009 11:19:02 +0000	[thread overview]
Message-ID: <e2b179460902260319je8ce6c6qc028d260b9d35b7c@mail.gmail.com> (raw)
In-Reply-To: <49A65EBF.10307@viscovery.net>

2009/2/26 Johannes Sixt <j.sixt@viscovery.net>
>
> Junio C Hamano schrieb:
> > @@ -795,22 +794,24 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
> >
> >       if (keep_msg) {
> >               int keep_fd, keep_msg_len = strlen(keep_msg);
> > -             if (!keep_name) {
> > -                     snprintf(name, sizeof(name), "%s/pack/pack-%s.keep",
> > -                              get_object_directory(), sha1_to_hex(sha1));
> > -                     keep_name = name;
>
> You should not have removed this line...

Even with j6t's patch, I'm seeing failures in t5300--pack-object.sh on AIX 5.3

* FAIL 15: survive missing objects/pack directory
fatal: Unable to create temporary file (): No such file or directory

From a bit of instrumenting (no working gdb here), I see that in
wrapper.c/odb_mkstemp, template is empty on entry, empty before the
call to safe_create_leading_directories, but contains
.git/objects/pack/tmp_pack_XXXXXX after the second snprintf. TMPDIR is
not set here, which I thought might be the root cause, but it doesn't
seem to be that.

My naive solution is to:

index b07cdf2..80fee48 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -268,9 +268,9 @@ int odb_mkstemp(char *template, size_t limit,
const char *pattern)
                return fd;

        /* slow path */
-       safe_create_leading_directories(template);
        snprintf(template, limit, "%s/%s",
                 get_object_directory(), pattern);
+       safe_create_leading_directories(template);
        return xmkstemp(template);
 }

Which then passes all tests.

Bearing in mind that for me, fiddling with C is like trying to order
room service in Latin, if this is in any way the correct thing to do,
I'll post a proper patch with s-o-b if required, or you can just
squash into j6t's.

Mike

  reply	other threads:[~2009-02-26 11:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-24 17:04 git-push error: Cannot write keep file Rafael Darder Calvo
2009-02-24 17:31 ` Junio C Hamano
2009-02-24 21:21   ` Rafael Darder Calvo
2009-02-25  7:11   ` [PATCH v2] Make sure objects/pack exists before creating a new pack Junio C Hamano
2009-02-25  7:15     ` Junio C Hamano
2009-02-26  9:19     ` Johannes Sixt
2009-02-26 11:19       ` Mike Ralphson [this message]
2009-02-26 15:31         ` Johannes Sixt
2009-02-26 15:54           ` Mike Ralphson
2009-02-26 17:07             ` 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=e2b179460902260319je8ce6c6qc028d260b9d35b7c@mail.gmail.com \
    --to=mike.ralphson@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=rdarder@spiralti.com \
    --cc=tmz@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;
as well as URLs for NNTP newsgroup(s).