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

From: Jonathan Nieder <[email-masked]>
Date: Sun, 10 Oct 2010 13:09:09 -0500

Arnout Engelen wrote:
> On Sat, Oct 09, 2010 at 09:41:24PM -0500, Jonathan Nieder wrote:

>> 	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?

Let's step back for a moment.  Was there an example that prompted
this patch?  Were you aware of where git would be trying to create
files in that example?  (I'm genuinely curious.)

Converting the filename to an absolute path with make_absolute_path
might be useful, but I am not entirely sure it is worth the
complication.

>> 	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?

Is it be preferable for the filename to always have XXXXXX in it?  If
so, then copying it into a temporary buffer (on-stack, preferably)
could be a sane solution, yes.

Jonathan