All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh
@ 2009-07-10 17:10 Brandon Casey
  2009-07-10 17:10 ` [PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5 Brandon Casey
  2009-07-11  6:44 ` [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git; +Cc: Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

This email describes how I have successfully compiled git on IRIX6.5 with the
native MIPSpro compiler version 7.4.4m and successfully run nearly all of the
tests using the Korn shell.

A config.mak file is provided at the end of this email.

The GIT_SKIP_TESTS environment variable was used to skip tests which still
fail.  The number of tests which must be skipped has been greatly reduced.
When I sent this email last year, 23 individual tests were skipped plus all
of t3901.  With current master, only 13 tests must be skipped.  The remaining
tests which fail are due to the installed iconv lacking support for the
tested languages.

Two lingering concerns:
  1) Building with -Ofast produces an executable which segfaults and can not
     pass the tests.
  2) Building with mmap support produces an executable which segfaults on
     t1400-update-ref when it calls

         'git rev-parse --verify "master@{May 25 2005}"'

     Previously, this fault was avoided when THREADED_DELTA_SEARCH was set,
     but there is a warning during compilation when THREADED_DELTA_SEARCH is
     enabled that suggests Variable Length Arrays should not be used when
     threads are used.  So it is left unset, and now NO_MMAP is set.

     From my notes:
     I tracked the mmap issue down to the mmap in refs.c:read_ref_at().  The
     mmap succeeds, and the loop is executed properly until rec is rewound
     into the first line (reflog entry) of the file. I don't know why it
     fails, the code looks correct. I can't reproduce it with a similarly
     structured stand-alone test program.  For the mentioned test that fails
     above, if the rev-parse argument is changed to something that does not
     reference the first entry in the log file, then it will succeed
     e.g. "master@{3}".

I have no debugger.

Otherwise, I've been using this executable somewhat and have not experienced
any problems.  Maybe it will be useful to others.

Are there actually any IRIX users out there?

These patches are all submitted For-Your-Information only.  Junio, feel free
to apply any of them or none, and to add my Signed-off-by.

-brandon


Brandon Casey (5):
  unpack-trees.c: work around run-time array initialization flaw on
    IRIX 6.5
  git-compat-util.h: adjust for SGI IRIX 6.5
  Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile
    arguments
  Makefile: add section for SGI IRIX 6.5
  test-lib.sh: work around ksh's trap shortcomings

 Makefile          |   18 ++++++++++++++++++
 configure.ac      |    6 ++++++
 git-compat-util.h |    3 ++-
 t/lib-git-svn.sh  |   15 ++++++++++-----
 t/test-lib.sh     |    3 ++-
 unpack-trees.c    |    2 +-
 6 files changed, 39 insertions(+), 8 deletions(-)


--->8--- config.mak --->8---

GIT_SKIP_TESTS := \
   t3900.1[129] t3900.2[0234] \
   t5100.5 t5100.1[06] \
   t8005.[234]
export GIT_SKIP_TESTS

SHELL_PATH = /bin/ksh
TAR = gtar
CC = c99
CFLAGS = -n32 -O2
NO_C99_FORMAT = 1
NO_CURL = 1
NO_OPENSSL = 1
NO_TCLTK = 1

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

