Subject: Re: [PATCH] log which temporary file could not be created

From: Arnout Engelen <[email-masked]>
Date: Sun, 10 Oct 2010 12:33:28 +0200

On Sat, Oct 09, 2010 at 09:41:24PM -0500, Jonathan Nieder wrote:
> Arnout Engelen wrote:
> > When creating a temporary file, log the template.
> 
> Since mkstemp modifies its template, these hopefully would print the
> actual filename on errors.  Examples:
> 
> 	fatal: Unable to create temporary file '.merge_file_Sc7R5c': File exists
> 	fatal: Unable to create temporary file 'newrepo/.git/tOWHcxk': No space left on device

Perhaps we should also log the current working directory when the temporary 
filename is relative?

> Unfortunately some mkstemp()s (such as that used to implement
> git_mkstemp_mode()) clear the template on error, which would result in
> 
> 	fatal: Unable to create temporary file '': Permission denied
> 
> What should git do in this situation?

Perhaps we should strdup() the template before mkstemp(), and log the 
strdup()'ed template when the original has been cleared?

Arnout