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

Re: 'git fast-export' is crashing on the gcc repo

From
Nicolas Pitre <nico@cam.org>
Date
Dec 11, 2007, 22:06 UTC
Message-ID
<alpine.LFD.0.99999.0712111703380.555@xanadu.home>
In-Reply-To
<alpine.LFD.0.99999.0712111509270.555@xanadu.home>
On Tue, 11 Dec 2007, Nicolas Pitre wrote:
Show 30 quoted lines
> Simply doing something like:
> 
> $ git fast-export --all > /dev/null
> 
> results in:
> 
> fatal: Could not write blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
> 
> Since this is extremely enlightening, I patched it as follows:
> 
> diff --git a/builtin-fast-export.c b/builtin-fast-export.c
> index 2136aad..5c7bfe0 100755
> --- a/builtin-fast-export.c
> +++ b/builtin-fast-export.c
> @@ -104,7 +104,8 @@ static void handle_object(const unsigned char *sha1)
>  
>  	printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
>  	if (fwrite(buf, size, 1, stdout) != 1)
> -		die ("Could not write blob %s", sha1_to_hex(sha1));
> +		die ("Could not write blob %s: %s",
> +		     sha1_to_hex(sha1), strerror(errno));
>  	printf("\n");
>  
>  	show_progress();
> 
> And then running it again produced:
> 
> fatal: Could not write blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391: Inappropriate ioctl for device
> 
> adding to today's confusion.

Well, ignore the above. It seems that most of stdio doesn't set errno so the above is crap.

Even strace doesn't show any error.
But, somehow, the following patch fixes it:
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 2136aad..c32a124 100755
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -103,7 +103,7 @@ static void handle_object(const unsigned char *sha1)
 	mark_object(object);
 
 	printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
-	if (fwrite(buf, size, 1, stdout) != 1)
+	if (fwrite(buf, 1, size, stdout) != size)
 		die ("Could not write blob %s", sha1_to_hex(sha1));
 	printf("\n");
 

Go figure.


Nicolas
Previous: Nicolas PitreNext: Alex Riesen
Message 5 of 10 in “'git fast-export' is crashing on the gcc repo”
  1. Nicolas PitreDec 11, 2007
  2. Marco CostalbaDec 11, 2007
  3. Fix git-fast-export for zero-sized blobsAlex Riesen, Dec 11, 2007
  4. Nicolas PitreDec 11, 2007
  5. Nicolas PitreDec 11, 2007
  6. Alex RiesenDec 12, 2007
  7. Nicolas PitreDec 12, 2007
  8. Junio C HamanoDec 12, 2007
  9. David KastrupDec 12, 2007
  10. Junio C HamanoDec 12, 2007

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.