git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] SunOS grep does not understand -C<n>
@ 2009-07-24  5:30 Junio C Hamano
  2009-07-24  5:41 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-07-24  5:30 UTC (permalink / raw)
  To: git

I noticed that the first "grep -C1" test in t7002 does not pass on my 
SunOS-5.11-i86pc, and that is not because our way to spawn external
grep is broken, but because the native grep does not understand -C<n>.

Is it just me and my installation (i.e. I might have failed to install
saner grep from the distribution that everybody uses), or everybody on
SunOS is using this option himself because our Makefile doesn't do that
automatically for them?

Just in case it is the latter, here is a proposed patch.

---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index bde27ed..daf4296 100644
--- a/Makefile
+++ b/Makefile
@@ -728,6 +728,7 @@ ifeq ($(uname_S),SunOS)
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
 	NO_REGEX = YesPlease
+	NO_EXTERNAL_GREP = YesPlease
 	ifeq ($(uname_R),5.7)
 		NEEDS_RESOLV = YesPlease
 		NO_IPV6 = YesPlease

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

* Re: [PATCH/RFC] SunOS grep does not understand -C<n>
  2009-07-24  5:30 [PATCH/RFC] SunOS grep does not understand -C<n> Junio C Hamano
@ 2009-07-24  5:41 ` Jeff King
  2009-07-24  6:27   ` Junio C Hamano
  2009-07-24  6:29 ` [PATCH/RFC] FreeBSD iconv function signature is "old" Junio C Hamano
  2009-07-24 15:43 ` [PATCH/RFC] SunOS grep does not understand -C<n> Brandon Casey
  2 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2009-07-24  5:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Jul 23, 2009 at 10:30:07PM -0700, Junio C Hamano wrote:

> I noticed that the first "grep -C1" test in t7002 does not pass on my 
> SunOS-5.11-i86pc, and that is not because our way to spawn external
> grep is broken, but because the native grep does not understand -C<n>.
> 
> Is it just me and my installation (i.e. I might have failed to install
> saner grep from the distribution that everybody uses), or everybody on
> SunOS is using this option himself because our Makefile doesn't do that
> automatically for them?
> 
> Just in case it is the latter, here is a proposed patch.

Yes, I've been building with NO_EXTERNAL_GREP for my test box. The grep
from Solaris 8, at least, doesn't understand '-e' either, which causes
it to fail many other tests.

-Peff

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

* Re: [PATCH/RFC] SunOS grep does not understand -C<n>
  2009-07-24  5:41 ` Jeff King
@ 2009-07-24  6:27   ` Junio C Hamano
  2009-07-24  7:09     ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-07-24  6:27 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Jeff King <peff@peff.net> writes:

> On Thu, Jul 23, 2009 at 10:30:07PM -0700, Junio C Hamano wrote:
>
>> I noticed that the first "grep -C1" test in t7002 does not pass on my 
>> SunOS-5.11-i86pc, and that is not because our way to spawn external
>> grep is broken, but because the native grep does not understand -C<n>.
>> 
>> Is it just me and my installation (i.e. I might have failed to install
>> saner grep from the distribution that everybody uses), or everybody on
>> SunOS is using this option himself because our Makefile doesn't do that
>> automatically for them?
>> 
>> Just in case it is the latter, here is a proposed patch.
>
> Yes, I've been building with NO_EXTERNAL_GREP for my test box. The grep
> from Solaris 8, at least, doesn't understand '-e' either, which causes
> it to fail many other tests.

Thanks.

Just to double check, do we have "grep -e" (not "git grep -e") that makes
Solaris fail?  I didn't notice.  Or do you mean "git grep -e" fails
without NO_EXTERNAL_GREP?

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

* [PATCH/RFC] FreeBSD iconv function signature is "old"
  2009-07-24  5:30 [PATCH/RFC] SunOS grep does not understand -C<n> Junio C Hamano
  2009-07-24  5:41 ` Jeff King
@ 2009-07-24  6:29 ` Junio C Hamano
  2009-12-26  9:09   ` Junio C Hamano
  2009-07-24 15:43 ` [PATCH/RFC] SunOS grep does not understand -C<n> Brandon Casey
  2 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2009-07-24  6:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

I noticed that my build on FreeBSD-7.2-RELEASE-i386 fails without
OLD_ICONV=YesPlease.

Is it just me and my installation (i.e. I might have failed to install
saner iconv from the port that everybody uses), or is everybody who runs
on FreeBSD using this option himself because our Makefile doesn't do that
automatically for them?

Just in case it is the latter, here is a proposed patch.

---

 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index bde27ed..9a25c08 100644
--- a/Makefile
+++ b/Makefile
@@ -777,6 +777,7 @@ ifeq ($(uname_O),Cygwin)
 endif
 ifeq ($(uname_S),FreeBSD)
 	NEEDS_LIBICONV = YesPlease
+	OLD_ICONV = YesPlease
 	NO_MEMMEM = YesPlease
 	BASIC_CFLAGS += -I/usr/local/include
 	BASIC_LDFLAGS += -L/usr/local/lib

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

* Re: [PATCH/RFC] SunOS grep does not understand -C<n>
  2009-07-24  6:27   ` Junio C Hamano
@ 2009-07-24  7:09     ` Jeff King
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff King @ 2009-07-24  7:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Jul 23, 2009 at 11:27:00PM -0700, Junio C Hamano wrote:

