# [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin

8 messages from 2010-12-14 to 2010-12-18. Participants: Ramsay Jones, Junio C Hamano, Eric Sunshine, Johannes Sixt.
Thread: https://gitlist.dev/t/26065

## Ramsay Jones, 2010-12-14 18:34

Subject: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D07B8B5.2030409@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4D07B8B5.2030409%40ramsay1.demon.co.uk

```

The test using the conflict_hunks helper function (test 9) fails
on cygwin, since sed (by default) throws away the CR from CRLF
line endings. This behaviour is undesirable, since the validation
code expects the CRLF line-ending to be present. In order to fix
the problem we pass the -b (--binary) option to sed, using the
SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
conditional initialisation of SED_OPTIONS.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Note that this test does not fail on MinGW, but I don't
really know why, given commit ca02ad3... ahem ;-)

 t/t3032-merge-recursive-options.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/t/t3032-merge-recursive-options.sh b/t/t3032-merge-recursive-options.sh
index 2293797..f70f6c4 100755
--- a/t/t3032-merge-recursive-options.sh
+++ b/t/t3032-merge-recursive-options.sh
@@ -13,9 +13,11 @@ test_description='merge-recursive options
 
 . ./test-lib.sh
 
+test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
+
 test_expect_success 'setup' '
 	conflict_hunks () {
-		sed -n -e "
+		sed $SED_OPTIONS -n -e "
 			/^<<<</ b inconflict
 			b
 			: inconflict
-- 
1.7.3

```

## Junio C Hamano, 2010-12-14 19:24

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <7vtyigtaxn.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vtyigtaxn.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4D07B8B5.2030409@ramsay1.demon.co.uk>

```
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> The test using the conflict_hunks helper function (test 9) fails
> on cygwin, since sed (by default) throws away the CR from CRLF
> line endings. This behaviour is undesirable, since the validation
> code expects the CRLF line-ending to be present. In order to fix
> the problem we pass the -b (--binary) option to sed, using the
> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
> conditional initialisation of SED_OPTIONS.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> Note that this test does not fail on MinGW, but I don't
> really know why, given commit ca02ad3... ahem ;-)

Ahem, indeed.  Why?

```

## Eric Sunshine, 2010-12-14 23:32

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D07FE91.2090003@sunshineco.com>
URL: https://gitlist.dev/e/4D07FE91.2090003%40sunshineco.com
In-Reply-To: <7vtyigtaxn.fsf@alter.siamese.dyndns.org>

```
On 12/14/2010 2:24 PM, Junio C Hamano wrote:
> Ramsay Jones<ramsay@ramsay1.demon.co.uk>  writes:
>> The test using the conflict_hunks helper function (test 9) fails
>> on cygwin, since sed (by default) throws away the CR from CRLF
>> line endings. This behaviour is undesirable, since the validation
>> code expects the CRLF line-ending to be present. In order to fix
>> the problem we pass the -b (--binary) option to sed, using the
>> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
>> conditional initialisation of SED_OPTIONS.
>>
>> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
>> ---
>>
>> Note that this test does not fail on MinGW, but I don't
>> really know why, given commit ca02ad3... ahem ;-)
>
> Ahem, indeed.  Why?

t3032 does indeed fail on MinGW, and was fixed in the msysgit port by 
[1], but was subsequently "lost" when msysgit was rebased onto 
junio/next [2] which did not have that test. Consequently, the fix never 
made it into the mainline git source.

[1]: 
http://groups.google.com/group/msysgit/browse_thread/thread/587d32ee034b0cbe/dca93dc6ad755012#dca93dc6ad755012
[2]: 
http://groups.google.com/group/msysgit/browse_thread/thread/d522ec5c13a3af0b/718eaedffc042fb5#718eaedffc042fb5

-- ES

```

## Johannes Sixt, 2010-12-15 08:22

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D087AC7.2090705@viscovery.net>
URL: https://gitlist.dev/e/4D087AC7.2090705%40viscovery.net
In-Reply-To: <4D07FE91.2090003@sunshineco.com>

