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]

 



Mike Ralphson schrieb:
> 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

I can confirm this. Your patch is good. I wrapped it up:

-- snip --
From: Mike Ralphson <mike.ralphson@xxxxxxxxx>
Subject: [PATCH] Fix odb_mkstemp() on AIX

The AIX mkstemp() modifies its template parameter to an empty string if
the call fails.  The existing code had already recomputed the template,
but too late to be good.

See also 6ff6af62, which fixed this problem in a different spot.

Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
---
 wrapper.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/wrapper.c b/wrapper.c
index b07cdf2..d8efb13 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -268,9 +268,10 @@ int odb_mkstemp(char *template, size_t limit,
 		return fd;

 	/* slow path */
-	safe_create_leading_directories(template);
+	/* some mkstemp implementations erase template on failure */
 	snprintf(template, limit, "%s/%s",
 		 get_object_directory(), pattern);
+	safe_create_leading_directories(template);
 	return xmkstemp(template);
 }

-- 
1.6.1.rc1.5.gf691f


--
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