git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400
@ 2012-04-09 20:13 Ben Walton
  2012-04-14 23:19 ` Ben Walton
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Walton @ 2012-04-09 20:13 UTC (permalink / raw)
  To: gitster; +Cc: git, Ben Walton

The grep in Solaris' /usr/xpg4/bin as found by the default
SANE_TOOL_PATH was not properly handling the 'cvs co -c (shows module
database)' test.  The [\t ] character set selection does not properly
trigger so the first grep in the test fails.

Instead of working around this issue, switch to using the standard
test_cmp() shell function to perform the comparison instead.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---

It's possible that the specific pair of grep statements is required.
It's looking for tab or space, so maybe we get either character in
some cases, depending on cvs version?  This passed the test suite
using cvs 1.12.13 for OpenCSW.

If there is a reason for the original construction, I'll find a more
creative work around for this problem.

 t/t9400-git-cvsserver-server.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 9199550..df1405f 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -500,8 +500,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
 cd "$WORKDIR"
 test_expect_success 'cvs co -c (shows module database)' '
     GIT_CONFIG="$git_config" cvs co -c > out &&
-    grep "^master[	 ]\+master$" < out &&
-    ! grep -v "^master[	 ]\+master$" < out
+    echo "master	master" > out.expected &&
+    test_cmp out out.expected
 '
 
 #------------
-- 
1.7.9

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

* Re: [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400
  2012-04-09 20:13 [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400 Ben Walton
@ 2012-04-14 23:19 ` Ben Walton
  2012-04-19 16:55   ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Walton @ 2012-04-14 23:19 UTC (permalink / raw)
  To: gitster, git

Excerpts from Ben Walton's message of Mon Apr 09 16:13:29 -0400 2012:

Bump?

Thanks
-Ben

> The grep in Solaris' /usr/xpg4/bin as found by the default
> SANE_TOOL_PATH was not properly handling the 'cvs co -c (shows module
> database)' test.  The [\t ] character set selection does not properly
> trigger so the first grep in the test fails.
> 
> Instead of working around this issue, switch to using the standard
> test_cmp() shell function to perform the comparison instead.
> 
> Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
> ---
> 
> It's possible that the specific pair of grep statements is required.
> It's looking for tab or space, so maybe we get either character in
> some cases, depending on cvs version?  This passed the test suite
> using cvs 1.12.13 for OpenCSW.
> 
> If there is a reason for the original construction, I'll find a more
> creative work around for this problem.
> 
>  t/t9400-git-cvsserver-server.sh |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
> index 9199550..df1405f 100755
> --- a/t/t9400-git-cvsserver-server.sh
> +++ b/t/t9400-git-cvsserver-server.sh
> @@ -500,8 +500,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
>  cd "$WORKDIR"
>  test_expect_success 'cvs co -c (shows module database)' '
>      GIT_CONFIG="$git_config" cvs co -c > out &&
> -    grep "^master[     ]\+master$" < out &&
> -    ! grep -v "^master[     ]\+master$" < out
> +    echo "master    master" > out.expected &&
> +    test_cmp out out.expected
>  '
>  
>  #------------
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

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

* Re: [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400
  2012-04-14 23:19 ` Ben Walton
@ 2012-04-19 16:55   ` Junio C Hamano
  2012-04-19 17:39     ` Ben Walton
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2012-04-19 16:55 UTC (permalink / raw)
  To: Ben Walton; +Cc: gitster, git

Ben Walton <bwalton@artsci.utoronto.ca> writes:

> Excerpts from Ben Walton's message of Mon Apr 09 16:13:29 -0400 2012:
>
> Bump?
> ...
>> It's possible that the specific pair of grep statements is required.
>> It's looking for tab or space, so maybe we get either character in
>> some cases, depending on cvs version?

Bump, anybody, on this point?

>> If there is a reason for the original construction, I'll find a more
>> creative work around for this problem.
>> 
>>  t/t9400-git-cvsserver-server.sh |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
>> index 9199550..df1405f 100755
>> --- a/t/t9400-git-cvsserver-server.sh
>> +++ b/t/t9400-git-cvsserver-server.sh
>> @@ -500,8 +500,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
>>  cd "$WORKDIR"
>>  test_expect_success 'cvs co -c (shows module database)' '
>>      GIT_CONFIG="$git_config" cvs co -c > out &&
>> -    grep "^master[     ]\+master$" < out &&
>> -    ! grep -v "^master[     ]\+master$" < out

Is it really the character class, or is it the GNUism "\+", that breaks
this?

In other words, does it work if you patch it like this instead?

 t/t9400-git-cvsserver-server.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 9199550..173bf3d 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -500,8 +500,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
 cd "$WORKDIR"
 test_expect_success 'cvs co -c (shows module database)' '
     GIT_CONFIG="$git_config" cvs co -c > out &&
-    grep "^master[	 ]\+master$" < out &&
-    ! grep -v "^master[	 ]\+master$" < out
+    grep "^master[	 ][ 	]*master$" <out &&
+    ! grep -v "^master[	 ][ 	]*master$" <out
 '
 
 #------------

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

* Re: [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400
  2012-04-19 16:55   ` Junio C Hamano
@ 2012-04-19 17:39     ` Ben Walton
  2012-04-19 20:06       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Walton @ 2012-04-19 17:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT List

Excerpts from Junio C Hamano's message of Thu Apr 19 12:55:53 -0400 2012:

> Is it really the character class, or is it the GNUism "\+", that breaks
> this?

Yes, you're right, it is the \+.  I didn't look carefully enough when
I saw that test_cmp looked like the way to fix this.

I'll re-word the patch...

> In other words, does it work if you patch it like this instead?

> -    grep "^master[     ]\+master$" < out &&
> -    ! grep -v "^master[     ]\+master$" < out
> +    grep "^master[     ][     ]*master$" <out &&
> +    ! grep -v "^master[     ][     ]*master$" <out
>  '

This does work and if there is some significance to the space or tab
then it's a better patch.

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

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

* Re: [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400
  2012-04-19 17:39     ` Ben Walton
@ 2012-04-19 20:06       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-04-19 20:06 UTC (permalink / raw)
  To: Ben Walton; +Cc: Junio C Hamano, GIT List

Ben Walton <bwalton@artsci.utoronto.ca> writes:

> This does work and if there is some significance to the space or tab
> then it's a better patch.

Ok, I'll queue this:

-- >8 --
From: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] t9400: fix gnuism in grep

Using "\+" in "grep" and expecting that it means one or more
is a GNUism.  Spell it in a dumb and portable way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t9400-git-cvsserver-server.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 9199550..173bf3d 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -500,8 +500,8 @@ test_expect_success 'cvs status (no subdirs in header)' '
 cd "$WORKDIR"
 test_expect_success 'cvs co -c (shows module database)' '
     GIT_CONFIG="$git_config" cvs co -c > out &&
-    grep "^master[	 ]\+master$" < out &&
-    ! grep -v "^master[	 ]\+master$" < out
+    grep "^master[	 ][ 	]*master$" <out &&
+    ! grep -v "^master[	 ][ 	]*master$" <out
 '
 
 #------------
-- 
1.7.10.282.g21208e

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

end of thread, other threads:[~2012-04-19 20:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-09 20:13 [PATCH] Avoid problem with xpg4 grep in Solaris that broke t9400 Ben Walton
2012-04-14 23:19 ` Ben Walton
2012-04-19 16:55   ` Junio C Hamano
2012-04-19 17:39     ` Ben Walton
2012-04-19 20:06       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).