Re: [PATCH v2] Make sure objects/pack exists before creating a new pack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/2/26 Johannes Sixt <j.sixt@xxxxxxxxxxxxx>
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux