{"thread":{"id":"14107","subject":"[PATCH/RFC] Bugfix for AIX tmpfile creation","startedAt":"2008-06-23T21:33:41Z","lastAt":"2008-06-23T23:14:39Z","messageCount":6,"participants":["Patrick Higgins","Junio C Hamano","Linus Torvalds","patrick.higgins@cexp.com"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"80777","messageId":"1214256821-3169-1-git-send-email-patrick.higgins@cexp.com","threadId":"14107","inReplyTo":null,"subject":"[PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"Patrick Higgins","fromEmail":"patrick.higgins@cexp.com","sentAt":"2008-06-23T21:33:41Z","receivedAt":"2008-06-23T21:33:41Z","isPatch":true,"sender":{"key":"patrick.higgins@cexp.com","avatar":null},"body":"The AIX mkstemp will modify it's template parameter to an empty string if\nthe call fails. This caused a subsequent mkdir to fail.\n\nSigned-off-by: Patrick Higgins <patrick.higgins@cexp.com>\n---\n sha1_file.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 191f814..92299ed 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)\n \tfd = mkstemp(buffer);\n \tif (fd < 0 && dirlen) {\n \t\t/* Make sure the directory exists */\n+\t\tmemcpy(buffer, filename, dirlen);\n \t\tbuffer[dirlen-1] = 0;\n \t\tif (mkdir(buffer, 0777) || adjust_shared_perm(buffer))\n \t\t\treturn -1;\n-- \n1.5.6.dirty\n"},{"id":"80785","messageId":"7vy74vg4zq.fsf@gitster.siamese.dyndns.org","threadId":"14107","inReplyTo":"1214256821-3169-1-git-send-email-patrick.higgins@cexp.com","subject":"Re: [PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-23T22:29:13Z","receivedAt":"2008-06-23T22:29:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hmm, we have quite a few calls to mkstemp(), so adding the workaround to\nthis specific call site does not scale well as a fix, I am afraid.\n\nSome callers do not want to use the xmkstemp() (because the function\nalways dies upon failure), so working around this bug in xmkstemp() won't\nsolve it either, unfortunately.  We would probably need compat/mkstemp.c\nthat wraps problematic mkstemp() on platforms with broken mkstemp()\nimplementation.\n"},{"id":"80788","messageId":"alpine.LFD.1.10.0806231552510.2926@woody.linux-foundation.org","threadId":"14107","inReplyTo":"7vy74vg4zq.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-06-23T22:55:50Z","receivedAt":"2008-06-23T22:55:50Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 23 Jun 2008, Junio C Hamano wrote:\n>\n> Hmm, we have quite a few calls to mkstemp(), so adding the workaround to\n> this specific call site does not scale well as a fix, I am afraid.\n\nAll other callers of mkstemp() always rewrite the _entire_ path and don't \ncare about the result after failure (since it failed)\n\nThe new 'create_tmpfile()' usage was/is special in that it re-uses the \npath without recreating it all, just the final part.\n\nSo I think Patrick's patch is fine and sufficient. Maybe I missed some in \nmy quick grep, but it does look ok, and the create_tmpfile() usage really \nwas pretty special.\n\n\t\tLinus\n"},{"id":"80789","messageId":"911589C97062424796D53B625CEC0025E46183@USCOBRMFA-SE-70.northamerica.cexp.com","threadId":"14107","inReplyTo":"alpine.LFD.1.10.0806231552510.2926@woody.linux-foundation.org","subject":"RE: [PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"","fromEmail":"patrick.higgins@cexp.com","sentAt":"2008-06-23T23:07:30Z","receivedAt":"2008-06-23T23:07:30Z","isPatch":true,"sender":{"key":"patrick.higgins@cexp.com","avatar":null},"body":"On Behalf Of Linus Torvalds\n> To: Junio C Hamano\n> \n> On Mon, 23 Jun 2008, Junio C Hamano wrote:\n> >\n> > Hmm, we have quite a few calls to mkstemp(), so adding the \n> workaround to\n> > this specific call site does not scale well as a fix, I am afraid.\n> \n> All other callers of mkstemp() always rewrite the _entire_ \n> path and don't \n> care about the result after failure (since it failed)\n> \n> The new 'create_tmpfile()' usage was/is special in that it \n> re-uses the \n> path without recreating it all, just the final part.\n> \n> So I think Patrick's patch is fine and sufficient. Maybe I \n> missed some in \n> my quick grep, but it does look ok, and the create_tmpfile() \n> usage really \n> was pretty special.\n\nThis 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!\n"},{"id":"80790","messageId":"7viqvzg33c.fsf@gitster.siamese.dyndns.org","threadId":"14107","inReplyTo":"alpine.LFD.1.10.0806231552510.2926@woody.linux-foundation.org","subject":"Re: [PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-23T23:10:15Z","receivedAt":"2008-06-23T23:10:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Mon, 23 Jun 2008, Junio C Hamano wrote:\n>>\n>> Hmm, we have quite a few calls to mkstemp(), so adding the workaround to\n>> this specific call site does not scale well as a fix, I am afraid.\n>\n> All other callers of mkstemp() always rewrite the _entire_ path and don't \n> care about the result after failure (since it failed)\n\nYeah, I realize I grepped wrong X-<.\n"},{"id":"80791","messageId":"7vej6ng2w0.fsf@gitster.siamese.dyndns.org","threadId":"14107","inReplyTo":"911589C97062424796D53B625CEC0025E46183@USCOBRMFA-SE-70.northamerica.cexp.com","subject":"Re: [PATCH/RFC] Bugfix for AIX tmpfile creation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-23T23:14:39Z","receivedAt":"2008-06-23T23:14:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"<Patrick.Higgins@cexp.com> writes:\n\n> The irony is of course that I wanted 1.5.6 for the improved AIX support\n> and the final release is completely broken on AIX!\n\nYeah, queued to 'maint' for 1.5.6.1.  Thanks\n"}]}