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

Re: [remote rejected] master -> master (n/a (unpacker error))

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 13, 2010, 00:52 UTC
Message-ID
<20100513005218.GA20655@progeny.tock>
In-Reply-To
<AANLkTinV2U6Lbbl0N7jVAESEi0mZQ_D3slMEYa68vRT4@mail.gmail.com>
Hi Robert,
Robert Buck wrote:
> error: unable to create temporary sha1 filename ./objects/e6: File exists
Yeah, this error message is not so great.
The relevant code is in sha1_file.c.
	fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
	while (fd < 0 && errno == EMFILE && unuse_one_window(packed_git, -1))
		fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
	if (fd < 0) {
		if (errno == EACCES)
			return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
		else
			return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno));
	}

create_tmpfile() creates a filename of the form ./objects/e6/tmp_obj_<random letters> and tries to open that file. The random value is based on the current time and the process ID of the current process. If the file exists, it tries again with another collection of random letters, up to 16384 times.

In your case, all 16384 trials yielded the same result: file already existed. As a workaround, I’d suggest

 rm -f .git/objects/??/tmp_obj_*

but it might be nice to get a listing with "ls -lR .git/objects" first for post-mortem analysis.

And presumably the directory filled with temporary files that could not be renamed to a proper name for some reason. Probably a permissions problem, as Chris suggested.

-- 8< --
Subject: write_loose_object(): improve error message for some mkstemp failures

If the .git/objects/ab/ directory fills up with tmp_obj_ files, the result is a cryptic error:

  error: unable to create temporary sha1 filename ./objects/e6: File exists
Replace it with the slightly less cryptic
  error: cannot write temporary file under ./objects/e6: all the good filenames are taken
Reported-by: Robert Buck <buck.robert.j@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
> As an aside, where the heck is the git bug tracker?
Here is an answer from the last time it came up[1]:
 See http://thread.gmane.org/gmane.comp.version-control.git/136500
 Short answer: the usual method is to report bugs to the list,
 preferably with a patch for t/ or even better, a fix. 
> I've searched, and
> searched, and ... All I found is a Debian tracking system, which
> appears to have no full text search capabilities.

http://merkel.debian.org/~don/cgi/search.cgi http://www.google.com/search?q=site:bugs.debian.org+"Package:+git"+"file+exists"

Thoughts? Improvements? Jonathan

[1] http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/680778/focus=141598
 sha1_file.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 28c056e..a2aa301 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2288,6 +2288,10 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
 	if (fd < 0) {
 		if (errno == EACCES)
 			return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
+		else if (errno == EEXIST)
+			return error("cannot write temporary file under %s: "
+			             "all the good filenames are taken\n",
+			             tmpfile);
 		else
 			return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno));
 	}
-- 
1.7.1
Previous: Chris PackhamNext: Robert Buck
Message 3 of 8 in “[remote rejected] master -> master (n/a (unpacker error))”
  1. Robert BuckMay 12, 2010
  2. Chris PackhamMay 13, 2010
  3. Jonathan NiederMay 13, 2010
  4. Robert BuckMay 13, 2010
  5. Greg TroxelMay 13, 2010
  6. Andreas SchwabMay 13, 2010
  7. Jonathan NiederMay 13, 2010
  8. DavidLeeCritesNov 27, 2015

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.