Re: [PATCH v2] Make sure objects/pack exists before creating a new pack
- From
Mike Ralphson <mike.ralphson@gmail.com>
- Date
- Feb 26, 2009, 11:19 UTC
- Message-ID
- <e2b179460902260319je8ce6c6qc028d260b9d35b7c@mail.gmail.com>
- In-Reply-To
- <49A65EBF.10307@viscovery.net>
2009/2/26 Johannes Sixt <j.sixt@viscovery.net>
Show 12 quoted lines
>
> 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