git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Feb 26, 2009, 15:31 UTC
Message-ID
<49A6B5E8.8040306@viscovery.net>
In-Reply-To
<e2b179460902260319je8ce6c6qc028d260b9d35b7c@mail.gmail.com>
Mike Ralphson schrieb:
Show 16 quoted lines
> 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
I can confirm this. Your patch is good. I wrapped it up:
-- snip --
From: Mike Ralphson <mike.ralphson@gmail.com>
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@kdbg.org>
---
 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
Previous: Mike RalphsonNext: Mike Ralphson
Message 8 of 10 in “git-push error: Cannot write keep file”
  1. Rafael Darder CalvoFeb 24, 2009
  2. Junio C HamanoFeb 24, 2009
  3. Rafael Darder CalvoFeb 24, 2009
  4. Make sure objects/pack exists before creating a new packJunio C Hamano, Feb 25, 2009
  5. Junio C HamanoFeb 25, 2009
  6. Johannes SixtFeb 26, 2009
  7. Mike RalphsonFeb 26, 2009
  8. Johannes SixtFeb 26, 2009
  9. Mike RalphsonFeb 26, 2009
  10. Junio C HamanoFeb 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.