Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:46:17
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Mike Ralphson schrieb:
2009/2/26 Johannes Sixt [off-list ref]
quoted
Junio C Hamano schrieb:
quoted
@@ -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 <redacted>
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help