All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure
@ 2012-04-17 18:00 Ramsay Jones
  2012-04-18 20:22 ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2012-04-17 18:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, GIT Mailing-list


The current t9300-fast-import.sh test number 62 ("L: nested tree
copy does not corrupt deltas") was introduced in commit 9a0edb79
("fast-import: add a test for tree delta base corruption",
15-08-2011). A fix for the demonstrated problem was introduced
by commit 8fb3ad76 ("fast-import: prevent producing bad delta",
15-08-2011). However, this fix didn't work on MinGW and so this
test has always failed on MinGW.

Part of the solution in commit 8fb3ad76 was to add an NO_DELTA
preprocessor constant which was defined as follows:

  +/*
  + * We abuse the setuid bit on directories to mean "do not delta".
  + */
  +#define NO_DELTA S_ISUID
  +

Unfortunately, the S_ISUID constant on MinGW is defined as zero.

In order to fix the problem, we simply alter the definition of
S_ISUID in the mingw header file to a more appropriate value.
Also, we take the opportunity to similarly define S_ISGID and
S_ISVTX.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 compat/mingw.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index ef5b150..61a6521 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -22,9 +22,10 @@ typedef int socklen_t;
 #define S_IWOTH 0
 #define S_IXOTH 0
 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-#define S_ISUID 0
-#define S_ISGID 0
-#define S_ISVTX 0
+
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
 
 #define WIFEXITED(x) 1
 #define WIFSIGNALED(x) 0
-- 
1.7.10

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

* Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure
  2012-04-17 18:00 [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure Ramsay Jones
@ 2012-04-18 20:22 ` Johannes Sixt
  2012-05-01 14:30   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2012-04-18 20:22 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

Am 17.04.2012 20:00, schrieb Ramsay Jones:
> 
> The current t9300-fast-import.sh test number 62 ("L: nested tree
> copy does not corrupt deltas") was introduced in commit 9a0edb79
> ("fast-import: add a test for tree delta base corruption",
> 15-08-2011). A fix for the demonstrated problem was introduced
> by commit 8fb3ad76 ("fast-import: prevent producing bad delta",
> 15-08-2011). However, this fix didn't work on MinGW and so this
> test has always failed on MinGW.
> 
> Part of the solution in commit 8fb3ad76 was to add an NO_DELTA
> preprocessor constant which was defined as follows:
> 
>   +/*
>   + * We abuse the setuid bit on directories to mean "do not delta".
>   + */
>   +#define NO_DELTA S_ISUID
>   +
> 
> Unfortunately, the S_ISUID constant on MinGW is defined as zero.
> 
> In order to fix the problem, we simply alter the definition of
> S_ISUID in the mingw header file to a more appropriate value.
> Also, we take the opportunity to similarly define S_ISGID and
> S_ISVTX.
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>  compat/mingw.h |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/compat/mingw.h b/compat/mingw.h
> index ef5b150..61a6521 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -22,9 +22,10 @@ typedef int socklen_t;
>  #define S_IWOTH 0
>  #define S_IXOTH 0
>  #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
> -#define S_ISUID 0
> -#define S_ISGID 0
> -#define S_ISVTX 0
> +
> +#define S_ISUID 0004000
> +#define S_ISGID 0002000
> +#define S_ISVTX 0001000
>  
>  #define WIFEXITED(x) 1
>  #define WIFSIGNALED(x) 0

I've submitted a similar patch, but it was suggested to solve the
inherent problem in a cleaner way, but no patch came forward.

-- Hannes

See http://thread.gmane.org/gmane.comp.version-control.git/181817

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

* Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure
  2012-04-18 20:22 ` Johannes Sixt
@ 2012-05-01 14:30   ` Junio C Hamano
  2012-05-01 19:44     ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2012-05-01 14:30 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Ramsay Jones, GIT Mailing-list

Johannes Sixt <j6t@kdbg.org> writes:

>> ...
>> -#define S_ISGID 0
>> -#define S_ISVTX 0
>> +
>> +#define S_ISUID 0004000
>> +#define S_ISGID 0002000
>> +#define S_ISVTX 0001000
>>  
>>  #define WIFEXITED(x) 1
>>  #define WIFSIGNALED(x) 0
>
> I've submitted a similar patch, but it was suggested to solve the
> inherent problem in a cleaner way, but no patch came forward.

I think this patch should be fine, either as the final solution, or the
first step for "solving the inherent problem in a cleaner way" (if msysgit
folk care very deeply about it, that is).

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

* Re: [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure
  2012-05-01 14:30   ` Junio C Hamano
@ 2012-05-01 19:44     ` Johannes Sixt
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2012-05-01 19:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramsay Jones, GIT Mailing-list

Am 01.05.2012 16:30, schrieb Junio C Hamano:
> Johannes Sixt<j6t@kdbg.org>  writes:
>
>>> ...
>>> -#define S_ISGID 0
>>> -#define S_ISVTX 0
>>> +
>>> +#define S_ISUID 0004000
>>> +#define S_ISGID 0002000
>>> +#define S_ISVTX 0001000
>>>
>>>   #define WIFEXITED(x) 1
>>>   #define WIFSIGNALED(x) 0
>>
>> I've submitted a similar patch, but it was suggested to solve the
>> inherent problem in a cleaner way, but no patch came forward.
>
> I think this patch should be fine, either as the final solution, or the
> first step for "solving the inherent problem in a cleaner way" (if msysgit
> folk care very deeply about it, that is).

My primary concern is to have the bug fixed on Windows. For this purpose, 
this patch is sufficiently clean.

-- Hannes

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

end of thread, other threads:[~2012-05-01 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-17 18:00 [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure Ramsay Jones
2012-04-18 20:22 ` Johannes Sixt
2012-05-01 14:30   ` Junio C Hamano
2012-05-01 19:44     ` Johannes Sixt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.