git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: shell compatibility issues with SunOS 5.10
Date: Wed, 06 May 2009 18:14:46 -0700	[thread overview]
Message-ID: <7vab5pu321.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <vmGwFm-7sqyeL1D7WrJ-qBXW02LwMMHQ7rLy7XbfdUutAtORXrswbw@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Wed\, 06 May 2009 19\:22\:08 -0500")

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

> /usr/xpg*/bin is where Sun puts the POSIX compliant versions of standard
> system utilities.
>
> The binaries in /bin/ retain their historical Solaris behavior.
>
> Check out the XPG4 man page on a sun.
>
> Not sure about the best route to take here.  /usr/xpg4/bin should probably
> be in the user's PATH when git is executed too.

I doubt it is limited to git.

My experience from the days I had to do things on Solaris boxes several
years ago was that it was the only way to have a workable environment to
have /usr/xpg*/bin on my PATH.

If the contents of the stock /usr/bin has been frozen at the historical
state while the outside world made progress, I would imagine that the
situation has gotten worse for people who still use tools from /usr/bin
and expect their scripts to be portable with anybody else.

On Solaris, I expect everybody to build git with SHELL_PATH set to
something other than /bin/sh, and binary packaged one (I do not know
Solaris have such a packaging system, though) would also be set to avoid
the broken /bin/sh.  I suspect you could do something like this...

 Makefile        |   13 +++++++++++++
 git-sh-setup.sh |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 6e21643..081f06a 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.
@@ -694,6 +699,7 @@ ifeq ($(uname_S),SunOS)
 	NEEDS_SOCKET = YesPlease
 	NEEDS_NSL = YesPlease
 	SHELL_PATH = /bin/bash
+	SANE_TOOL_PATH = /usr/xpg5/bin:/usr/xpg4/bin
 	NO_STRCASESTR = YesPlease
 	NO_MEMMEM = YesPlease
 	NO_HSTRERROR = YesPlease
@@ -852,6 +858,12 @@ endif
 -include config.mak.autogen
 -include config.mak
 
+ifdef SANE_TOOL_PATH
+BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|
+else
+BROKEN_PATH_FIX = d
+endif
+
 ifeq ($(uname_S),Darwin)
 	ifndef NO_FINK
 		ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -1251,6 +1263,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 	    -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

  reply	other threads:[~2009-05-07  1:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  5:59 shell compatibility issues with SunOS 5.10 Nguyen Thai Ngoc Duy
2009-05-06  6:16 ` Junio C Hamano
2009-05-06  6:43   ` Nguyen Thai Ngoc Duy
2009-05-07  1:38   ` Nguyen Thai Ngoc Duy
2009-05-06  6:45 ` Johannes Sixt
2009-05-06  6:57   ` Nguyen Thai Ngoc Duy
2009-05-06  9:19     ` Ralf Wildenhues
2009-05-06  9:38       ` Johannes Schindelin
2009-05-06 23:07         ` Nguyen Thai Ngoc Duy
2009-05-06 13:07 ` Jeff King
2009-05-06 18:14 ` Brandon Casey
2009-05-06 18:29   ` [PATCH 0/4] workaround some Solaris sed issues Brandon Casey
2009-05-06 18:29     ` [PATCH 1/4] t4118: add missing '&&' Brandon Casey
2009-05-06 18:29       ` [PATCH 2/4] t4118: avoid sed invocation on file without terminating newline Brandon Casey
2009-05-06 18:29         ` [PATCH 3/4] t/annotate-tests.sh: avoid passing a non-newline terminated file to sed Brandon Casey
2009-05-06 18:29           ` [PATCH 4/4] t4200: " Brandon Casey
2009-05-06 18:48             ` Junio C Hamano
2009-05-06 21:12               ` Brandon Casey
2009-05-06 21:49                 ` Junio C Hamano
2009-05-06 22:56                   ` [PATCH 1/2] t4200: remove two unnecessary lines Brandon Casey
2009-05-06 22:56                     ` [PATCH 2/2] t4200: convert sed expression which operates on non-text file to perl Brandon Casey
2009-05-06 23:24                       ` Nguyen Thai Ngoc Duy
2009-05-07  1:49               ` [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed Nguyen Thai Ngoc Duy
2009-05-07  2:06                 ` Brandon Casey
2009-05-07  2:29                   ` Junio C Hamano
2009-05-07  7:26             ` Johannes Sixt
2009-05-07 14:57               ` Brandon Casey
2009-05-06 23:15   ` shell compatibility issues with SunOS 5.10 Nguyen Thai Ngoc Duy
2009-05-07  0:22     ` Brandon Casey
2009-05-07  1:14       ` Junio C Hamano [this message]
2009-05-07  2:23         ` Brandon Casey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vab5pu321.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).