* [PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5
  2009-07-10 17:10 [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Brandon Casey
@ 2009-07-10 17:10 ` Brandon Casey
  2009-07-10 17:10   ` [PATCH FYI 2/5] git-compat-util.h: adjust for SGI " Brandon Casey
  2009-07-11  6:44 ` [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git

The c99 MIPSpro Compiler version 7.4.4m on IRIX 6.5 does not properly
initialize run-time initialized arrays.  An array which is initialized with
fewer elements than the length of the array should have the unitialized
elements initialized to zero.  This compiler only initializes the remaining
elements when the last element is a static parameter.  So work around it
by adding a "NULL" initialization parameter.
---
 unpack-trees.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 05d0bb1..7894c07 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -128,7 +128,7 @@ static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_o
 
 static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o)
 {
-	struct cache_entry *src[5] = { ce, };
+	struct cache_entry *src[5] = { ce, NULL, };
 
 	o->pos++;
 	if (ce_stage(ce)) {
-- 
1.6.4.rc0.5.g76f7cf

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

* [PATCH FYI 2/5] git-compat-util.h: adjust for SGI IRIX 6.5
  2009-07-10 17:10 ` [PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5 Brandon Casey
@ 2009-07-10 17:10   ` Brandon Casey
  2009-07-10 17:10     ` [PATCH FYI 3/5] Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments Brandon Casey
  0 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git

Don't define _XOPEN_SOURCE
Do    define _SGI_SOURCE

Defining _XOPEN_SOURCE prevents many of the common functions and macros
from being defined. _Not_ setting _XOPEN_SOURCE, and instead setting
_SGI_SOURCE, provides all of the XPG4, XPG5, BSD, POSIX functions and
declarations, _BUT_ provides a horribly broken snprintf(). SGI does have
a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates
to zero, and this only happens if _XOPEN_SOURCE is defined which, as
mentioned above, prevents many other common functions and defines.
---
 git-compat-util.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 9609eaa..913f41a 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -52,7 +52,7 @@
 # else
 # define _XOPEN_SOURCE 500
 # endif
-#elif !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
+#elif !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX) && !defined(sgi)
 #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 */
@@ -62,6 +62,7 @@
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
 #define _NETBSD_SOURCE 1
+#define _SGI_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>
-- 
1.6.4.rc0.5.g76f7cf

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

* [PATCH FYI 3/5] Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments
  2009-07-10 17:10   ` [PATCH FYI 2/5] git-compat-util.h: adjust for SGI " Brandon Casey
@ 2009-07-10 17:10     ` Brandon Casey
  2009-07-10 17:10       ` [PATCH FYI 4/5] Makefile: add section for SGI IRIX 6.5 Brandon Casey
  0 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git; +Cc: Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

Commit 003b33a8 recently added a call to basename().  On IRIX 6.5, this
function resides in libgen and -lgen is required for the linker.

Update configure.ac too.
---


configure.ac changes are untested.

-brandon


 Makefile     |    5 +++++
 configure.ac |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 311ce7d..faaab5e 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,8 @@ all::
 #
 # Define NO_LIBGEN_H if you don't have libgen.h.
 #
+# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
+#
 # Define NO_SYS_SELECT_H if you don't have sys/select.h.
 #
 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
@@ -1019,6 +1021,9 @@ ifdef NEEDS_LIBICONV
 	endif
 	EXTLIBS += $(ICONV_LINK) -liconv
 endif
+ifdef NEEDS_LIBGEN
+	EXTLIBS += -lgen
+endif
 ifdef NEEDS_SOCKET
 	EXTLIBS += -lsocket
 endif
diff --git a/configure.ac b/configure.ac
index 1885674..74d0af5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -485,6 +485,12 @@ AC_CHECK_LIB([resolv], [hstrerror],
 AC_SUBST(NEEDS_RESOLV)
 test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 
+AC_CHECK_LIB([gen], [basename],
+[NEEDS_LIBGEN=],
+[NEEDS_LIBGEN=YesPlease])
+AC_SUBST(NEEDS_LIBGEN)
+test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
+
 ## Checks for header files.
 AC_MSG_NOTICE([CHECKS for header files])
 #
-- 
1.6.4.rc0.5.g76f7cf

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

* [PATCH FYI 4/5] Makefile: add section for SGI IRIX 6.5
  2009-07-10 17:10     ` [PATCH FYI 3/5] Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments Brandon Casey
@ 2009-07-10 17:10       ` Brandon Casey
  2009-07-10 17:10         ` [PATCH FYI 5/5] test-lib.sh: work around ksh's trap shortcomings Brandon Casey
  0 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git

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

diff --git a/Makefile b/Makefile
index faaab5e..d404524 100644
--- a/Makefile
+++ b/Makefile
@@ -830,6 +830,19 @@ ifeq ($(uname_S),GNU)
 	NO_STRLCPY=YesPlease
 	NO_MKSTEMPS = YesPlease
 endif
+ifeq ($(uname_S),IRIX)
+	NO_SETENV = YesPlease
+	NO_UNSETENV = YesPlease
+	NO_STRCASESTR = YesPlease
+	NO_MEMMEM = YesPlease
+	NO_MKSTEMPS = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MMAP = YesPlease
+	NO_EXTERNAL_GREP = UnfortunatelyYes
+	SNPRINTF_RETURNS_BOGUS = YesPlease
+	SHELL_PATH = /usr/gnu/bin/bash
+	NEEDS_LIBGEN = YesPlease
+endif
 ifeq ($(uname_S),IRIX64)
 	NO_IPV6=YesPlease
 	NO_SETENV=YesPlease
-- 
1.6.4.rc0.5.g76f7cf

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

* [PATCH FYI 5/5] test-lib.sh: work around ksh's trap shortcomings
  2009-07-10 17:10       ` [PATCH FYI 4/5] Makefile: add section for SGI IRIX 6.5 Brandon Casey
@ 2009-07-10 17:10         ` Brandon Casey
  2009-07-10 18:31           ` [PATCH FYI 6/5] Makefile: update IRIX64 section Brandon Casey
  0 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 17:10 UTC (permalink / raw)
  To: git; +Cc: Brandon Casey

From: Brandon Casey <casey@argon.nrlssc.navy.mil>

In ksh, if trap is called within a function with 0 or EXIT as its signal,
then the trap will be executed at the time the function returns. This
causes a problem in the test functions since 'trap - EXIT' is called
within the test_done function in order to remove the trap which calls
die() on exit. This means trap has to be called from the scripts top-level.
Do so by renaming the test_done function to test_done_func, and then,
remove the trap and call test_done_func from within a new alias named
test_done.

Additionally, there is some strangeness with respect to aliases and sourced
script files; the alias is not available within the sourced file. So call
'trap - EXIT' directly in lib-git-svn.sh before calling the test_done_func
function.
---
 t/lib-git-svn.sh |   15 ++++++++++-----
 t/test-lib.sh    |    3 ++-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 5654962..c49971c 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -6,11 +6,13 @@ git_svn_id=git""-svn-id
 if test -n "$NO_SVN_TESTS"
 then
 	say 'skipping git svn tests, NO_SVN_TESTS defined'
-	test_done
+	trap - EXIT
+	test_done_func
 fi
 if ! test_have_prereq PERL; then
 	say 'skipping git svn tests, perl not available'
-	test_done
+	trap - EXIT
+	test_done_func
 fi
 
 GIT_DIR=$PWD/.git
@@ -21,7 +23,8 @@ svn >/dev/null 2>&1
 if test $? -ne 1
 then
     say 'skipping git svn tests, svn not found'
-    test_done
+    trap - EXIT
+    test_done_func
 fi
 
 svnrepo=$PWD/svnrepo
@@ -46,7 +49,8 @@ then
 		err='Perl SVN libraries not found or unusable, skipping test'
 	fi
 	say "$err"
-	test_done
+	trap - EXIT
+	test_done_func
 fi
 
 rawsvnrepo="$svnrepo"
@@ -159,7 +163,8 @@ require_svnserve () {
     if test -z "$SVNSERVE_PORT"
     then
         say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'
-        test_done
+	trap - EXIT
+	test_done_func
     fi
 }
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 5fdc5d9..d7c12db 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -504,7 +504,7 @@ test_create_repo () {
 	cd "$owd"
 }
 
-test_done () {
+test_done_func () {
 	GIT_EXIT_OK=t
 	test_results_dir="$TEST_DIRECTORY/test-results"
 	mkdir -p "$test_results_dir"
@@ -544,6 +544,7 @@ test_done () {
 
 	esac
 }
+alias test_done='trap - EXIT && test_done_func'
 
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in 'trash directory' subdirectory.
-- 
1.6.4.rc0.5.g76f7cf

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

* [PATCH FYI 6/5] Makefile: update IRIX64 section
  2009-07-10 17:10         ` [PATCH FYI 5/5] test-lib.sh: work around ksh's trap shortcomings Brandon Casey
@ 2009-07-10 18:31           ` Brandon Casey
  0 siblings, 0 replies; 8+ messages in thread
From: Brandon Casey @ 2009-07-10 18:31 UTC (permalink / raw)
  To: git; +Cc: Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

---


Here's the update for the 64-bit version of IRIX.  This has been tested to
the same extent that the 32-bit version has been tested.  The 64-bit test
system is a little bit older than the 32-bit system, so a few more tests are
skipped (related to a too old gtar), and NO_STRLCPY and NO_DEFLATE_BOUND
macros are set.

-brandon


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

diff --git a/Makefile b/Makefile
index d404524..baa0296 100644
--- a/Makefile
+++ b/Makefile
@@ -844,17 +844,17 @@ ifeq ($(uname_S),IRIX)
 	NEEDS_LIBGEN = YesPlease
 endif
 ifeq ($(uname_S),IRIX64)
-	NO_IPV6=YesPlease
 	NO_SETENV=YesPlease
+	NO_UNSETENV = YesPlease
 	NO_STRCASESTR=YesPlease
 	NO_MEMMEM = YesPlease
 	NO_MKSTEMPS = YesPlease
-	NO_STRLCPY = YesPlease
-	NO_SOCKADDR_STORAGE=YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MMAP = YesPlease
+	NO_EXTERNAL_GREP = UnfortunatelyYes
+	SNPRINTF_RETURNS_BOGUS = YesPlease
 	SHELL_PATH=/usr/gnu/bin/bash
-	BASIC_CFLAGS += -DPATH_MAX=1024
-	# for now, build 32-bit version
-	BASIC_LDFLAGS += -L/usr/lib32
+	NEEDS_LIBGEN = YesPlease
 endif
 ifeq ($(uname_S),HP-UX)
 	NO_IPV6=YesPlease
-- 
1.6.4.rc0.5.g76f7cf

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

* Re: [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh
  2009-07-10 17:10 [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Brandon Casey
  2009-07-10 17:10 ` [PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5 Brandon Casey
@ 2009-07-11  6:44 ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2009-07-11  6:44 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, Brandon Casey

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

> Otherwise, I've been using this executable somewhat and have not experienced
> any problems.  Maybe it will be useful to others.
>
> Are there actually any IRIX users out there?

I thought at some point Dscho was suffering from IRIX but perhaps he got
out of it?

> These patches are all submitted For-Your-Information only.  Junio, feel free
> to apply any of them or none, and to add my Signed-off-by.

Except for 5/5 all of them looked trivially safe and none of them looked
iffy.  Will queue, possibly with minor tweaks.

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

end of thread, other threads:[~2009-07-11  6:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 17:10 [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Brandon Casey
2009-07-10 17:10 ` [PATCH FYI 1/5] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5 Brandon Casey
2009-07-10 17:10   ` [PATCH FYI 2/5] git-compat-util.h: adjust for SGI " Brandon Casey
2009-07-10 17:10     ` [PATCH FYI 3/5] Makefile: add NEEDS_LIBGEN to optionally add -lgen to compile arguments Brandon Casey
2009-07-10 17:10       ` [PATCH FYI 4/5] Makefile: add section for SGI IRIX 6.5 Brandon Casey
2009-07-10 17:10         ` [PATCH FYI 5/5] test-lib.sh: work around ksh's trap shortcomings Brandon Casey
2009-07-10 18:31           ` [PATCH FYI 6/5] Makefile: update IRIX64 section Brandon Casey
2009-07-11  6:44 ` [PATCH FYI 0/5] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.