```
Am 12/15/2010 0:32, schrieb Eric Sunshine:
> On 12/14/2010 2:24 PM, Junio C Hamano wrote:
>> Ramsay Jones<ramsay@ramsay1.demon.co.uk>  writes:
>>> The test using the conflict_hunks helper function (test 9) fails
>>> on cygwin, since sed (by default) throws away the CR from CRLF
>>> line endings. This behaviour is undesirable, since the validation
>>> code expects the CRLF line-ending to be present. In order to fix
>>> the problem we pass the -b (--binary) option to sed, using the
>>> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
>>> conditional initialisation of SED_OPTIONS.
>>>
>>> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
>>> ---
>>>
>>> Note that this test does not fail on MinGW, but I don't
>>> really know why, given commit ca02ad3... ahem ;-)
>>
>> Ahem, indeed.  Why?
> 
> t3032 does indeed fail on MinGW, and was fixed in the msysgit port by [1],
> but was subsequently "lost" when msysgit was rebased onto junio/next [2]
> which did not have that test. Consequently, the fix never made it into the
> mainline git source.

Sorry, but on MinGW, I only need the GREP_OPTIONS part of that fix, but
not the SED_OPTIONS. It's also mysterious for me.

OTOH, the fix in ca02ad3 that applies to t6038, does not work for me as is
because my sed does not understand -b; it needs --nocr. Maybe it is the
sed version that makes the difference?

D:\Src\mingw-git\t>sed --version
GNU sed version 3.02
...

-- Hannes

```

## Eric Sunshine, 2010-12-15 09:30

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D088AB6.5090501@sunshineco.com>
URL: https://gitlist.dev/e/4D088AB6.5090501%40sunshineco.com
In-Reply-To: <4D087AC7.2090705@viscovery.net>

```
On 12/15/2010 3:22 AM, Johannes Sixt wrote:
> Am 12/15/2010 0:32, schrieb Eric Sunshine:
>> On 12/14/2010 2:24 PM, Junio C Hamano wrote:
>>> Ramsay Jones<ramsay@ramsay1.demon.co.uk>   writes:
>>>> The test using the conflict_hunks helper function (test 9) fails
>>>> on cygwin, since sed (by default) throws away the CR from CRLF
>>>> line endings. This behaviour is undesirable, since the validation
>>>> code expects the CRLF line-ending to be present. In order to fix
>>>> the problem we pass the -b (--binary) option to sed, using the
>>>> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
>>>> conditional initialisation of SED_OPTIONS.
>>>>
>>>> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
>>>> ---
>>>>
>>>> Note that this test does not fail on MinGW, but I don't
>>>> really know why, given commit ca02ad3... ahem ;-)
>>>
>>> Ahem, indeed.  Why?
>>
>> t3032 does indeed fail on MinGW, and was fixed in the msysgit port by [1],
>> but was subsequently "lost" when msysgit was rebased onto junio/next [2]
>> which did not have that test. Consequently, the fix never made it into the
>> mainline git source.
>
> Sorry, but on MinGW, I only need the GREP_OPTIONS part of that fix, but
> not the SED_OPTIONS. It's also mysterious for me.
>
> OTOH, the fix in ca02ad3 that applies to t6038, does not work for me as is
> because my sed does not understand -b; it needs --nocr. Maybe it is the
> sed version that makes the difference?
>
> D:\Src\mingw-git\t>sed --version
> GNU sed version 3.02

Failure of t3032 was reported by Pat Thoyts [1] when preparing for the 
v1.7.3 release. The problem was diagnosed and patched via [2] under the 
standard msysgit netinstall [3] environment. From commit message [2], 
GREP_OPTIONS and SED_OPTIONS were applied to resolve distinct cases of 
line-terminator "corruption" (t3032.4-t3032.8 and t3032.9, respectively) 
within that environment at the time the patch was prepared.

Your tool versions may indeed not be compatible with those of the 
netinstall environment [3]:

$ sed --version
GNU sed version 4.2.1

Unfortunately, the old --nocr is not recognized by modern GNU sed:

$ sed --nocr
sed: unrecognized option `--nocr'

[1]: 
http://groups.google.com/group/msysgit/browse_thread/thread/70110298ae72caea/a39b121bb0feccf4?lnk=gst&q=t3032#a39b121bb0feccf4
[2]: 
http://groups.google.com/group/msysgit/browse_thread/thread/587d32ee034b0cbe/dca93dc6ad755012#dca93dc6ad755012
[3]: http://code.google.com/p/msysgit/downloads/list 
[msysGit-netinstall-1.7.3.1-preview20101002.exe]

-- ES

