# [PATCH] Mingw: verify both ends of the pipe () call

9 messages from 2015-08-27 to 2015-08-28. Participants: Johannes Schindelin, Jonathan Nieder, Johannes Sixt, Junio C Hamano.
Thread: https://gitlist.dev/t/40198

## Johannes Schindelin, 2015-08-27 15:55

Subject: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <0000014f6fdf5839-19f5bc24-80bf-4b9e-a26b-2ef089a28f06-000000@eu-west-1.amazonses.com>
URL: https://gitlist.dev/e/0000014f6fdf5839-19f5bc24-80bf-4b9e-a26b-2ef089a28f06-000000%40eu-west-1.amazonses.com

```
From: jfmc <jfmcjf@gmail.com>

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
 		return -1;
 	}
 	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
 		return -1;

--
https://github.com/git/git/pull/168

```

## Johannes Schindelin, 2015-08-27 16:09

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <a65c938c29ac361fbd056d9e284f1aa9@www.dscho.org>
URL: https://gitlist.dev/e/a65c938c29ac361fbd056d9e284f1aa9%40www.dscho.org
In-Reply-To: <0000014f6fdf5839-19f5bc24-80bf-4b9e-a26b-2ef089a28f06-000000@eu-west-1.amazonses.com>

```
Hi all,

On 2015-08-27 17:55, Johannes Schindelin wrote:
> From: jfmc <jfmcjf@gmail.com>
> 
> The code to open and test the second end of the pipe clearly imitates
> the code for the first end. A little too closely, though... Let's fix
> the obvious copy-edit bug.
> 
> Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---

For what it's worth: this is my first submitGit submission! ;-)

Ciao,
Dscho

```

## Jonathan Nieder, 2015-08-27 21:50

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <20150827215014.GA8165@google.com>
URL: https://gitlist.dev/e/20150827215014.GA8165%40google.com
In-Reply-To: <0000014f6fdf5839-19f5bc24-80bf-4b9e-a26b-2ef089a28f06-000000@eu-west-1.amazonses.com>

```
Johannes Schindelin wrote:

> From: jfmc <jfmcjf@gmail.com>

This means the name shown by git shortlog would be jfmc instead of
Jose F. Morales.  Intended?

> The code to open and test the second end of the pipe clearly imitates
> the code for the first end. A little too closely, though... Let's fix
> the obvious copy-edit bug.
>
> Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  compat/mingw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

This is an old one --- more than 5 years old (since v1.7.0-rc0~86^2~4
"Windows: simplify the pipe(2) implementation", 2010-01-15).  Thanks
for catching it.

Regards,
Jonathan

(patch kept unsnipped for reference)

> diff --git a/compat/mingw.c b/compat/mingw.c
> index 496e6f8..f74da23 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -681,7 +681,7 @@ int pipe(int filedes[2])
>  		return -1;
>  	}
>  	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
> -	if (filedes[0] < 0) {
> +	if (filedes[1] < 0) {
>  		close(filedes[0]);
>  		CloseHandle(h[1]);
>  		return -1;
> 
> --
> https://github.com/git/git/pull/168

```

## Johannes Sixt, 2015-08-28 08:07

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <55E016CE.3070009@kdbg.org>
URL: https://gitlist.dev/e/55E016CE.3070009%40kdbg.org
In-Reply-To: <20150827215014.GA8165@google.com>

```
Am 27.08.2015 um 23:50 schrieb Jonathan Nieder:
> Johannes Schindelin wrote:
>
>> From: jfmc <jfmcjf@gmail.com>
>
> This means the name shown by git shortlog would be jfmc instead of
> Jose F. Morales.  Intended?
>
>> The code to open and test the second end of the pipe clearly imitates
>> the code for the first end. A little too closely, though... Let's fix
>> the obvious copy-edit bug.
>>
>> Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> ---
>>   compat/mingw.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
>
> This is an old one --- more than 5 years old (since v1.7.0-rc0~86^2~4
> "Windows: simplify the pipe(2) implementation", 2010-01-15).  Thanks
> for catching it.

Ouch! Thanks for cleaning up the mess I left behind.

-- Hannes

>
> Regards,
> Jonathan
>
> (patch kept unsnipped for reference)
>
>> diff --git a/compat/mingw.c b/compat/mingw.c
>> index 496e6f8..f74da23 100644
>> --- a/compat/mingw.c
>> +++ b/compat/mingw.c
>> @@ -681,7 +681,7 @@ int pipe(int filedes[2])
>>   		return -1;
>>   	}
>>   	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
>> -	if (filedes[0] < 0) {
>> +	if (filedes[1] < 0) {
>>   		close(filedes[0]);
>>   		CloseHandle(h[1]);
>>   		return -1;
>>

```