> > Yes, I've been building with NO_EXTERNAL_GREP for my test box. The grep
> > from Solaris 8, at least, doesn't understand '-e' either, which causes
> > it to fail many other tests.
> 
> Thanks.
> 
> Just to double check, do we have "grep -e" (not "git grep -e") that makes
> Solaris fail?  I didn't notice.  Or do you mean "git grep -e" fails
> without NO_EXTERNAL_GREP?

I meant the latter; t7002 tests "git grep -e", which fails without
NO_EXTERNAL_GREP.

-Peff

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

* Re: [PATCH/RFC] SunOS grep does not understand -C<n>
  2009-07-24  5:30 [PATCH/RFC] SunOS grep does not understand -C<n> Junio C Hamano
  2009-07-24  5:41 ` Jeff King
  2009-07-24  6:29 ` [PATCH/RFC] FreeBSD iconv function signature is "old" Junio C Hamano
@ 2009-07-24 15:43 ` Brandon Casey
  2009-07-24 15:55   ` Junio C Hamano
  2 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King

Junio C Hamano wrote:
> I noticed that the first "grep -C1" test in t7002 does not pass on my 
> SunOS-5.11-i86pc, and that is not because our way to spawn external
> grep is broken, but because the native grep does not understand -C<n>.
> 
> Is it just me and my installation (i.e. I might have failed to install
> saner grep from the distribution that everybody uses), or everybody on
> SunOS is using this option himself because our Makefile doesn't do that
> automatically for them?

Hmm.  I have _not_ been setting NO_EXTERNAL_GREP and the tests have _not_
been failing.

The system grep does not seem to have the -C option:

   # /usr/xpg4/bin/grep -C1 include ws.c
   /usr/xpg4/bin/grep: illegal option -- C
   Usage:  grep [-E|-F] [-c|-l|-q] [-bhinsvwx] [file ...]
   grep [-E|-F] [-c|-l|-q] [-bhinsvwx] -e pattern... [-f pattern_file]...[file...]
   grep [-E|-F] [-c|-l|-q] [-bhinsvwx] [-e pattern]... -f pattern_file [file...]

but git grep -C1 works fine

   # git grep -C1 include ws.c
   ws.c-
   ws.c:#include "cache.h"
   ws.c:#include "attr.h"
   ws.c-

I have been compiling with the SUNWspro compiler suite though, and I see these
statements in builtin-grep.c:

   #ifndef NO_EXTERNAL_GREP
   #ifdef __unix__
   #define NO_EXTERNAL_GREP 0
   #else
   #define NO_EXTERNAL_GREP 1
   #endif
   #endif

So possibly, the SUNWspro compiler does not set the __unix__ macro.  A quick
compile of a test program confirms it.

   #include <stdio.h>

   int main (int argc, char* argv[])
   {
   #ifdef __unix__
   	puts("__unix__ is set");
   #else
   	puts("__unix__ is not set");
   #endif
   	return 0;
   }

   # /opt/SUNWspro/bin/cc -o test.out test.c
   ./test.out
   __unix__ is not set

   # gcc -o test.out test.c
   __unix__ is set

So, I have been getting NO_EXTERNAL_GREP all along without knowing it.

-brandon

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

* Re: [PATCH/RFC] SunOS grep does not understand -C<n>
  2009-07-24 15:43 ` [PATCH/RFC] SunOS grep does not understand -C<n> Brandon Casey
@ 2009-07-24 15:55   ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-07-24 15:55 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, Jeff King

Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:

> So, I have been getting NO_EXTERNAL_GREP all along without knowing it.

Thanks for a detailed analysis.  I use gcc, and I suspect Peff also does.
So it seems that I should apply my "in case it is the latter" patch.

Thanks.

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

* [PATCH/RFC] FreeBSD iconv function signature is "old"
  2009-07-24  6:29 ` [PATCH/RFC] FreeBSD iconv function signature is "old" Junio C Hamano
@ 2009-12-26  9:09   ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-12-26  9:09 UTC (permalink / raw)
  To: git

Junio C Hamano <gitster@pobox.com> writes:

> I noticed that my build on FreeBSD-7.2-RELEASE-i386 fails without
> OLD_ICONV=YesPlease.
>
> Is it just me and my installation (i.e. I might have failed to install
> saner iconv from the port that everybody uses), or is everybody who runs
> on FreeBSD using this option himself because our Makefile doesn't do that
> automatically for them?
>
> Just in case it is the latter, here is a proposed patch.

By the way, FreeBSD-8.0-RELEASE-i386 has the same issue.  I'll queue it to
'maint' unless anybody objects...

>  Makefile |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index bde27ed..9a25c08 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -777,6 +777,7 @@ ifeq ($(uname_O),Cygwin)
>  endif
>  ifeq ($(uname_S),FreeBSD)
>  	NEEDS_LIBICONV = YesPlease
> +	OLD_ICONV = YesPlease
>  	NO_MEMMEM = YesPlease
>  	BASIC_CFLAGS += -I/usr/local/include
>  	BASIC_LDFLAGS += -L/usr/local/lib

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

end of thread, other threads:[~2009-12-26  9:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24  5:30 [PATCH/RFC] SunOS grep does not understand -C<n> Junio C Hamano
2009-07-24  5:41 ` Jeff King
2009-07-24  6:27   ` Junio C Hamano
2009-07-24  7:09     ` Jeff King
2009-07-24  6:29 ` [PATCH/RFC] FreeBSD iconv function signature is "old" Junio C Hamano
2009-12-26  9:09   ` Junio C Hamano
2009-07-24 15:43 ` [PATCH/RFC] SunOS grep does not understand -C<n> Brandon Casey
2009-07-24 15:55   ` 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).