```

## Ramsay Jones, 2010-12-16 21:19

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D0A8250.5090403@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4D0A8250.5090403%40ramsay1.demon.co.uk
In-Reply-To: <4D088AB6.5090501@sunshineco.com>

```
Eric Sunshine wrote:
> On 12/15/2010 3:22 AM, Johannes Sixt wrote:
>> Am 12/15/2010 0:32, schrieb Eric Sunshine:
>>> On 12/14/2010 2:24 PM, Junio C Hamano wrote:
>>>> Ramsay Jones<ramsay@ramsay1.demon.co.uk>   writes:
>>>>> The test using the conflict_hunks helper function (test 9) fails
>>>>> on cygwin, since sed (by default) throws away the CR from CRLF
>>>>> line endings. This behaviour is undesirable, since the validation
>>>>> code expects the CRLF line-ending to be present. In order to fix
>>>>> the problem we pass the -b (--binary) option to sed, using the
>>>>> SED_OPTIONS variable. We use the SED_STRIPS_CR prerequisite in the
>>>>> conditional initialisation of SED_OPTIONS.
>>>>>
>>>>> Signed-off-by: Ramsay Jones<ramsay@ramsay1.demon.co.uk>
>>>>> ---
>>>>>
>>>>> Note that this test does not fail on MinGW, but I don't
>>>>> really know why, given commit ca02ad3... ahem ;-)
>>>> Ahem, indeed.  Why?
>>> t3032 does indeed fail on MinGW, and was fixed in the msysgit port by [1],
>>> but was subsequently "lost" when msysgit was rebased onto junio/next [2]
>>> which did not have that test. Consequently, the fix never made it into the
>>> mainline git source.
>> Sorry, but on MinGW, I only need the GREP_OPTIONS part of that fix, but
>> not the SED_OPTIONS. It's also mysterious for me.
>>
>> OTOH, the fix in ca02ad3 that applies to t6038, does not work for me as is
>> because my sed does not understand -b; it needs --nocr. Maybe it is the
>> sed version that makes the difference?
>>
>> D:\Src\mingw-git\t>sed --version
>> GNU sed version 3.02
> 
> Failure of t3032 was reported by Pat Thoyts [1] when preparing for the 
> v1.7.3 release. The problem was diagnosed and patched via [2] under the 
> standard msysgit netinstall [3] environment. From commit message [2], 
> GREP_OPTIONS and SED_OPTIONS were applied to resolve distinct cases of 
> line-terminator "corruption" (t3032.4-t3032.8 and t3032.9, respectively) 
> within that environment at the time the patch was prepared.
> 
> Your tool versions may indeed not be compatible with those of the 
> netinstall environment [3]:
> 
> $ sed --version
> GNU sed version 4.2.1
> 
> Unfortunately, the old --nocr is not recognized by modern GNU sed:
> 
> $ sed --nocr
> sed: unrecognized option `--nocr'

Yes. Like Johannes, I have sed version 3.02 on MinGW, but on cygwin
I have sed version 4.1.5. See patch #14, where I introduce the
SED_BIN_OPT variable to allow me to run the tests with SED_OPTIONS
set to -c instead of -b.

[I thought I was unusual in having such an old sed version, but
apparently not... ;-) ]

ATB,
Ramsay Jones

```

## Johannes Sixt, 2010-12-17 07:34

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D0B126A.8080702@viscovery.net>
URL: https://gitlist.dev/e/4D0B126A.8080702%40viscovery.net
In-Reply-To: <4D0A8250.5090403@ramsay1.demon.co.uk>

```
Am 12/16/2010 22:19, schrieb Ramsay Jones:
> Eric Sunshine wrote:
>> Your tool versions may indeed not be compatible with those of the 
>> netinstall environment [3]:
>>
>> $ sed --version
>> GNU sed version 4.2.1
>>
>> Unfortunately, the old --nocr is not recognized by modern GNU sed:
>>
>> $ sed --nocr
>> sed: unrecognized option `--nocr'
> 
> Yes. Like Johannes, I have sed version 3.02 on MinGW, but on cygwin
> I have sed version 4.1.5. See patch #14, where I introduce the
> SED_BIN_OPT variable to allow me to run the tests with SED_OPTIONS
> set to -c instead of -b.
> 
> [I thought I was unusual in having such an old sed version, but
> apparently not... ;-) ]

As far as I'm concerned, I'm not married to this old version, and I'll
update to a recent msysgit/MinGW environment RSN. So, in the long run,
your setup might turn out to be unusal ;-)

-- Hannes

```

## Ramsay Jones, 2010-12-18 20:16

Subject: Re: [PATCH 11/14] t3032-*.sh: Pass the -b (--binary) option to sed on cygwin
Message-ID: <4D0D16A5.1010406@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/4D0D16A5.1010406%40ramsay1.demon.co.uk
In-Reply-To: <4D0B126A.8080702@viscovery.net>

```
Johannes Sixt wrote:
>> [I thought I was unusual in having such an old sed version, but
>> apparently not... ;-) ]
> 
> As far as I'm concerned, I'm not married to this old version, and I'll
> update to a recent msysgit/MinGW environment RSN. So, in the long run,
> your setup might turn out to be unusal ;-)

Yeah, I've been meaning to upgrade too. (However, I've been saying that
for quite some time now!)

[I had to install the Perl CGI module by hand to get one test to run.
(There is something funny going on with the Config, ExtUtils and Test
modules as well!)]

ATB,
Ramsay Jones

```