## Johannes Schindelin, 2015-08-28 09:39

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <d959c5ad8b7f57e76910ececce47b853@www.dscho.org>
URL: https://gitlist.dev/e/d959c5ad8b7f57e76910ececce47b853%40www.dscho.org
In-Reply-To: <CAEdsdLdEC7KCgYeu8zmPZWm8uORCwshQo2u9FYQKjrq-sV_bZg@mail.gmail.com>

```
Hi Jose,

Please do not top-post; I use top-posting as a tell-tale for mails I can safely delete unread when I have too many mails in my inbox.

On 2015-08-28 08:37, Jose F. Morales wrote:
> Ops... my fault. I was playing with the web editor and forgot that my
> profile didn't had my real name (now it has).

Great!

> Could I still amend the commit? (it seems to be already pushed into master)

It was pushed to Git for Windows' master, but here it was submitted to the Git mailing list.

Junio, would you terribly mind fixing the name on your end? Alternatively, I could try to update the Pull Request and give submitGit another chance to show just how awesome it is.

Ciao,
Dscho

```

## Johannes Schindelin, 2015-08-28 09:43

Subject: [PATCH v2] Mingw: verify both ends of the pipe () call
Message-ID: <0000014f73b0e4ef-12b105a6-5f9c-4131-956f-97a1bd85e072-000000@eu-west-1.amazonses.com>
URL: https://gitlist.dev/e/0000014f73b0e4ef-12b105a6-5f9c-4131-956f-97a1bd85e072-000000%40eu-west-1.amazonses.com
In-Reply-To: <0000014f6fdf5839-19f5bc24-80bf-4b9e-a26b-2ef089a28f06-000000@eu-west-1.amazonses.com>

```
From: Jose F. Morales <jfmcjf@gmail.com>

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 496e6f8..f74da23 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -681,7 +681,7 @@ int pipe(int filedes[2])
 		return -1;
 	}
 	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
-	if (filedes[0] < 0) {
+	if (filedes[1] < 0) {
 		close(filedes[0]);
 		CloseHandle(h[1]);
 		return -1;

--
https://github.com/git/git/pull/168

```

## Johannes Schindelin, 2015-08-28 09:44

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <2d4fc3abf0e3d46fc1072f8f05dff0ce@www.dscho.org>
URL: https://gitlist.dev/e/2d4fc3abf0e3d46fc1072f8f05dff0ce%40www.dscho.org
In-Reply-To: <d959c5ad8b7f57e76910ececce47b853@www.dscho.org>

```
Hi,

On 2015-08-28 11:39, Johannes Schindelin wrote:

> On 2015-08-28 08:37, Jose F. Morales wrote:
> 
>> Could I still amend the commit? (it seems to be already pushed into master)
> 
> It was pushed to Git for Windows' master, but here it was submitted to
> the Git mailing list.
> 
> Junio, would you terribly mind fixing the name on your end?
> Alternatively, I could try to update the Pull Request and give
> submitGit another chance to show just how awesome it is.

Never mind, it was way too easy to let submitGit show how excellent it is.

Ciao,
Dscho

```

## Johannes Schindelin, 2015-08-28 09:52

Subject: Re: [PATCH] Mingw: verify both ends of the pipe () call
Message-ID: <e9a26e1698dfc5b29d12d87c67e734cd@www.dscho.org>
URL: https://gitlist.dev/e/e9a26e1698dfc5b29d12d87c67e734cd%40www.dscho.org
In-Reply-To: <20150827215014.GA8165@google.com>

```
Hi Jonathan,

On 2015-08-27 23:50, Jonathan Nieder wrote:
> Johannes Schindelin wrote:
> 
>> From: jfmc <jfmcjf@gmail.com>
> 
> This means the name shown by git shortlog would be jfmc instead of
> Jose F. Morales.  Intended?

Fixed in v2 ;-)

Ciao,
Dscho

```

## Junio C Hamano, 2015-08-28 18:14

Subject: Re: [PATCH v2] Mingw: verify both ends of the pipe () call
Message-ID: <xmqqtwrj1ds7.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqtwrj1ds7.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <0000014f73b0e4ef-12b105a6-5f9c-4131-956f-97a1bd85e072-000000@eu-west-1.amazonses.com>

```
Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> From: Jose F. Morales <jfmcjf@gmail.com>
>
> The code to open and test the second end of the pipe clearly imitates
> the code for the first end. A little too closely, though... Let's fix
> the obvious copy-edit bug.
>
> Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  compat/mingw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 496e6f8..f74da23 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -681,7 +681,7 @@ int pipe(int filedes[2])
>  		return -1;
>  	}
>  	filedes[1] = _open_osfhandle((int)h[1], O_NOINHERIT);
> -	if (filedes[0] < 0) {
> +	if (filedes[1] < 0) {
>  		close(filedes[0]);
>  		CloseHandle(h[1]);
>  		return -1;
>
> --
> https://github.com/git/git/pull/168

Thanks all.  Will queue directly on 'maint' with reviewed-by's and
acked-by's.

```
