git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/8] enhancing builds on Solaris
       [not found] <7vk53vlxhz.fsf@alter.siamese.dyndns.org>
@ 2009-06-05 23:36 ` Brandon Casey
  2009-06-05 23:36   ` [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Brandon Casey
                     ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

Junio,

Here is a re-roll of the work on Solaris which integrates the ideas from you
and Jeff.  This should replace bc/solaris in pu.

This should allow compiling on Solaris with or without a c99 compiler,
GCC or SUNWspro.

Solaris 7 should be able to compile when using GCC and bash.

-brandon


Brandon Casey (7):
  Makefile: use /usr/ucb/install on SunOS platforms rather than
    ginstall
  Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile
    arguments
  diff-delta.c: "diff.h" is not a required include
  On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX
    spec
  git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris
  Makefile: define __sun__ on SunOS
  Makefile: add section for SunOS 5.7

Junio C Hamano (1):
  Makefile: introduce SANE_TOOL_PATH for prepending required elements
    to PATH

 Makefile          |   40 +++++++++++++++++++++++++++++++++++-----
 diff-delta.c      |    1 -
 git-compat-util.h |   17 ++++++++++++++---
 git-sh-setup.sh   |    2 ++
 utf8.c            |    2 +-
 5 files changed, 52 insertions(+), 10 deletions(-)

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

* [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall
  2009-06-05 23:36 ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
@ 2009-06-05 23:36   ` Brandon Casey
  2009-06-05 23:36     ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Brandon Casey
  2009-06-05 23:46   ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

We can avoid a GNU dependency by using /usr/ucb/install.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 06c39e4..baa05f5 100644
--- a/Makefile
+++ b/Makefile
@@ -726,7 +726,7 @@ ifeq ($(uname_S),SunOS)
 		NO_C99_FORMAT = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
-	INSTALL = ginstall
+	INSTALL = /usr/ucb/install
 	TAR = gtar
 	BASIC_CFLAGS += -D__EXTENSIONS__
 endif
-- 
1.6.3.1.24.g152f4

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

* [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments
  2009-06-05 23:36   ` [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Brandon Casey
@ 2009-06-05 23:36     ` Brandon Casey
  2009-06-05 23:36       ` [PATCH 3/8] diff-delta.c: "diff.h" is not a required include Brandon Casey
  2009-06-06  7:29       ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Jakub Narebski
  0 siblings, 2 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

This library is required on Solaris when compiling with NO_IPV6 since
hstrerror resides in libresolv.  Additionally, Solaris 7 will need it,
since inet_ntop and inet_pton reside there too.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index baa05f5..40642f7 100644
--- a/Makefile
+++ b/Makefile
@@ -95,6 +95,10 @@ all::
 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
 # Patrick Mauritz).
 #
+# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
+# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
+# inet_ntop and inet_pton additionally reside there.
+#
 # Define NO_MMAP if you want to avoid mmap.
 #
 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
@@ -708,7 +712,6 @@ ifeq ($(uname_S),SunOS)
 	SHELL_PATH = /bin/bash
 	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
-	NO_HSTRERROR = YesPlease
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
 	ifneq ($(uname_R),5.11)
@@ -726,6 +729,9 @@ ifeq ($(uname_S),SunOS)
 		NO_C99_FORMAT = YesPlease
 		NO_STRTOUMAX = YesPlease
 	endif
+	ifdef NO_IPV6
+		NEEDS_RESOLV = YesPlease
+	endif
 	INSTALL = /usr/ucb/install
 	TAR = gtar
 	BASIC_CFLAGS += -D__EXTENSIONS__
@@ -981,6 +987,9 @@ endif
 ifdef NEEDS_NSL
 	EXTLIBS += -lnsl
 endif
+ifdef NEEDS_RESOLV
+	EXTLIBS += -lresolv
+endif
 ifdef NO_D_TYPE_IN_DIRENT
 	BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
 endif
-- 
1.6.3.1.24.g152f4

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

* [PATCH 3/8] diff-delta.c: "diff.h" is not a required include
  2009-06-05 23:36     ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Brandon Casey
@ 2009-06-05 23:36       ` Brandon Casey
  2009-06-05 23:36         ` [PATCH 4/8] On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Brandon Casey
  2009-06-06  0:47         ` [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include Brandon Casey
  2009-06-06  7:29       ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Jakub Narebski
  1 sibling, 2 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

This file (diff.h) provides declarations for some functions that are
implemented in diff-delta.c.  The SUNWspro C99 compiler complains about
it.  There is nothing defined in "diff.h" that is required by diff-delta.c,
so don't #include it.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 diff-delta.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/diff-delta.c b/diff-delta.c
index a4e28df..a9969f0 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -12,7 +12,6 @@
  */
 
 #include "git-compat-util.h"
-#include "delta.h"
 
 /* maximum hash entry list for the same hash bucket */
 #define HASH_LIMIT 64
-- 
1.6.3.1.24.g152f4

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

* [PATCH 4/8] On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec
  2009-06-05 23:36       ` [PATCH 3/8] diff-delta.c: "diff.h" is not a required include Brandon Casey
@ 2009-06-05 23:36         ` Brandon Casey
  2009-06-05 23:36           ` [PATCH 5/8] git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris Brandon Casey
  2009-06-06  0:47         ` [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include Brandon Casey
  1 sibling, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

OLD_ICONV is only necessary on Solaris until UNIX03.  This is indicated
by the private macro _XPG6 which is set in /usr/include/sys/feature_tests.h.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile |    3 ---
 utf8.c   |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 40642f7..375cf2a 100644
--- a/Makefile
+++ b/Makefile
@@ -714,9 +714,6 @@ ifeq ($(uname_S),SunOS)
 	NO_MEMMEM = YesPlease
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
-	ifneq ($(uname_R),5.11)
-		OLD_ICONV = UnfortunatelyYes
-	endif
 	ifeq ($(uname_R),5.8)
 		NO_UNSETENV = YesPlease
 		NO_SETENV = YesPlease
diff --git a/utf8.c b/utf8.c
index ddfdc5e..db706ac 100644
--- a/utf8.c
+++ b/utf8.c
@@ -354,7 +354,7 @@ int is_encoding_utf8(const char *name)
  * with iconv.  If the conversion fails, returns NULL.
  */
 #ifndef NO_ICONV
-#ifdef OLD_ICONV
+#if defined(OLD_ICONV) || (defined(__sun__) && !defined(_XPG6))
 	typedef const char * iconv_ibp;
 #else
 	typedef char * iconv_ibp;
-- 
1.6.3.1.24.g152f4

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

* [PATCH 5/8] git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris
  2009-06-05 23:36         ` [PATCH 4/8] On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Brandon Casey
@ 2009-06-05 23:36           ` Brandon Casey
  2009-06-05 23:36             ` [PATCH 6/8] Makefile: define __sun__ on SunOS Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

On Solaris, when _XOPEN_EXTENDED is set, its header file forces the
programs to be XPG4v2, defeating any _XOPEN_SOURCE setting to say we are
XPG5 or XPG6.  Also on Solaris, XPG6 programs must be compiled with a c99
compiler, while non XPG6 programs must be compiled with a pre-c99 compiler.

So when compiling on Solaris, always refrain from setting _XOPEN_EXTENDED,
and then set _XOPEN_SOURCE to 600 or 500 based on whether a c99 compiler
is being used or not.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 git-compat-util.h |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index f25f7f1..13e450d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -39,12 +39,23 @@
 /* Approximation of the length of the decimal representation of this type. */
 #define decimal_length(x)	((int)(sizeof(x) * 2.56 + 0.5) + 1)
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
+#if defined(__sun__)
+ /*
+  * On Solaris, when _XOPEN_EXTENDED is set, its header file
+  * forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE
+  * setting to say we are XPG5 or XPG6.  Also on Solaris,
+  * XPG6 programs must be compiled with a c99 compiler, while
+  * non XPG6 programs must be compiled with a pre-c99 compiler.
+  */
+# if __STDC_VERSION__ - 0 >= 199901L
+# define _XOPEN_SOURCE 600
+# else
+# define _XOPEN_SOURCE 500
+# endif
+#elif !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
-#ifndef __sun__
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
-#endif
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
-- 
1.6.3.1.24.g152f4

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

* [PATCH 6/8] Makefile: define __sun__ on SunOS
  2009-06-05 23:36           ` [PATCH 5/8] git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris Brandon Casey
@ 2009-06-05 23:36             ` Brandon Casey
  2009-06-05 23:36               ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

The SUNWspro compiler does not define __sun__ (like GCC does).  A check of
this macro was recently added to detect compilation on SunOS and to modify
the handling of the NO_ICONV and _XOPEN_SOURCE feature macros.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 375cf2a..1239a3c 100644
--- a/Makefile
+++ b/Makefile
@@ -731,7 +731,7 @@ ifeq ($(uname_S),SunOS)
 	endif
 	INSTALL = /usr/ucb/install
 	TAR = gtar
-	BASIC_CFLAGS += -D__EXTENSIONS__
+	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
 endif
 ifeq ($(uname_O),Cygwin)
 	NO_D_TYPE_IN_DIRENT = YesPlease
-- 
1.6.3.1.24.g152f4

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

* [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-05 23:36             ` [PATCH 6/8] Makefile: define __sun__ on SunOS Brandon Casey
@ 2009-06-05 23:36               ` Brandon Casey
  2009-06-05 23:36                 ` [PATCH 8/8] Makefile: add section for SunOS 5.7 Brandon Casey
  2009-06-08 11:43                 ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Jeff King
  0 siblings, 2 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

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

Some platforms (like SunOS and family) have kept their common binaries at
some historical moment in time, and introduced new binaries with modern
features in a special location like /usr/xpg4/bin or /usr/ucb.  Some of the
features provided by these modern binaries are expected and required by git.
If the featureful binaries are not in the users path, then git could end up
using the less featureful binary and fail.

So provide a mechanism to prepend elements to the users PATH at runtime so
the modern binaries will be found.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile        |   14 ++++++++++++++
 git-sh-setup.sh |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 1239a3c..ca09572 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@ all::
 
 # Define V=1 to have a more verbose compile.
 #
+# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
+#
+# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
+# to PATH if your tools in /usr/bin are broken.
+#
 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
 # or vsnprintf() return -1 instead of number of characters which would
 # have been written to the final string if enough space had been available.
@@ -710,6 +715,7 @@ ifeq ($(uname_S),SunOS)
 	NEEDS_SOCKET = YesPlease
 	NEEDS_NSL = YesPlease
 	SHELL_PATH = /bin/bash
+	SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
 	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	NO_MKDTEMP = YesPlease
@@ -881,6 +887,13 @@ endif
 -include config.mak.autogen
 -include config.mak
 
+ifdef SANE_TOOL_PATH
+BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|
+PATH := $(SANE_TOOL_PATH):${PATH}
+else
+BROKEN_PATH_FIX = d
+endif
+
 ifeq ($(uname_S),Darwin)
 	ifndef NO_FINK
 		ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -1291,6 +1304,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	    -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+	    -e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \
 	    $@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 8382339..7802581 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -11,6 +11,8 @@
 # exporting it.
 unset CDPATH
 
+# @@PATH@@:$PATH
+
 die() {
 	echo >&2 "$@"
 	exit 1
-- 
1.6.3.1.24.g152f4

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

* [PATCH 8/8] Makefile: add section for SunOS 5.7
  2009-06-05 23:36               ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Brandon Casey
@ 2009-06-05 23:36                 ` Brandon Casey
  2009-06-08 11:43                 ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Jeff King
  1 sibling, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:36 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>


Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 Makefile |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index ca09572..0fe8ec9 100644
--- a/Makefile
+++ b/Makefile
@@ -720,6 +720,16 @@ ifeq ($(uname_S),SunOS)
 	NO_MEMMEM = YesPlease
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
+	ifeq ($(uname_R),5.7)
+		NEEDS_RESOLV = YesPlease
+		NO_IPV6 = YesPlease
+		NO_SOCKADDR_STORAGE = YesPlease
+		NO_UNSETENV = YesPlease
+		NO_SETENV = YesPlease
+		NO_STRLCPY = YesPlease
+		NO_C99_FORMAT = YesPlease
+		NO_STRTOUMAX = YesPlease
+	endif
 	ifeq ($(uname_R),5.8)
 		NO_UNSETENV = YesPlease
 		NO_SETENV = YesPlease
-- 
1.6.3.1.24.g152f4

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

* Re: [PATCH 0/8] enhancing builds on Solaris
  2009-06-05 23:36 ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
  2009-06-05 23:36   ` [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Brandon Casey
@ 2009-06-05 23:46   ` Brandon Casey
  2009-06-06  0:13   ` Junio C Hamano
  2009-06-08 11:50   ` Jeff King
  3 siblings, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-05 23:46 UTC (permalink / raw)
  To: git; +Cc: gitster, peff, Brandon Casey

Brandon Casey wrote:
> From: Brandon Casey <drafnel@gmail.com>
> 
> This should replace bc/solaris in pu.

Just to be clear, this series is built on top of master.

-brandon

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

* Re: [PATCH 0/8] enhancing builds on Solaris
  2009-06-05 23:36 ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
  2009-06-05 23:36   ` [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Brandon Casey
  2009-06-05 23:46   ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
@ 2009-06-06  0:13   ` Junio C Hamano
  2009-06-06  0:41     ` Brandon Casey
  2009-06-08 11:50   ` Jeff King
  3 siblings, 1 reply; 30+ messages in thread
From: Junio C Hamano @ 2009-06-06  0:13 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, gitster, peff, Brandon Casey

Looked good except for 3/8 which I did not quite understand.

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

* Re: [PATCH 0/8] enhancing builds on Solaris
  2009-06-06  0:13   ` Junio C Hamano
@ 2009-06-06  0:41     ` Brandon Casey
  0 siblings, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-06  0:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, peff, Brandon Casey

Junio C Hamano wrote:
> Looked good except for 3/8 which I did not quite understand.

I get this error when compiling using the SUNWspro c99 compiler
when delta.h is included in diff-delta.c:

"diff-delta.c", line 314: identifier redeclared: create_delta
        current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void
        previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44
c99: acomp failed for diff-delta.c
gmake: *** [diff-delta.o] Error 2


I don't see any difference between those two "current" and "previous" statements.

I thought I knew why the error was occurring, but now I don't think I do.  There
are other function declarations in delta.h that are implemented in diff-delta.c,
and those functions are both declared and implemented _before_ create_delta in
delta.h and diff-delta.c respectively.

But, there does not seem to be anything declared in delta.h that is required by
diff-delta.c.

Maybe the commit message should be shortened to something more like:

   The SUNWspro C99 compiler complains: "identifier redeclared: create_delta" when
   delta.h is included.  There is nothing in "delta.h" that is required by
   diff-delta.c, so don't #include it.

Hmm, well, I just noticed that in the commit message I said "diff.h" everywhere when
I meant to say "delta.h".  Maybe that is the confusion.

-brandon

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

* [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include
  2009-06-05 23:36       ` [PATCH 3/8] diff-delta.c: "diff.h" is not a required include Brandon Casey
  2009-06-05 23:36         ` [PATCH 4/8] On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Brandon Casey
@ 2009-06-06  0:47         ` Brandon Casey
  2009-06-06  1:21           ` Nicolas Pitre
  1 sibling, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-06  0:47 UTC (permalink / raw)
  To: gitster; +Cc: git, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

When compiling diff-delta.c with the SUNWspro C99 compiler, it complains

    "diff-delta.c", line 314: identifier redeclared: create_delta

There is nothing in "delta.h" that is required by diff-delta.c, so don't
include it.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 diff-delta.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/diff-delta.c b/diff-delta.c
index a4e28df..a9969f0 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -12,7 +12,6 @@
  */
 
 #include "git-compat-util.h"
-#include "delta.h"
 
 /* maximum hash entry list for the same hash bucket */
 #define HASH_LIMIT 64
-- 
1.6.3.1.24.g152f4

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

* Re: [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include
  2009-06-06  0:47         ` [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include Brandon Casey
@ 2009-06-06  1:21           ` Nicolas Pitre
  2009-06-06  2:49             ` Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Nicolas Pitre @ 2009-06-06  1:21 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, peff, Brandon Casey

On Fri, 5 Jun 2009, Brandon Casey wrote:

> From: Brandon Casey <drafnel@gmail.com>
> 
> When compiling diff-delta.c with the SUNWspro C99 compiler, it complains
> 
>     "diff-delta.c", line 314: identifier redeclared: create_delta
> 
> There is nothing in "delta.h" that is required by diff-delta.c, so don't
> include it.
> 
> Signed-off-by: Brandon Casey <drafnel@gmail.com>

NAK.

This is common practice to include the header file declaring function 
prototypes into the file defining the actual function so to make sure 
the declaration matches with the definition.  Deleting that include is 
actively ignoring a problem instead of fixing the cause of it.


Nicolas

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

* Re: [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include
  2009-06-06  1:21           ` Nicolas Pitre
@ 2009-06-06  2:49             ` Brandon Casey
  2009-06-06  3:10               ` Nicolas Pitre
  0 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-06  2:49 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: gitster, git, peff, Brandon Casey

Nicolas Pitre wrote:
> On Fri, 5 Jun 2009, Brandon Casey wrote:
> 
>> From: Brandon Casey <drafnel@gmail.com>
>>
>> When compiling diff-delta.c with the SUNWspro C99 compiler, it complains
>>
>>     "diff-delta.c", line 314: identifier redeclared: create_delta
>>
>> There is nothing in "delta.h" that is required by diff-delta.c, so don't
>> include it.
>>
>> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> 
> NAK.
> 
> This is common practice to include the header file declaring function 
> prototypes into the file defining the actual function so to make sure 
> the declaration matches with the definition.  Deleting that include is 
> actively ignoring a problem instead of fixing the cause of it.


It doesn't seem to like the structure being redeclared with a flex array
member and being passed as a const argument.


# cat > test.c <<EOF

struct a_struct;

extern void *test_func(const struct a_struct *f);

struct a_struct {
        int a;
        int b;
        char* c[];
};

void *test_func(const struct a_struct *f)
{
        return 0;
}
EOF

# /opt/SUNWspro/bin/c99 -c test.c 
"test.c", line 13: identifier redeclared: test_func
        current : function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void
        previous: function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void : "test.c", line 4
c99: acomp failed for test.c


If either the flex array is removed from the structure, or const is removed from
test_func argument, test.c will compile.  Compiling with -O0 doesn't help.

-brandon

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

* Re: [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include
  2009-06-06  2:49             ` Brandon Casey
@ 2009-06-06  3:10               ` Nicolas Pitre
  2009-06-06  3:56                 ` Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Nicolas Pitre @ 2009-06-06  3:10 UTC (permalink / raw)
  To: Brandon Casey; +Cc: gitster, git, peff, Brandon Casey

On Fri, 5 Jun 2009, Brandon Casey wrote:

> Nicolas Pitre wrote:
> > On Fri, 5 Jun 2009, Brandon Casey wrote:
> > 
> >> From: Brandon Casey <drafnel@gmail.com>
> >>
> >> When compiling diff-delta.c with the SUNWspro C99 compiler, it complains
> >>
> >>     "diff-delta.c", line 314: identifier redeclared: create_delta
> >>
> >> There is nothing in "delta.h" that is required by diff-delta.c, so don't
> >> include it.
> >>
> >> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> > 
> > NAK.
> > 
> > This is common practice to include the header file declaring function 
> > prototypes into the file defining the actual function so to make sure 
> > the declaration matches with the definition.  Deleting that include is 
> > actively ignoring a problem instead of fixing the cause of it.
> 
> 
> It doesn't seem to like the structure being redeclared with a flex array
> member and being passed as a const argument.
> 
> 
> # cat > test.c <<EOF
> 
> struct a_struct;
> 
> extern void *test_func(const struct a_struct *f);
> 
> struct a_struct {
>         int a;
>         int b;
>         char* c[];
> };
> 
> void *test_func(const struct a_struct *f)
> {
>         return 0;
> }
> EOF
> 
> # /opt/SUNWspro/bin/c99 -c test.c 
> "test.c", line 13: identifier redeclared: test_func
>         current : function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void
>         previous: function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void : "test.c", line 4
> c99: acomp failed for test.c
> 
> 
> If either the flex array is removed from the structure, or const is removed from
> test_func argument, test.c will compile.  Compiling with -O0 doesn't help.

What if you define FLEX_ARRAY to 1, or even 0?

If neither of those work then I'd simply remove the const.  Generated 
code should be exactly the same with gcc.  There is no const with 
sizeof_delta_index() which is already inconsistent.

Kind of weird nevertheless.


Nicolas

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

* Re: [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include
  2009-06-06  3:10               ` Nicolas Pitre
@ 2009-06-06  3:56                 ` Brandon Casey
  2009-06-08 23:53                   ` [PATCH] git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8 Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-06  3:56 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Brandon Casey, gitster, git, peff

On Fri, Jun 5, 2009 at 10:10 PM, Nicolas Pitre<nico@cam.org> wrote:
> On Fri, 5 Jun 2009, Brandon Casey wrote:
>
>> Nicolas Pitre wrote:
>> > On Fri, 5 Jun 2009, Brandon Casey wrote:
>> >
>> >> From: Brandon Casey <drafnel@gmail.com>
>> >>
>> >> When compiling diff-delta.c with the SUNWspro C99 compiler, it complains
>> >>
>> >>     "diff-delta.c", line 314: identifier redeclared: create_delta
>> >>
>> >> There is nothing in "delta.h" that is required by diff-delta.c, so don't
>> >> include it.
>> >>
>> >> Signed-off-by: Brandon Casey <drafnel@gmail.com>
>> >
>> > NAK.
>> >
>> > This is common practice to include the header file declaring function
>> > prototypes into the file defining the actual function so to make sure
>> > the declaration matches with the definition.  Deleting that include is
>> > actively ignoring a problem instead of fixing the cause of it.
>>
>>
>> It doesn't seem to like the structure being redeclared with a flex array
>> member and being passed as a const argument.
>>
>>
>> # cat > test.c <<EOF
>>
>> struct a_struct;
>>
>> extern void *test_func(const struct a_struct *f);
>>
>> struct a_struct {
>>         int a;
>>         int b;
>>         char* c[];
>> };
>>
>> void *test_func(const struct a_struct *f)
>> {
>>         return 0;
>> }
>> EOF
>>
>> # /opt/SUNWspro/bin/c99 -c test.c
>> "test.c", line 13: identifier redeclared: test_func
>>         current : function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void
>>         previous: function(pointer to const struct a_struct {int a, int b, array[-1] of pointer to char c}) returning pointer to void : "test.c", line 4
>> c99: acomp failed for test.c
>>
>>
>> If either the flex array is removed from the structure, or const is removed from
>> test_func argument, test.c will compile.  Compiling with -O0 doesn't help.
>
> What if you define FLEX_ARRAY to 1, or even 0?

I tried that with my test.c example and '1' works, but not '0'.  I'll
try setting FLEX_ARRAY to 1 and running git's test suite on Monday.

> If neither of those work then I'd simply remove the const.  Generated
> code should be exactly the same with gcc.  There is no const with
> sizeof_delta_index() which is already inconsistent.
>
> Kind of weird nevertheless.

Yes.

-brandon

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

* Re: [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments
  2009-06-05 23:36     ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Brandon Casey
  2009-06-05 23:36       ` [PATCH 3/8] diff-delta.c: "diff.h" is not a required include Brandon Casey
@ 2009-06-06  7:29       ` Jakub Narebski
  2009-06-07  1:02         ` Brandon Casey
  2009-06-07  5:40         ` [PATCH] configure: test whether -lresolv is needed Ralf Wildenhues
  1 sibling, 2 replies; 30+ messages in thread
From: Jakub Narebski @ 2009-06-06  7:29 UTC (permalink / raw)
  To: Brandon Casey
  Cc: git, gitster, peff, Brandon Casey, Ralf Wildenhues, David Syzdek

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

> From: Brandon Casey <drafnel@gmail.com>
> 
> This library is required on Solaris when compiling with NO_IPV6 since
> hstrerror resides in libresolv.  Additionally, Solaris 7 will need it,
> since inet_ntop and inet_pton reside there too.
> 
> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> ---
>  Makefile |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index baa05f5..40642f7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -95,6 +95,10 @@ all::
>  # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
>  # Patrick Mauritz).
>  #
> +# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
> +# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
> +# inet_ntop and inet_pton additionally reside there.
> +#
>  # Define NO_MMAP if you want to avoid mmap.
>  #
>  # Define NO_PTHREADS if you do not have or do not want to use Pthreads.

Could you please add this build configuration variable to configure.ac
and config.mak.in, to be able to autodetect this situation?

CC-ed Ralf Wildenhues and David Syzdek (who hopefully can produce
autoconf patch to squash with this one).
-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv  to compile arguments
  2009-06-06  7:29       ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Jakub Narebski
@ 2009-06-07  1:02         ` Brandon Casey
  2009-06-07  5:40         ` [PATCH] configure: test whether -lresolv is needed Ralf Wildenhues
  1 sibling, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-07  1:02 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Brandon Casey, git, gitster, peff, Ralf Wildenhues, David Syzdek

On Sat, Jun 6, 2009 at 2:29 AM, Jakub Narebski<jnareb@gmail.com> wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
>> From: Brandon Casey <drafnel@gmail.com>
>>
>> This library is required on Solaris when compiling with NO_IPV6 since
>> hstrerror resides in libresolv.  Additionally, Solaris 7 will need it,
>> since inet_ntop and inet_pton reside there too.
>>
>> Signed-off-by: Brandon Casey <drafnel@gmail.com>
>> ---
>>  Makefile |   11 ++++++++++-
>>  1 files changed, 10 insertions(+), 1 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index baa05f5..40642f7 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -95,6 +95,10 @@ all::
>>  # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
>>  # Patrick Mauritz).
>>  #
>> +# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
>> +# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
>> +# inet_ntop and inet_pton additionally reside there.
>> +#
>>  # Define NO_MMAP if you want to avoid mmap.
>>  #
>>  # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
>
> Could you please add this build configuration variable to configure.ac
> and config.mak.in, to be able to autodetect this situation?

I'll take a look at it, but autoconf is not a strong suit of mine.
Plus, I doubt I will actually be able to test anything on the
platforms I have access to that need to set NEEDS_RESOLV, since any
autoconf installation is likely to be very old.

> CC-ed Ralf Wildenhues and David Syzdek (who hopefully can produce
> autoconf patch to squash with this one).

Yes please. :)

FYI:
Solaris 7 needs -lresov since inet_ntop and inet_pton reside there.
Additionally, since NO_IPV6 is set, hstrerror is called in connect.c
and hstrerror also resides in libresolv.

On more modern Solaris, inet_ntop and inet_pton reside somewhere else,
and since NO_IPV6 does not need to be set, -lresolv is not needed.

-brandon

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

* [PATCH] configure: test whether -lresolv is needed
  2009-06-06  7:29       ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Jakub Narebski
  2009-06-07  1:02         ` Brandon Casey
@ 2009-06-07  5:40         ` Ralf Wildenhues
  1 sibling, 0 replies; 30+ messages in thread
From: Ralf Wildenhues @ 2009-06-07  5:40 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Brandon Casey, git, gitster, peff, Brandon Casey, David Syzdek

Check if -lresolv is needed for hstrerror; set NEEDS_RESOLV
accordingly, and substitute in config.mak.in.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---

* Jakub Narebski wrote on Sat, Jun 06, 2009 at 09:29:34AM CEST:
> 
> CC-ed Ralf Wildenhues and David Syzdek (who hopefully can produce
> autoconf patch to squash with this one).

Completely untested, but also completely mechanical.  HTH.

Cheers,
Ralf

 config.mak.in |    1 +
 configure.ac  |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index e8d96e8..dd60451 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -33,6 +33,7 @@ NO_EXPAT=@NO_EXPAT@
 NO_LIBGEN_H=@NO_LIBGEN_H@
 NEEDS_LIBICONV=@NEEDS_LIBICONV@
 NEEDS_SOCKET=@NEEDS_SOCKET@
+NEEDS_RESOLV=@NEEDS_RESOLV@
 NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
 NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
 NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
diff --git a/configure.ac b/configure.ac
index 108a97f..7937e60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -467,6 +467,15 @@ AC_CHECK_LIB([c], [socket],
 AC_SUBST(NEEDS_SOCKET)
 test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
 
+#
+# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
+# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
+# inet_ntop and inet_pton additionally reside there.
+AC_CHECK_LIB([resolv], [hstrerror],
+[NEEDS_RESOLV=],
+[NEEDS_RESOLV=YesPlease])
+AC_SUBST(NEEDS_RESOLV)
+test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 
 ## Checks for header files.
 AC_MSG_NOTICE([CHECKS for header files])
-- 
1.6.3.2.199.g31f34

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-05 23:36               ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Brandon Casey
  2009-06-05 23:36                 ` [PATCH 8/8] Makefile: add section for SunOS 5.7 Brandon Casey
@ 2009-06-08 11:43                 ` Jeff King
  2009-06-08 13:39                   ` Brandon Casey
  2009-06-08 16:41                   ` Junio C Hamano
  1 sibling, 2 replies; 30+ messages in thread
From: Jeff King @ 2009-06-08 11:43 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, gitster, Brandon Casey

On Fri, Jun 05, 2009 at 06:36:15PM -0500, Brandon Casey wrote:

> From: Junio C Hamano <gitster@pobox.com>
> 
> Some platforms (like SunOS and family) have kept their common binaries at
> some historical moment in time, and introduced new binaries with modern
> features in a special location like /usr/xpg4/bin or /usr/ucb.  Some of the
> features provided by these modern binaries are expected and required by git.
> If the featureful binaries are not in the users path, then git could end up
> using the less featureful binary and fail.
> 
> So provide a mechanism to prepend elements to the users PATH at runtime so
> the modern binaries will be found.

So this bit me already, and it's only been in next for a day. :) I
_already_ have /usr/xpg4/bin in my PATH before /usr/bin, but with this
patch, I get it stuck at the _beginning_ of my PATH automagically. Which
overrides, against my wishes, the "even more sane than /usr/xpg4/bin"
part of my PATH that comes at the beginning.

Specifically, I have "~peff/local/bin" at the beginning of my PATH which
contains a 'vi' that points to vim. Running "git rebase -i" now puts
/usr/xpg4/bin at the beginning of the PATH (before ~peff/local/bin),
which means I end up running the crappy system vi instead. For bonus
fun, "git commit" still runs the correct 'vi' because it doesn't happen
to be implemented as a shell script.

Am I crazy for not having EDITOR=vim instead of EDITOR=vi? Perhaps. But
I wanted to point out that tweaking the PATH behind the user's back does
cause surprises in the real world.

-Peff

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

* Re: [PATCH 0/8] enhancing builds on Solaris
  2009-06-05 23:36 ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
                     ` (2 preceding siblings ...)
  2009-06-06  0:13   ` Junio C Hamano
@ 2009-06-08 11:50   ` Jeff King
  3 siblings, 0 replies; 30+ messages in thread
From: Jeff King @ 2009-06-08 11:50 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, gitster, Brandon Casey

On Fri, Jun 05, 2009 at 06:36:08PM -0500, Brandon Casey wrote:

> Here is a re-roll of the work on Solaris which integrates the ideas from you
> and Jeff.  This should replace bc/solaris in pu.
> 
> This should allow compiling on Solaris with or without a c99 compiler,
> GCC or SUNWspro.
> 
> Solaris 7 should be able to compile when using GCC and bash.

With the exception of 7/8 (which I already complained about separately),
these look reasonable to me, and my setup still passes the same tests
(though that is perhaps not saying much, as I was already using gcc).

-Peff

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 11:43                 ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Jeff King
@ 2009-06-08 13:39                   ` Brandon Casey
  2009-06-08 13:50                     ` Jeff King
  2009-06-08 16:41                   ` Junio C Hamano
  1 sibling, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-08 13:39 UTC (permalink / raw)
  To: Jeff King; +Cc: git, gitster, Brandon Casey

Jeff King wrote:
> On Fri, Jun 05, 2009 at 06:36:15PM -0500, Brandon Casey wrote:
> 
>> From: Junio C Hamano <gitster@pobox.com>
>>
>> Some platforms (like SunOS and family) have kept their common binaries at
>> some historical moment in time, and introduced new binaries with modern
>> features in a special location like /usr/xpg4/bin or /usr/ucb.  Some of the
>> features provided by these modern binaries are expected and required by git.
>> If the featureful binaries are not in the users path, then git could end up
>> using the less featureful binary and fail.
>>
>> So provide a mechanism to prepend elements to the users PATH at runtime so
>> the modern binaries will be found.
> 
> So this bit me already, and it's only been in next for a day. :) I
> _already_ have /usr/xpg4/bin in my PATH before /usr/bin, but with this
> patch, I get it stuck at the _beginning_ of my PATH automagically. Which
> overrides, against my wishes, the "even more sane than /usr/xpg4/bin"
> part of my PATH that comes at the beginning.
> 
> Specifically, I have "~peff/local/bin" at the beginning of my PATH which
> contains a 'vi' that points to vim. Running "git rebase -i" now puts
> /usr/xpg4/bin at the beginning of the PATH (before ~peff/local/bin),
> which means I end up running the crappy system vi instead. For bonus
> fun, "git commit" still runs the correct 'vi' because it doesn't happen
> to be implemented as a shell script.
> 
> Am I crazy for not having EDITOR=vim instead of EDITOR=vi? Perhaps. But
> I wanted to point out that tweaking the PATH behind the user's back does
> cause surprises in the real world.

Good points.  I'm fine with dropping this patch, especially when it causes
problems for a real Solaris user, which I'm not.

I don't like that git has a dependency on the user's PATH being set
correctly though.  That's why I liked the patch.  I guess I could modify
all the uses of sed and friends to look like $SED and then set SED to
/usr/xpg4/bin/sed on Solaris.  It doesn't sound like that is necessary
in practice though.

btw, this patch does help the test suite when the test suite is run using
make.  The patch added SANE_TOOL_PATH to PATH in the Makefile.

-brandon

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 13:39                   ` Brandon Casey
@ 2009-06-08 13:50                     ` Jeff King
  2009-06-08 15:59                       ` Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Jeff King @ 2009-06-08 13:50 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, gitster, Brandon Casey

On Mon, Jun 08, 2009 at 08:39:50AM -0500, Brandon Casey wrote:

> > Am I crazy for not having EDITOR=vim instead of EDITOR=vi? Perhaps. But
> > I wanted to point out that tweaking the PATH behind the user's back does
> > cause surprises in the real world.
> 
> Good points.  I'm fine with dropping this patch, especially when it causes
> problems for a real Solaris user, which I'm not.

Let me point out that I'm also not a real Solaris user. These days all I
use it for is test-compiling git. So you can take my report with a grain
of salt.

> I don't like that git has a dependency on the user's PATH being set
> correctly though.  That's why I liked the patch.  I guess I could modify
> all the uses of sed and friends to look like $SED and then set SED to
> /usr/xpg4/bin/sed on Solaris.  It doesn't sound like that is necessary
> in practice though.

Yeah, I think requiring the user's PATH to be set correctly and tweaking
the PATH behind the user's back are both unsatisfactory solutions. Using
$SED everywhere solves both problems, but would probably be quite
annoying to maintain. So I guess it is a matter of picking our poison.

-Peff

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 13:50                     ` Jeff King
@ 2009-06-08 15:59                       ` Brandon Casey
  0 siblings, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-08 15:59 UTC (permalink / raw)
  To: Jeff King; +Cc: git, gitster, Brandon Casey

Jeff King wrote:
> On Mon, Jun 08, 2009 at 08:39:50AM -0500, Brandon Casey wrote:
> 
>>> Am I crazy for not having EDITOR=vim instead of EDITOR=vi? Perhaps. But
>>> I wanted to point out that tweaking the PATH behind the user's back does
>>> cause surprises in the real world.
>> Good points.  I'm fine with dropping this patch, especially when it causes
>> problems for a real Solaris user, which I'm not.
> 
> Let me point out that I'm also not a real Solaris user. These days all I
> use it for is test-compiling git. So you can take my report with a grain
> of salt.

heh.

>> I don't like that git has a dependency on the user's PATH being set
>> correctly though.  That's why I liked the patch.  I guess I could modify
>> all the uses of sed and friends to look like $SED and then set SED to
>> /usr/xpg4/bin/sed on Solaris.  It doesn't sound like that is necessary
>> in practice though.
> 
> Yeah, I think requiring the user's PATH to be set correctly and tweaking
> the PATH behind the user's back are both unsatisfactory solutions. Using
> $SED everywhere solves both problems, but would probably be quite
> annoying to maintain. So I guess it is a matter of picking our poison.

agreed.

-brandon

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 11:43                 ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Jeff King
  2009-06-08 13:39                   ` Brandon Casey
@ 2009-06-08 16:41                   ` Junio C Hamano
  2009-06-08 22:11                     ` Jeff King
  1 sibling, 1 reply; 30+ messages in thread
From: Junio C Hamano @ 2009-06-08 16:41 UTC (permalink / raw)
  To: Jeff King; +Cc: Brandon Casey, git, Brandon Casey

Jeff King <peff@peff.net> writes:

> On Fri, Jun 05, 2009 at 06:36:15PM -0500, Brandon Casey wrote:
> ...
>> So provide a mechanism to prepend elements to the users PATH at runtime so
>> the modern binaries will be found.
>
> So this bit me already, and it's only been in next for a day. :) I
> _already_ have /usr/xpg4/bin in my PATH before /usr/bin, but with this
> patch, I get it stuck at the _beginning_ of my PATH automagically. Which
> overrides, against my wishes, the "even more sane than /usr/xpg4/bin"
> part of my PATH that comes at the beginning.
>
> Specifically, I have "~peff/local/bin" at the beginning of my PATH which
> contains a 'vi' that points to vim. Running "git rebase -i" now puts
> /usr/xpg4/bin at the beginning of the PATH (before ~peff/local/bin),

In git-sh-setup, we do "unset CDPATH" ourselves to help and protect
clueless people, even though "people should have a sane environment".
Even though I suspect that anybody who is using Solaris for anything real
would not be using /usr/bin tools themselves (i.e. it should not be
necessary for us fixing their PATH), there may be people who do not know.
I think helping them with path munging falls into the same category, but
at the same time, the remedy looks worse than the disease.

We could further uglify the patch like this.

 Makefile        |    5 +++--
 git-sh-setup.sh |   28 +++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3890a0e..c678cc0 100644
--- a/Makefile
+++ b/Makefile
@@ -881,7 +881,8 @@ endif
 -include config.mak
 
 ifdef SANE_TOOL_PATH
-BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|
+SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
+BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
 PATH := $(SANE_TOOL_PATH):${PATH}
 else
 BROKEN_PATH_FIX = d
@@ -1288,7 +1289,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	    -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-	    -e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \
+	    -e $(BROKEN_PATH_FIX) \
 	    $@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 7802581..80acb7d 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -11,7 +11,33 @@
 # exporting it.
 unset CDPATH
 
-# @@PATH@@:$PATH
+git_broken_path_fix () {
+	case ":$PATH:" in
+	*:$1:*) : ok ;;
+	*)
+		PATH=$(
+			SANE_TOOL_PATH="$1"
+			IFS=: path= sep=
+			set x $PATH
+			shift
+			for elem
+			do
+				case "$SANE_TOOL_PATH:$elem" in
+				(?*:/bin | ?*:/usr/bin)
+					path="$path$sep$SANE_TOOL_PATH"
+					sep=:
+					SANE_TOOL_PATH=
+				esac
+				path="$path$sep$elem"
+				sep=:
+			done
+			echo "$path"
+		)
+		;;
+	esac
+}
+
+# @@BROKEN_PATH_FIX@@
 
 die() {
 	echo >&2 "$@"

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 16:41                   ` Junio C Hamano
@ 2009-06-08 22:11                     ` Jeff King
  2009-06-08 23:39                       ` Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Jeff King @ 2009-06-08 22:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brandon Casey, git, Brandon Casey

On Mon, Jun 08, 2009 at 09:41:49AM -0700, Junio C Hamano wrote:

> We could further uglify the patch like this.
> [...]
> +git_broken_path_fix () {
> +	case ":$PATH:" in
> +	*:$1:*) : ok ;;
> +	*)
> +		PATH=$(
> +			SANE_TOOL_PATH="$1"
> +			IFS=: path= sep=
> +			set x $PATH
> +			shift
> +			for elem
> +			do
> +				case "$SANE_TOOL_PATH:$elem" in
> +				(?*:/bin | ?*:/usr/bin)
> +					path="$path$sep$SANE_TOOL_PATH"
> +					sep=:
> +					SANE_TOOL_PATH=
> +				esac
> +				path="$path$sep$elem"
> +				sep=:
> +			done
> +			echo "$path"
> +		)
> +		;;
> +	esac
> +}

Wow. That _is_ ugly, but it actually addresses exactly both my concern
and Brandon's. I kind of like it.

-Peff

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 22:11                     ` Jeff King
@ 2009-06-08 23:39                       ` Brandon Casey
  2009-06-09 16:31                         ` Brandon Casey
  0 siblings, 1 reply; 30+ messages in thread
From: Brandon Casey @ 2009-06-08 23:39 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git, Brandon Casey


I never received the referenced email.  I'll try to extract from gmane
and test.

-brandon


Jeff King wrote:
> On Mon, Jun 08, 2009 at 09:41:49AM -0700, Junio C Hamano wrote:
> 
>> We could further uglify the patch like this.
>> [...]
>> +git_broken_path_fix () {
>> +	case ":$PATH:" in
>> +	*:$1:*) : ok ;;
>> +	*)
>> +		PATH=$(
>> +			SANE_TOOL_PATH="$1"
>> +			IFS=: path= sep=
>> +			set x $PATH
>> +			shift
>> +			for elem
>> +			do
>> +				case "$SANE_TOOL_PATH:$elem" in
>> +				(?*:/bin | ?*:/usr/bin)
>> +					path="$path$sep$SANE_TOOL_PATH"
>> +					sep=:
>> +					SANE_TOOL_PATH=
>> +				esac
>> +				path="$path$sep$elem"
>> +				sep=:
>> +			done
>> +			echo "$path"
>> +		)
>> +		;;
>> +	esac
>> +}
> 
> Wow. That _is_ ugly, but it actually addresses exactly both my concern
> and Brandon's. I kind of like it.
> 
> -Peff

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

* [PATCH] git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8
  2009-06-06  3:56                 ` Brandon Casey
@ 2009-06-08 23:53                   ` Brandon Casey
  0 siblings, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-08 23:53 UTC (permalink / raw)
  To: gitster; +Cc: nico, git, peff, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

The Sun c99 compiler as recent as version 5.8 Patch 121016-06 2007/08/01
produces an error when compiling diff-delta.c.  This source file #includes
the delta.h header file which pre-declares a struct which is later defined
to contain a flex array member.  The Sun c99 compiler fails to compile
diff-delta.c and gives the following error:

  "diff-delta.c", line 314: identifier redeclared: create_delta
          current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void
          previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44
  c99: acomp failed for diff-delta.c

So, avoid using this c99 feature when compiling with the Sun c compilers
version 5.8 and older (the most recent version tested).

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---


This should avoid the flex array problems when using the Sun c99 compiler.

This patch is on top of the new bc/solaris (a7a24ee7).

Since this checks the version of the Sun compiler, it should give Sun the
opportunity to fix the compiler in newer releases.  If someone has Sun
Studio 12? where __SUNPRO_C is set to 0x590, maybe they can test.

-brandon


 git-compat-util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 71197d9..48d99fa 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -7,7 +7,7 @@
 /*
  * See if our compiler is known to support flexible array members.
  */
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && (!defined(__SUNPRO_C) || (__SUNPRO_C > 0x580))
 # define FLEX_ARRAY /* empty */
 #elif defined(__GNUC__)
 # if (__GNUC__ >= 3)
-- 
1.6.3.1.24.g152f4

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

* Re: [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
  2009-06-08 23:39                       ` Brandon Casey
@ 2009-06-09 16:31                         ` Brandon Casey
  0 siblings, 0 replies; 30+ messages in thread
From: Brandon Casey @ 2009-06-09 16:31 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git, Brandon Casey

Brandon Casey wrote:
> I never received the referenced email.  I'll try to extract from gmane
> and test.

This patch works for me.

-brandon


> Jeff King wrote:
>> On Mon, Jun 08, 2009 at 09:41:49AM -0700, Junio C Hamano wrote:
>>
>>> We could further uglify the patch like this.
>>> [...]
>>> +git_broken_path_fix () {
>>> +	case ":$PATH:" in
>>> +	*:$1:*) : ok ;;
>>> +	*)
>>> +		PATH=$(
>>> +			SANE_TOOL_PATH="$1"
>>> +			IFS=: path= sep=
>>> +			set x $PATH
>>> +			shift
>>> +			for elem
>>> +			do
>>> +				case "$SANE_TOOL_PATH:$elem" in
>>> +				(?*:/bin | ?*:/usr/bin)
>>> +					path="$path$sep$SANE_TOOL_PATH"
>>> +					sep=:
>>> +					SANE_TOOL_PATH=
>>> +				esac
>>> +				path="$path$sep$elem"
>>> +				sep=:
>>> +			done
>>> +			echo "$path"
>>> +		)
>>> +		;;
>>> +	esac
>>> +}
>> Wow. That _is_ ugly, but it actually addresses exactly both my concern
>> and Brandon's. I kind of like it.
>>
>> -Peff
> 
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-06-09 16:34 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7vk53vlxhz.fsf@alter.siamese.dyndns.org>
2009-06-05 23:36 ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
2009-06-05 23:36   ` [PATCH 1/8] Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Brandon Casey
2009-06-05 23:36     ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Brandon Casey
2009-06-05 23:36       ` [PATCH 3/8] diff-delta.c: "diff.h" is not a required include Brandon Casey
2009-06-05 23:36         ` [PATCH 4/8] On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Brandon Casey
2009-06-05 23:36           ` [PATCH 5/8] git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris Brandon Casey
2009-06-05 23:36             ` [PATCH 6/8] Makefile: define __sun__ on SunOS Brandon Casey
2009-06-05 23:36               ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Brandon Casey
2009-06-05 23:36                 ` [PATCH 8/8] Makefile: add section for SunOS 5.7 Brandon Casey
2009-06-08 11:43                 ` [PATCH 7/8] Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Jeff King
2009-06-08 13:39                   ` Brandon Casey
2009-06-08 13:50                     ` Jeff King
2009-06-08 15:59                       ` Brandon Casey
2009-06-08 16:41                   ` Junio C Hamano
2009-06-08 22:11                     ` Jeff King
2009-06-08 23:39                       ` Brandon Casey
2009-06-09 16:31                         ` Brandon Casey
2009-06-06  0:47         ` [PATCH v2 3/8] diff-delta.c: "delta.h" is not a required include Brandon Casey
2009-06-06  1:21           ` Nicolas Pitre
2009-06-06  2:49             ` Brandon Casey
2009-06-06  3:10               ` Nicolas Pitre
2009-06-06  3:56                 ` Brandon Casey
2009-06-08 23:53                   ` [PATCH] git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8 Brandon Casey
2009-06-06  7:29       ` [PATCH 2/8] Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Jakub Narebski
2009-06-07  1:02         ` Brandon Casey
2009-06-07  5:40         ` [PATCH] configure: test whether -lresolv is needed Ralf Wildenhues
2009-06-05 23:46   ` [PATCH 0/8] enhancing builds on Solaris Brandon Casey
2009-06-06  0:13   ` Junio C Hamano
2009-06-06  0:41     ` Brandon Casey
2009-06-08 11:50   ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).