git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] Bugfix for AIX tmpfile creation
@ 2008-06-23 21:33 Patrick Higgins
  2008-06-23 22:29 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Higgins @ 2008-06-23 21:33 UTC (permalink / raw)
  To: git; +Cc: Patrick Higgins

The AIX mkstemp will modify it's template parameter to an empty string if
the call fails. This caused a subsequent mkdir to fail.

Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
---
 sha1_file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index 191f814..92299ed 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
 	fd = mkstemp(buffer);
 	if (fd < 0 && dirlen) {
 		/* Make sure the directory exists */
+		memcpy(buffer, filename, dirlen);
 		buffer[dirlen-1] = 0;
 		if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
 			return -1;
-- 
1.5.6.dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH/RFC] Bugfix for AIX tmpfile creation
  2008-06-23 21:33 [PATCH/RFC] Bugfix for AIX tmpfile creation Patrick Higgins
@ 2008-06-23 22:29 ` Junio C Hamano
  2008-06-23 22:55   ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-06-23 22:29 UTC (permalink / raw)
  To: Patrick Higgins; +Cc: git

Hmm, we have quite a few calls to mkstemp(), so adding the workaround to
this specific call site does not scale well as a fix, I am afraid.

Some callers do not want to use the xmkstemp() (because the function
always dies upon failure), so working around this bug in xmkstemp() won't
solve it either, unfortunately.  We would probably need compat/mkstemp.c
that wraps problematic mkstemp() on platforms with broken mkstemp()
implementation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/RFC] Bugfix for AIX tmpfile creation
  2008-06-23 22:29 ` Junio C Hamano
@ 2008-06-23 22:55   ` Linus Torvalds
  2008-06-23 23:07     ` Patrick.Higgins
  2008-06-23 23:10     ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Linus Torvalds @ 2008-06-23 22:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Patrick Higgins, git



On Mon, 23 Jun 2008, Junio C Hamano wrote:
>
> Hmm, we have quite a few calls to mkstemp(), so adding the workaround to
> this specific call site does not scale well as a fix, I am afraid.

All other callers of mkstemp() always rewrite the _entire_ path and don't 
care about the result after failure (since it failed)

The new 'create_tmpfile()' usage was/is special in that it re-uses the 
path without recreating it all, just the final part.

So I think Patrick's patch is fine and sufficient. Maybe I missed some in 
my quick grep, but it does look ok, and the create_tmpfile() usage really 
was pretty special.

		Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH/RFC] Bugfix for AIX tmpfile creation
  2008-06-23 22:55   ` Linus Torvalds
@ 2008-06-23 23:07     ` Patrick.Higgins
  2008-06-23 23:14       ` Junio C Hamano
  2008-06-23 23:10     ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Patrick.Higgins @ 2008-06-23 23:07 UTC (permalink / raw)
  To: torvalds, gitster; +Cc: git

On Behalf Of Linus Torvalds
> To: Junio C Hamano
> 
> On Mon, 23 Jun 2008, Junio C Hamano wrote:
> >
> > Hmm, we have quite a few calls to mkstemp(), so adding the 
> workaround to
> > this specific call site does not scale well as a fix, I am afraid.
> 
> All other callers of mkstemp() always rewrite the _entire_ 
> path and don't 
> care about the result after failure (since it failed)
> 
> The new 'create_tmpfile()' usage was/is special in that it 
> re-uses the 
> path without recreating it all, just the final part.
> 
> So I think Patrick's patch is fine and sufficient. Maybe I 
> missed some in 
> my quick grep, but it does look ok, and the create_tmpfile() 
> usage really 
> was pretty special.

This is the only problem I've seen with it so far on AIX. I was really surprised because I hadn't seen any problems with any of the release candidates and had been using them all as they came out so I got lazy and didn't test the final release, but one of my co-workers let me know that it is broken this morning. Even the most basic things like git-add stopped working, and applying this small patch fixed all test cases. The irony is of course that I wanted 1.5.6 for the improved AIX support and the final release is completely broken on AIX!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/RFC] Bugfix for AIX tmpfile creation
  2008-06-23 22:55   ` Linus Torvalds
  2008-06-23 23:07     ` Patrick.Higgins
@ 2008-06-23 23:10     ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-06-23 23:10 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Patrick Higgins, git

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Mon, 23 Jun 2008, Junio C Hamano wrote:
>>
>> Hmm, we have quite a few calls to mkstemp(), so adding the workaround to
>> this specific call site does not scale well as a fix, I am afraid.
>
> All other callers of mkstemp() always rewrite the _entire_ path and don't 
> care about the result after failure (since it failed)

Yeah, I realize I grepped wrong X-<.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/RFC] Bugfix for AIX tmpfile creation
  2008-06-23 23:07     ` Patrick.Higgins
@ 2008-06-23 23:14       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-06-23 23:14 UTC (permalink / raw)
  To: Patrick.Higgins; +Cc: torvalds, gitster, git

<Patrick.Higgins@cexp.com> writes:

> The irony is of course that I wanted 1.5.6 for the improved AIX support
> and the final release is completely broken on AIX!

Yeah, queued to 'maint' for 1.5.6.1.  Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-23 23:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23 21:33 [PATCH/RFC] Bugfix for AIX tmpfile creation Patrick Higgins
2008-06-23 22:29 ` Junio C Hamano
2008-06-23 22:55   ` Linus Torvalds
2008-06-23 23:07     ` Patrick.Higgins
2008-06-23 23:14       ` Junio C Hamano
2008-06-23 23:10     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).