{"thread":{"id":"30266","subject":"[PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure","startedAt":"2012-04-17T18:00:04Z","lastAt":"2012-05-01T19:44:15Z","messageCount":4,"participants":["Ramsay Jones","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"189553","messageId":"4F8DAFA4.2050502@ramsay1.demon.co.uk","threadId":"30266","inReplyTo":null,"subject":"[PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-04-17T18:00:04Z","receivedAt":"2012-04-17T18:00:04Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe current t9300-fast-import.sh test number 62 (\"L: nested tree\ncopy does not corrupt deltas\") was introduced in commit 9a0edb79\n(\"fast-import: add a test for tree delta base corruption\",\n15-08-2011). A fix for the demonstrated problem was introduced\nby commit 8fb3ad76 (\"fast-import: prevent producing bad delta\",\n15-08-2011). However, this fix didn't work on MinGW and so this\ntest has always failed on MinGW.\n\nPart of the solution in commit 8fb3ad76 was to add an NO_DELTA\npreprocessor constant which was defined as follows:\n\n  +/*\n  + * We abuse the setuid bit on directories to mean \"do not delta\".\n  + */\n  +#define NO_DELTA S_ISUID\n  +\n\nUnfortunately, the S_ISUID constant on MinGW is defined as zero.\n\nIn order to fix the problem, we simply alter the definition of\nS_ISUID in the mingw header file to a more appropriate value.\nAlso, we take the opportunity to similarly define S_ISGID and\nS_ISVTX.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n compat/mingw.h |    7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex ef5b150..61a6521 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -22,9 +22,10 @@ typedef int socklen_t;\n #define S_IWOTH 0\n #define S_IXOTH 0\n #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)\n-#define S_ISUID 0\n-#define S_ISGID 0\n-#define S_ISVTX 0\n+\n+#define S_ISUID 0004000\n+#define S_ISGID 0002000\n+#define S_ISVTX 0001000\n \n #define WIFEXITED(x) 1\n #define WIFSIGNALED(x) 0\n-- \n1.7.10\n"},{"id":"189660","messageId":"4F8F2268.8020803@kdbg.org","threadId":"30266","inReplyTo":"4F8DAFA4.2050502@ramsay1.demon.co.uk","subject":"Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-04-18T20:22:00Z","receivedAt":"2012-04-18T20:22:00Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 17.04.2012 20:00, schrieb Ramsay Jones:\n> \n> The current t9300-fast-import.sh test number 62 (\"L: nested tree\n> copy does not corrupt deltas\") was introduced in commit 9a0edb79\n> (\"fast-import: add a test for tree delta base corruption\",\n> 15-08-2011). A fix for the demonstrated problem was introduced\n> by commit 8fb3ad76 (\"fast-import: prevent producing bad delta\",\n> 15-08-2011). However, this fix didn't work on MinGW and so this\n> test has always failed on MinGW.\n> \n> Part of the solution in commit 8fb3ad76 was to add an NO_DELTA\n> preprocessor constant which was defined as follows:\n> \n>   +/*\n>   + * We abuse the setuid bit on directories to mean \"do not delta\".\n>   + */\n>   +#define NO_DELTA S_ISUID\n>   +\n> \n> Unfortunately, the S_ISUID constant on MinGW is defined as zero.\n> \n> In order to fix the problem, we simply alter the definition of\n> S_ISUID in the mingw header file to a more appropriate value.\n> Also, we take the opportunity to similarly define S_ISGID and\n> S_ISVTX.\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n>  compat/mingw.h |    7 ++++---\n>  1 file changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index ef5b150..61a6521 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -22,9 +22,10 @@ typedef int socklen_t;\n>  #define S_IWOTH 0\n>  #define S_IXOTH 0\n>  #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)\n> -#define S_ISUID 0\n> -#define S_ISGID 0\n> -#define S_ISVTX 0\n> +\n> +#define S_ISUID 0004000\n> +#define S_ISGID 0002000\n> +#define S_ISVTX 0001000\n>  \n>  #define WIFEXITED(x) 1\n>  #define WIFSIGNALED(x) 0\n\nI've submitted a similar patch, but it was suggested to solve the\ninherent problem in a cleaner way, but no patch came forward.\n\n-- Hannes\n\nSee http://thread.gmane.org/gmane.comp.version-control.git/181817\n"},{"id":"190420","messageId":"7vhaw0as8e.fsf@alter.siamese.dyndns.org","threadId":"30266","inReplyTo":"4F8F2268.8020803@kdbg.org","subject":"Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-01T14:30:41Z","receivedAt":"2012-05-01T14:30:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n>> ...\n>> -#define S_ISGID 0\n>> -#define S_ISVTX 0\n>> +\n>> +#define S_ISUID 0004000\n>> +#define S_ISGID 0002000\n>> +#define S_ISVTX 0001000\n>>  \n>>  #define WIFEXITED(x) 1\n>>  #define WIFSIGNALED(x) 0\n>\n> I've submitted a similar patch, but it was suggested to solve the\n> inherent problem in a cleaner way, but no patch came forward.\n\nI think this patch should be fine, either as the final solution, or the\nfirst step for \"solving the inherent problem in a cleaner way\" (if msysgit\nfolk care very deeply about it, that is).\n"},{"id":"190469","messageId":"4FA03D0F.6080906@kdbg.org","threadId":"30266","inReplyTo":"7vhaw0as8e.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2012-05-01T19:44:15Z","receivedAt":"2012-05-01T19:44:15Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 01.05.2012 16:30, schrieb Junio C Hamano:\n> Johannes Sixt<j6t@kdbg.org>  writes:\n>\n>>> ...\n>>> -#define S_ISGID 0\n>>> -#define S_ISVTX 0\n>>> +\n>>> +#define S_ISUID 0004000\n>>> +#define S_ISGID 0002000\n>>> +#define S_ISVTX 0001000\n>>>\n>>>   #define WIFEXITED(x) 1\n>>>   #define WIFSIGNALED(x) 0\n>>\n>> I've submitted a similar patch, but it was suggested to solve the\n>> inherent problem in a cleaner way, but no patch came forward.\n>\n> I think this patch should be fine, either as the final solution, or the\n> first step for \"solving the inherent problem in a cleaner way\" (if msysgit\n> folk care very deeply about it, that is).\n\nMy primary concern is to have the bug fixed on Windows. For this purpose, \nthis patch is sufficiently clean.\n\n-- Hannes\n"}]}