This email describes how I have successfully compiled git on SunOS 5.7 with
the native SUNWspro compiler version 6 update 2 C 5.3 2001/05/15 and
successfully run nearly all of the tests using the Korn shell.
A series of 8 patches will follow this email. The patches work around a
few issues with this c89 compiler, and the ancient build environment.
A build script is provided at the end of this email.
The GIT_SKIP_TESTS environment variable was used to skip tests which still fail.
The tests which still fail do so because of an ancient iconv, with two exceptions:
1) the t5000 tests which fail are due to the installed gnu tar being too old, and
2) the t6030 tests which fail do so because of the recent change which calls
trap with signal 0 inside of a function. The installed korn shell (mis-?)handles
this calling sequence.
Otherwise, I've been using this executable somewhat and have not experienced any
problems. Maybe it will be useful to others.
Makefile | 14 +++++++++++++-
builtin-cat-file.c | 2 +-
builtin-reset.c | 2 +-
dir.c | 11 ++++++-----
t/annotate-tests.sh | 2 +-
t/lib-git-svn.sh | 3 +++
t/t1002-read-tree-m-u-2way.sh | 10 ++++++----
t/t4118-apply-empty-context.sh | 2 +-
t/t4200-rerere.sh | 5 +++--
t/t9301-fast-export.sh | 1 -
t/t9700/test.pl | 12 ++++++------
t/test-lib.sh | 2 +-
12 files changed, 42 insertions(+), 24 deletions(-)
-brandon
#!/bin/sh
GIT_SKIP_TESTS='
t3900.1[0-289] t3900.2[023]
t3901.*
t5000.1[0-24-689] t5000.2[01]
t5100.[56] t5100.1[02]
t6030.1[2-9] t6030.2[0-9]
t9301.4
'
GIT_TEST_CMP='cmp -s'
PATH="/usr/xpg4/bin:$PATH"
export PATH GIT_TEST_CMP GIT_SKIP_TESTS
exec gmake \
CC=/opt/SUNWspro/bin/cc \
INSTALL=ginstall \
TAR=gtar \
CFLAGS='-fast' \
NO_CURL=1 \
NO_OPENSSL=1 \
NO_TCLTK=1 \
NO_PERL_MAKEMAKER=1 \
THREADED_DELTA_SEARCH=1 \
"$@"
The following syntax:
char foo[] = {
[0] = 1,
[7] = 2,
[15] = 3
};
is a c99 construct which some compilers do not support even though they
support other c99 constructs. Use an alternative.
---
dir.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
@@ -176,7 +176,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)*old_orig=NULL,sha1_old_orig[20];structcommit*commit;char*reflog_action,msg[1024];-conststructoptionoptions[]={+structoptionoptions[]={OPT_SET_INT(0,"mixed",&reset_type,"reset HEAD and index",MIXED),OPT_SET_INT(0,"soft",&reset_type,"reset only HEAD",SOFT),
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 using an alias.
Additionally, there is some strangeness with respect to aliases and
sourced script files; the alias hack doesn't work. So call 'trap - 0'
directly in lib-git-svn.sh before calling the test_done function.
---
This is the same patch I posted earlier with respect to compiling on IRIX
and Junio has suggested a more elegant solution.
-brandon
t/lib-git-svn.sh | 3 +++
t/test-lib.sh | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
@@ -457,6 +456,7 @@ test_done () {esac}+aliastest_done='trap - exit && test_done'# Test the binaries we have just built. The tests are kept in# t/ subdirectory and are run in 'trash directory' subdirectory.
Some old platforms have an old diff which doesn't have the -U option.
'git diff' can be used in its place. Adjust the comparison function to
strip git's additional header lines to make this possible.
---
Same as the one posted in the IRIX thread.
t/t1002-read-tree-m-u-2way.sh | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
/usr/xpg4/bin/sed exits non-zero if the sed script is not newline
terminated. /bin/sed does not have this problem, so use it instead
where possible.
But, /bin/sed does not handle tab correctly. For this case in t4200,
rework the test so that the exit status of sed does not affect the
outcome of the test, and use /usr/xpg4/bin/sed (which is in the PATH).
---
t/annotate-tests.sh | 2 +-
t/t4118-apply-empty-context.sh | 2 +-
t/t4200-rerere.sh | 5 +++--
3 files changed, 5 insertions(+), 4 deletions(-)
---
Necessary if using my compile script which included t9301.4 in GIT_SKIP_TESTS
environment variable.
-brandon
t/t9301-fast-export.sh | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
From: Jeff King <hidden> Date: 2016-06-15 22:45:11
On Mon, Aug 18, 2008 at 06:39:40PM -0500, Brandon Casey wrote:
1) the t5000 tests which fail are due to the installed gnu tar being
too old, and
Hmm. I thought I had t5000 working on Solaris 5.7 a few months ago.
Unfortunately, the Solaris box I test on is down at the moment, so I
can't take a closer look. What is the problem?
-Peff
Some versions of perl complain when 'STDERR' is used as the third argument
in the 3-argument form of open(). Convert to the 2-argument form which is
described for duping STDERR in my second edition camel book.
The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. These can be converted to use File::Temp::tempfile().
Signed-off-by: Brandon Casey <redacted>
---
t/t9700/test.pl | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
On Mon, Aug 18, 2008 at 06:39:40PM -0500, Brandon Casey wrote:
quoted
1) the t5000 tests which fail are due to the installed gnu tar being
too old, and
Hmm. I thought I had t5000 working on Solaris 5.7 a few months ago.
Unfortunately, the Solaris box I test on is down at the moment, so I
can't take a closer look. What is the problem?
Probably:
$ gtar --version
tar (GNU tar) 1.12
If I stop t5000-tar-tree.sh by inserting an exit before the 10th test
(which is the first one that fails):
t5000-tar-tree.sh:
...
test_expect_success \
'git get-tar-commit-id' \
'git get-tar-commit-id <b.tar >b.commitid &&
diff .git/$(git symbolic-ref HEAD) b.commitid'
exit
test_expect_success \
'extract tar archive' \
'(cd b && "$TAR" xf -) <b.tar'
...
and then execute the test commands manually, I get:
$ cd t/trash\ directory
$ cd b
$ gtar xf - < ../b.tar
/apps/bin/gtar: Unknown file type 'g' for pax_global_header, extracted as normal file
/apps/bin/gtar: : Could not create directory: No such file or directory
/apps/bin/gtar: Error exit delayed from previous errors
$ find .
.
./a
./a/a
./a/l1
./a/substfile1
./a/long_path_to_a_file
./a/long_path_to_a_file/long_path_to_a_file
./a/long_path_to_a_file/long_path_to_a_file/long_path_to_a_file
./a/long_path_to_a_file/long_path_to_a_file/long_path_to_a_file/long_path_to_a_file
./a/bin
./a/bin/sh
./a/substfile2
./pax_global_header
./file_with_long_path
The native tar returns:
$ tar xf - < ../b.tar
tar: directory checksum error
-brandon
From: Jeff King <hidden> Date: 2016-06-15 22:45:11
On Mon, Aug 18, 2008 at 07:47:39PM -0500, Brandon Casey wrote:
quoted
Hmm. I thought I had t5000 working on Solaris 5.7 a few months ago.
Unfortunately, the Solaris box I test on is down at the moment, so I
can't take a closer look. What is the problem?
Probably:
$ gtar --version
tar (GNU tar) 1.12
Ah, I found out the difference: my box is actually Solaris 5.8. The gtar
version there is 1.13 (which is also the version that ships with Solaris
5.9).
$ gtar xf - < ../b.tar
/apps/bin/gtar: Unknown file type 'g' for pax_global_header, extracted as normal file
/apps/bin/gtar: : Could not create directory: No such file or directory
/apps/bin/gtar: Error exit delayed from previous errors
I get the pax header warning, but nothing else. Judging from your find
results:
From: David Kågedal <hidden> Date: 2016-06-15 22:45:14
Brandon Casey [off-list ref] writes:
The following syntax:
char foo[] = {
[0] = 1,
[7] = 2,
[15] = 3
};
is a c99 construct which some compilers do not support even though they
support other c99 constructs. Use an alternative.
But the alternative is much worse. So how important is it to support
non-C99 compilers?
From: Andreas Ericsson <hidden> Date: 2016-06-15 22:45:14
David Kågedal wrote:
Brandon Casey [off-list ref] writes:
quoted
The following syntax:
char foo[] = {
[0] = 1,
[7] = 2,
[15] = 3
};
is a c99 construct which some compilers do not support even though they
support other c99 constructs. Use an alternative.
But the alternative is much worse. So how important is it to support
non-C99 compilers?
Fairly important. Lots of people have gone through lots of work to make
sure git works with legacy compilers.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
The following syntax:
char foo[] = {
[0] = 1,
[7] = 2,
[15] = 3
};
is a c99 construct which some compilers do not support even though they
support other c99 constructs. Use an alternative.
But the alternative is much worse.
_Much_ worse? In what way?
From an execution standpoint, I don't think any more work is performed.
Probably exactly the same amount of work.
From a readability standpoint, I think it is very nearly the same in
this case. The whole function is only 17 lines.
So how important is it to support non-C99 compilers?
I think it is relative to the amount of effort it takes. If there is
a demonstrated need and a trivial work around, I think it is worth
it to support non-c99 compilers. Demonstrated need is required.
But, saying that, I posted the patch you replied to in a series that
was for informational purposes only (though I could have done a better
job labeling them). There were no comments from anyone who said that
the series solved any problems they were encountering. At some point
I will post an update.
-brandon
For just these 5 values it is likely more effective to just use
a conditional statement (less stack requested, less likely
some stupid compiler tries to optimize it wrongly).
And just as readable.
From: Shawn O. Pearce <hidden> Date: 2016-06-15 22:45:15
Alex Riesen [off-list ref] wrote:
quoted hunk
For just these 5 values it is likely more effective to just use
a conditional statement (less stack requested, less likely
some stupid compiler tries to optimize it wrongly).
And just as readable.
From: Alex Riesen <hidden> Date: 2016-06-15 22:45:15
2008/8/28 Shawn O. Pearce [off-list ref]:
Alex Riesen [off-list ref] wrote:
quoted
For just these 5 values it is likely more effective to just use
a conditional statement (less stack requested, less likely
some stupid compiler tries to optimize it wrongly).
And just as readable.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:45:15
Hi,
On Thu, 28 Aug 2008, Shawn O. Pearce wrote:
Alex Riesen [off-list ref] wrote:
quoted
For just these 5 values it is likely more effective to just use
a conditional statement (less stack requested, less likely
some stupid compiler tries to optimize it wrongly).
And just as readable.
If it was, I am very sorry.
But I still think that a lookup for something that is called potentially a
million times per second is better than a switch statement (except when
there are less than, say, 4 cases).
Ciao,
Dscho
From: Tom G. Christensen <hidden> Date: 2016-06-15 22:45:21
Brandon Casey wrote:
Some versions of perl complain when 'STDERR' is used as the third argument
in the 3-argument form of open(). Convert to the 2-argument form which is
described for duping STDERR in my second edition camel book.
The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. These can be converted to use File::Temp::tempfile().
Signed-off-by: Brandon Casey <redacted>
>
Tested-by: Tom G. Christensen <redacted>
Without this patch the testsuite will fail with perl 5.8.0:
t9700$ ./test.pl
ok 1 - use Git;
Bareword "STDERR" not allowed while "strict subs" in use at ./test.pl
line 41.
Execution of ./test.pl aborted due to compilation errors.
1..1
# Looks like your test died just after 1.
Could we please get this patch in?
-tgc
Some versions of perl complain when 'STDERR' is used as the third
argument
in the 3-argument form of open(). Convert to the 2-argument form which is
described for duping STDERR in my second edition camel book.
The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. These can be converted to use
File::Temp::tempfile().
Signed-off-by: Brandon Casey <redacted>
Tested-by: Tom G. Christensen <redacted>
Without this patch the testsuite will fail with perl 5.8.0:
t9700$ ./test.pl
ok 1 - use Git;
Bareword "STDERR" not allowed while "strict subs" in use at ./test.pl
line 41.
Execution of ./test.pl aborted due to compilation errors.
1..1
# Looks like your test died just after 1.
Could we please get this patch in?
Junio had asked me to follow up on that patch at a later time, so
thanks for prodding.
Here is an alternative which _removes_ the File::Temp requirement.
-brandon
Since ff30fff3 removed the call to basename(), we don't need to
'use File::Basename'.
Signed-off-by: Brandon Casey <redacted>
---
t/t9700/test.pl | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
Some versions of perl complain when 'STDERR' is used as the third argument
in the 3-argument form of open(). Convert to the 2-argument form which is
described for duping STDERR in my second edition camel book.
Signed-off-by: Brandon Casey <redacted>
---
t/t9700/test.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. Instead of creating a file with a unique name in
the system TMPDIR, we can create our own temporary file with a static
name and use that instead.
Signed-off-by: Brandon Casey <redacted>
---
t/t9700/test.pl | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
From: Tom G. Christensen <hidden> Date: 2016-06-15 22:45:21
Brandon Casey wrote:
The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. Instead of creating a file with a unique name in
the system TMPDIR, we can create our own temporary file with a static
name and use that instead.
Signed-off-by: Brandon Casey <redacted>
>
Tested-by: Tom G. Christensen <redacted>
I applied all three patches and ran the testsuite with perl 5.8.0
(RHEL3). It now passes t9700 and runs to completion as expected.
-tgc