{"thread":{"id":"31341","subject":"[PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this","startedAt":"2012-08-24T10:31:03Z","lastAt":"2012-08-24T18:32:57Z","messageCount":3,"participants":["Joachim Schmitz","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"197762","messageId":"003101cd81e3$90574490$b105cdb0$@schmitz-digital.de","threadId":"31341","inReplyTo":null,"subject":"[PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-24T10:31:03Z","receivedAt":"2012-08-24T10:31:03Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n compat/mkdir.c | 24 ++++++++++++++++++++++++\n 1 file changed, 24 insertions(+)\n create mode 100644 compat/mkdir.c\n\ndiff --git a/compat/mkdir.c b/compat/mkdir.c\nnew file mode 100644\nindex 0000000..9e253fb\n--- /dev/null\n+++ b/compat/mkdir.c\n@@ -0,0 +1,24 @@\n+#include \"../git-compat-util.h\"\n+#undef mkdir\n+\n+/* for platforms that can't deal with a trailing '/' */\n+int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)\n+{\n+\tint retval;\n+\tchar *tmp_dir = NULL;\n+\tsize_t len = strlen(dir);\n+\n+\tif (len && dir[len-1] == '/') {\n+\t\tif ((tmp_dir = strdup(dir)) == NULL)\n+\t\t\treturn -1;\n+\t\ttmp_dir[len-1] = '\\0';\n+\t}\n+\telse\n+\t\ttmp_dir = (char *)dir;\n+\n+\tretval = mkdir(tmp_dir, mode);\n+\tif (tmp_dir != dir)\n+\t\tfree(tmp_dir);\n+\n+\treturn retval;\n+}\n-- \n1.7.12\n"},{"id":"197785","messageId":"7vr4qwyylv.fsf@alter.siamese.dyndns.org","threadId":"31341","inReplyTo":"003101cd81e3$90574490$b105cdb0$@schmitz-digital.de","subject":"Re: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-24T17:43:40Z","receivedAt":"2012-08-24T17:43:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"As the compat/mkdir.c file includes git-compat-util.h and expects\nthe declaration of the new function to be found in it, it does not\nmake any sense to have this as two patches.  I'll squash them into\none for now, but it would have been even more complete to have an\nupdate to the Makefile to actually compile these files in the same\nchange.  These things go together.\n\nThe other itimer set shares the same issue.  I've queued mkdir and\nitimer series as one patch each; please check the result in 'pu'\nafter I push it out.\n\nThanks.\n"},{"id":"197787","messageId":"004701cd8226$e2534ad0$a6f9e070$@schmitz-digital.de","threadId":"31341","inReplyTo":"7vr4qwyylv.fsf@alter.siamese.dyndns.org","subject":"RE: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-24T18:32:57Z","receivedAt":"2012-08-24T18:32:57Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Junio C Hamano [mailto:gitster@pobox.com]\n> Sent: Friday, August 24, 2012 7:44 PM\n> To: Joachim Schmitz\n> Cc: git@vger.kernel.org\n> Subject: Re: [PATCH 1/2] Ignore trailing slash in mkdir() on platforms that can't deal with this\n> \n> As the compat/mkdir.c file includes git-compat-util.h and expects\n> the declaration of the new function to be found in it, it does not\n> make any sense to have this as two patches.  I'll squash them into\n> one for now, but it would have been even more complete to have an\n> update to the Makefile to actually compile these files in the same\n> change.  These things go together.\n\nA changed Makefile is in the pipeline, but right now it is pretty NonStop specific, \nwhile I tried to keep compat/itimer.cm compat/mkdir.c and git-compat-util.h \nas NonStop independent as I possible could.\nThat Makefile also depends on the outcome of the discussion about my \nNonStop specific changed in git-compat.util.h\n \n> The other itimer set shares the same issue.  I've queued mkdir and\n> itimer series as one patch each; please check the result in 'pu'\n> after I push it out.\n \nThanks. What does 'pu' stand for?\n\nBye, Jojo\n"}]}