Portability Patches v3
Subsystems (2)
cover Portability Patches v3
Here are the portability patches we needed at TWW to enable git-1.7.0.2 to compile and run on all of the wide range of Unix machines we support. These patches apply to the git-1.7.0.2 release, and address all of the feedback from the previous two times I posted them to this list, most particularly splitting everything into many small self-contained chunks.
Note that I have not invested the time to figure out why the testsuite is mostly useless on everything but Linux and Solaris 8+, because I'm reasonably satisfied that the build itself is working properly. Most likely, it is merely GNUisms in the way the test cases call external tools. But maybe I'm missing something, but even the 3 new patches to address test errors when diff does not support the -u option don't improve the testsuite situation on HPUX, AIX, OSF1 and Solaris 7 and older.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 1/15 user-cppflags.patch
Without this patch there is no straight forward way to pass additional CPPFLAGS at configure-time. At TWW, everything non-vendor package is installed to its own subdirectory, so we need the following to show the preprocessor where the headers for the libraries we will link later can be found:
$SHELL ./configure \
CPPFLAGS="-I${SB_VAR_CURL_INC}\
-I${SB_VAR_LIBEXPAT_INC}\
-I${SB_VAR_LIBZ_INC}\
${CPPFLAGS+ $CPPFLAGS}" <<...>>
---
Makefile | 6 ++++--
config.mak.in | 1 +
configure.ac | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)Makefile +1 -1
@@ -236,7 +236,7 @@ endif CFLAGS = -g -O2 -Wall LDFLAGS = -ALL_CFLAGS = $(CFLAGS) +ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) STRIP ?= strip
config.mak.in +1 -0
@@ -3,6 +3,7 @@ CC = @CC@ CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ CC_LD_DYNPATH = @CC_LD_DYNPATH@ AR = @AR@
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 01/15] user-cppflags.patch
Looked sane (I didn't apply nor test, only read it through, though); thanks.
PATCH 2/15 const-expr.patch
In reply to Gary V. VaughanUnfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary).
This patch simply breaks apart any compound declarations with dynamic initialisation expressions, and moves the initialisation until after the last declaration in the same block, in all the places necessary to have the offending compilers accept the code.
--- builtin-add.c | 4 +++- builtin-blame.c | 10 ++++++---- builtin-cat-file.c | 4 +++- builtin-checkout.c | 3 ++- builtin-commit.c | 3 ++- builtin-fetch.c | 6 ++++-- builtin-remote.c | 9 ++++++--- convert.c | 4 +++- daemon.c | 19 ++++++++++--------- ll-merge.c | 14 +++++++------- refs.c | 6 +++++- remote.c | 3 +-- unpack-trees.c | 4 +++- wt-status.c | 23 ++++++++++++----------- 14 files changed, 67 insertions(+), 45 deletions(-)
convert.c +3 -1
@@ -249,7 +249,9 @@ static int filter_buffer(int in, int outstruct child_process child_process;struct filter_params *params = (struct filter_params *)data;int write_err, status; -const char *argv[] = { params->cmd,NULL }; +const char *argv[] = {NULL ,NULL }; + + argv[0 ] = params->cmd;memset (&child_process,0 ,sizeof (child_process)); child_process.argv = argv;
remote.c +1 -2
@@ -657,10 +657,9 @@ static struct refspec *parse_refspec_intint valid_fetch_refspec (const char *fetch_refspec_str) { -const char *fetch_refspec[] = { fetch_refspec_str };struct refspec *refspec; - refspec =parse_refspec_internal (1 , fetch_refspec,1 ,1 ); + refspec =parse_refspec_internal (1 , &fetch_refspec_str,1 ,1 );free_refspecs (refspec,1 );return !!refspec; }
unpack-trees.c +3 -1
@@ -287,9 +287,11 @@ static void add_same_unmerged(struct cacstatic int unpack_index_entry (struct cache_entry *ce,struct unpack_trees_options *o) { -struct cache_entry *src[5 ] = { ce,NULL , }; +struct cache_entry *src[5 ] = {NULL ,NULL };int ret; + src[0 ] = ce; +mark_ce_used (ce, o);if (ce_stage (ce)) {if (o->skip_unmerged) {
daemon.c +10 -9
@@ -141,15 +141,14 @@ static char *path_ok(char *directory) }else if (interpolated_path && saw_extended_args) {struct strbuf expanded_path =STRBUF_INIT ; -struct strbuf_expand_dict_entry dict[] = { - {"H" , hostname }, - {"CH" , canon_hostname }, - {"IP" , ip_address }, - {"P" , tcp_port }, - {"D" , directory }, - {NULL } - }; +struct strbuf_expand_dict_entry dict[6 ]; + dict[0 ].placeholder ="H" ; dict[0 ].value = hostname; + dict[1 ].placeholder ="CH" ; dict[1 ].value = canon_hostname; + dict[2 ].placeholder ="IP" ; dict[2 ].value = ip_address; + dict[3 ].placeholder ="P" ; dict[3 ].value = tcp_port; + dict[4 ].placeholder ="D" ; dict[4 ].value = directory; + dict[5 ].placeholder =NULL ; dict[5 ].value =NULL ;if (*dir !='/' ) {/* Allow only absolute */ logerror ("'%s': Non-absolute path denied (interpolated-path active)" , dir);
@@ -343,7 +342,9 @@ static int upload_pack(void) {/* Timeout as string */ char timeout_buf[64 ]; -const char *argv[] = {"upload-pack" ,"--strict" , timeout_buf,"." ,NULL }; +const char *argv[] = {"upload-pack" ,"--strict" ,NULL ,"." ,NULL }; + + argv[2 ] = timeout_buf;snprintf (timeout_buf,sizeof timeout_buf,"--timeout=%u" , timeout);return run_service_command (argv);
wt-status.c +12 -11
@@ -464,17 +464,18 @@ static void wt_status_print_submodule_sustruct child_process sm_summary;char summary_limit[64 ];char index[PATH_MAX ]; -const char *env[] = { index,NULL }; -const char *argv[] = { -"submodule" , -"summary" , - uncommitted ?"--files" :"--cached" , -"--for-status" , -"--summary-limit" , - summary_limit, - uncommitted ?NULL : (s->amend ?"HEAD^" :"HEAD" ), -NULL - }; +const char *env[] = {NULL ,NULL }; +const char *argv[8 ]; + + env[0 ] = index; + argv[0 ] ="submodule" ; + argv[1 ] ="summary" ; + argv[2 ] = uncommitted ?"--files" :"--cached" ; + argv[3 ] ="--for-status" ; + argv[4 ] ="--summary-limit" ; + argv[5 ] = summary_limit; + argv[6 ] = uncommitted ?NULL : (s->amend ?"HEAD^" :"HEAD" ); + argv[7 ] =NULL ;sprintf (summary_limit,"%d" , s->submodule_summary);snprintf (index,sizeof (index),"GIT_INDEX_FILE=%s" , s->index_file);
ll-merge.c +7 -7
@@ -172,17 +172,17 @@ static int ll_ext_merge(const struct ll_ {char temp[4 ][50 ];struct strbuf cmd =STRBUF_INIT ; -struct strbuf_expand_dict_entry dict[] = { - {"O" , temp[0 ] }, - {"A" , temp[1 ] }, - {"B" , temp[2 ] }, - {"L" , temp[3 ] }, - {NULL } - }; +struct strbuf_expand_dict_entry dict[5 ];const char *args[] = {NULL ,NULL };int status, fd, i;struct stat st; + dict[0 ].placeholder ="O" ; dict[0 ].value = temp[0 ]; + dict[1 ].placeholder ="A" ; dict[1 ].value = temp[1 ]; + dict[2 ].placeholder ="B" ; dict[2 ].value = temp[2 ]; + dict[3 ].placeholder ="L" ; dict[3 ].value = temp[3 ]; + dict[3 ].placeholder =NULL ; dict[3 ].value =NULL ; +if (fn->cmdline ==NULL )die ("custom merge driver %s lacks command line." , fn->name);
builtin-commit.c +2 -1
@@ -715,7 +715,8 @@ static int prepare_to_commit(const charif (use_editor) {char index[PATH_MAX ]; -const char *env[2 ] = { index,NULL }; +const char *env[] = {NULL ,NULL }; + env[0 ] = index;snprintf (index,sizeof (index),"GIT_INDEX_FILE=%s" , index_file);if (launch_editor (git_path (commit_editmsg),NULL , env)) { fprintf(stderr,
builtin-remote.c +6 -3
@@ -705,11 +705,14 @@ static int rm(int argc, const char **argstruct known_remotes known_remotes = {NULL ,NULL };struct string_list branches = {NULL ,0 ,0 ,1 };struct string_list skipped = {NULL ,0 ,0 ,1 }; -struct branches_for_remote cb_data = { -NULL , &branches, &skipped, &known_remotes - }; +struct branches_for_remote cb_data;int i, result; +memset (&cb_data,0 ,sizeof (cb_data)); + cb_data.branches = &branches; + cb_data.skipped = &skipped; + cb_data.keep = &known_remotes; +if (argc !=2 )usage_with_options (builtin_remote_rm_usage, options);
builtin-blame.c +6 -4
@@ -733,10 +733,11 @@ static int pass_blame_to_parent(struct s {int last_in_target;mmfile_t file_p, file_o; -struct blame_chunk_cb_data d = { sb, target, parent,0 ,0 }; +struct blame_chunk_cb_data d;xpparam_t xpp;xdemitconf_t xecfg; - +memset (&d,0 ,sizeof (d)); + d.sb = sb; d.target = target; d.parent=parent; last_in_target =find_last_in_target (sb, target);if (last_in_target <0 )return 1 ;/* nothing remains for this target */
@@ -875,10 +876,11 @@ static void find_copy_in_blob(struct scoconst char *cp;int cnt;mmfile_t file_o; -struct handle_split_cb_data d = { sb, ent, parent, split,0 ,0 }; +struct handle_split_cb_data d;xpparam_t xpp;xdemitconf_t xecfg; - +memset (&d,0 ,sizeof (d)); + d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;/* * Prepare mmfile that contains only the lines in ent. */
builtin-cat-file.c +3 -1
@@ -118,7 +118,9 @@ static int cat_one_file(int opt, const c/* custom pretty-print here */ if (type ==OBJ_TREE ) { -const char *ls_args[3 ] = {"ls-tree" , obj_name,NULL }; +const char *ls_args[3 ] = {NULL ,NULL ,NULL }; + ls_args[0 ] ="ls-tree" ; + ls_args[1 ] = obj_name;return cmd_ls_tree (2 , ls_args,NULL ); }
refs.c +5 -1
@@ -311,7 +311,11 @@ static int warn_if_dangling_symref(constvoid warn_dangling_symref (FILE *fp,const char *msg_fmt,const char *refname) { -struct warn_if_dangling_data data = { fp, refname, msg_fmt }; +struct warn_if_dangling_data data; + + data.fp = fp; + data.refname = refname; + data.msg_fmt = msg_fmt;for_each_rawref (warn_if_dangling_symref, &data); }
builtin-add.c +3 -1
@@ -255,12 +255,14 @@ static int edit_patch(int argc, const ch {char *file =xstrdup (git_path ("ADD_EDIT.patch" ));const char *apply_argv[] = {"apply" ,"--recount" ,"--cached" , - file,NULL }; +NULL ,NULL };struct child_process child;struct rev_info rev;int out;struct stat st; + apply_argv[3 ] = file; +git_config (git_diff_basic_config,NULL );/* no "diff" UI options */ if (read_cache () <0 )
builtin-checkout.c +2 -1
@@ -612,7 +612,8 @@ static int check_tracking_name(const chastatic const char *unique_tracking_name (const char *name) { -struct tracking_name_data cb_data = { name,NULL ,1 }; +struct tracking_name_data cb_data = {NULL ,NULL ,1 }; + cb_data.name = name;for_each_ref (check_tracking_name, &cb_data);if (cb_data.unique)return cb_data.remote;
builtin-fetch.c +4 -2
@@ -573,9 +573,10 @@ static void find_non_local_tags(struct t {struct string_list existing_refs = {NULL ,0 ,0 ,0 };struct string_list remote_refs = {NULL ,0 ,0 ,0 }; -struct tag_data data = {head, tail}; +struct tag_data data;const struct ref *ref;struct string_list_item *item =NULL ; + data.head = head; data.tail = tail;for_each_ref (add_existing, &existing_refs);for (ref =transport_get_remote_refs (transport); ref; ref = ref->next) {
@@ -768,7 +769,8 @@ static int get_remote_group(const char *static int add_remote_or_group (const char *name,struct string_list *list) {int prev_nr = list->nr; -struct remote_group_data g = { name, list }; +struct remote_group_data g; + g.name = name; g.list = list;git_config (get_remote_group, &g);if (list->nr == prev_nr) {
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 02/15] const-expr.patch
Quoted 5 lines · Gary V. Vaughan
Unfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary).
Yes, a comprehensive list would be appreciated. This change is an uglification that I personally would prefer to stay out of the code base unless many consumers of git are hurt.
The problem with this non-feature is that it is all too easy that new code introduces new incompatibilities.
ll-merge.c
Quoted 4 lines
Index:
b/ll-merge.c
===================================================================ll-merge.c +0
-0
BTW, did you notice that git is a version control system that hosts itself? ;)
ll-merge.c static int ll_ext_merge(const struct ll_ · line 184
Quoted 5 lines
ll-merge.c +5
-0+ dict[0 ].placeholder ="O" ; dict[0 ].value = temp[0 ]; + dict[1 ].placeholder ="A" ; dict[1 ].value = temp[1 ]; + dict[2 ].placeholder ="B" ; dict[2 ].value = temp[2 ]; + dict[3 ].placeholder ="L" ; dict[3 ].value = temp[3 ]; + dict[3 ].placeholder =NULL ; dict[3 ].value =NULL ;
dict[4]...
-- Hannes
Re: [patch 02/15] const-expr.patch
Quoted 7 lines · Johannes Sixt
Quoted 5 lines · Gary V. Vaughan
Unfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary).
Quoted 6 lines
Yes, a comprehensive list would be appreciated. This change is an uglification that I personally would prefer to stay out of the code base unless many consumers of git are hurt.
The problem with this non-feature is that it is all too easy that new code introduces new incompatibilities.
This is probably a stupid question, but why not just build it using gcc on systems with a broken vendor compiler? You don't have to distribute gcc just to distribute binaries built with it, so it seems like there's no downside... and less suffering for the build maintainer.
Have fun,
Avery
Re: [patch 02/15] const-expr.patch
[It seems like all my replies to this list don't make it through, even though I'm able to post a new thread. Please forward on my behalf.]
Quoted 12 lines · Avery Pennarun
Quoted 11 lines · Johannes Sixt
Quoted 5 lines · Gary V. Vaughan
Unfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary).
Yes, a comprehensive list would be appreciated. This change is an uglification that I personally would prefer to stay out of the code base unless many consumers of git are hurt.
Quoted 8 lines
Quoted 2 lines
The problem with this non-feature is that it is all too easy that new code introduces new incompatibilities.
This is probably a stupid question, but why not just build it using gcc on systems with a broken vendor compiler? You don't have to distribute gcc just to distribute binaries built with it, so it seems like there's no downside... and less suffering for the build maintainer.
More often than not the vendor compiler produces better code than gcc on any given architecture, and one of the features of the TWW package builds is that in the vast majority of cases we port the upstream code to build using the vendor compiler, because this is what our customers want.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 02/15] const-expr.patch
In reply to Johannes SixtQuoted 10 lines · Johannes Sixt
Quoted 5 lines · Gary V. Vaughan
Unfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary).
Yes, a comprehensive list would be appreciated. This change is an uglification that I personally would prefer to stay out of the code base unless many consumers of git are hurt.
Portable code is rarely pretty... just take a look at the output of autoconf or automake.
Of the various architectures we support, the latest vendor compilers for IRIX 6.5 and older, and for HP-UX 10.20 and older do not compile dynamic compound declarations, throwing errors such as:
cc-1028 cc: ERROR File = const-expr.c, Line = 6
The expression used must have a constant value.
const char *array[2] = { str, NULL };
^1 error detected in the compilation of "const-expr.c".
Quoted 2 lines
The problem with this non-feature is that it is all too easy that new code introduces new incompatibilities.
Do you mean that new code may prevent the code from compiling on those machines again? Well, that's kinda the same problem you have when you wish to support any architecture that you don't have access to... the beauty of free software is that if it bites any significant number of people you will get bug reports, and probably patches for as long as people want to use the software on those machines.
Quoted 6 lines
ll-merge.c
Quoted 4 lines
Index:
b/ll-merge.c
===================================================================ll-merge.c +0
-0BTW, did you notice that git is a version control system that hosts itself? ;)
I did... but we use the SCM neutral quilt package to manage our local stack of per-package patches. I'm not particularly fluent with git yet, and it took only a couple of minutes to get quilt to submit a message threaded set of patch emails to the list in a git-like format.
Does git absolutely require that you clone the entire project history to your local disk? For the thousands of ports we maintain, that would fast become a giant chunk of disk!
Quoted 7 lines
ll-merge.c static int ll_ext_merge(const struct ll_ · line 184
Quoted 5 lines
ll-merge.c +5
-0+ dict[0 ].placeholder ="O" ; dict[0 ].value = temp[0 ]; + dict[1 ].placeholder ="A" ; dict[1 ].value = temp[1 ]; + dict[2 ].placeholder ="B" ; dict[2 ].value = temp[2 ]; + dict[3 ].placeholder ="L" ; dict[3 ].value = temp[3 ]; + dict[3 ].placeholder =NULL ; dict[3 ].value =NULL ;dict[4]...
Oops. Nice catch, thanks.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 3/15 pthread.patch
In reply to Gary V. VaughanWithout this patch, systems that provide stubs for pthread functions in libc, but which still require libpthread for full the pthread implementation are not detected correctly.
Also, some systems require -pthread in CFLAGS for each compilation unit for a successful link of an mt binary, which is also addressed by this patch.
--- Makefile | 4 ++++ config.mak.in | 1 + configure.ac | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-)
Makefile +4 -0
@@ -287,6 +287,7 @@ RPMBUILD = rpmbuild TCL_PATH = tclsh TCLTK_PATH = wish PTHREAD_LIBS = -lpthread +PTHREAD_CFLAGS = export TCL_PATH TCLTK_PATH
@@ -856,6 +857,8 @@ ifeq ($(uname_S),AIX) BASIC_CFLAGS += -D_LARGE_FILES ifeq ($(shell expr "$(uname_V)" : '[1234]'),1) NO_PTHREADS = YesPlease + else + PTHREAD_LIBS = -lpthread endif endif ifeq ($(uname_S),GNU)
@@ -1297,6 +1300,7 @@ endif ifdef NO_PTHREADS BASIC_CFLAGS += -DNO_PTHREADS else + BASIC_CFLAGS += $(PTHREAD_CFLAGS) EXTLIBS += $(PTHREAD_LIBS) LIB_OBJS += thread-utils.o endif
configure.ac +15 -2
@@ -782,7 +782,11 @@ AC_DEFUN([PTHREADTEST_SRC], [ int main(void) { pthread_mutex_t test_mutex; - return (0); + int retcode = 0; + retcode |= pthread_mutex_init(&test_mutex,(void*)0); + retcode |= pthread_mutex_lock(&test_mutex); + retcode |= pthread_mutex_unlock(&test_mutex); + return retcode; } ])
@@ -799,7 +803,8 @@ if test -n "$USER_NOPTHREAD"; then # handle these separately since PTHREAD_CFLAGS could be '-lpthreads # -D_REENTRANT' or some such. elif test -z "$PTHREAD_CFLAGS"; then - for opt in -pthread -lpthread; do + threads_found=no + for opt in -mt -pthread -lpthread; do old_CFLAGS="$CFLAGS" CFLAGS="$opt $CFLAGS" AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])
@@ -807,11 +812,18 @@ elif test -z "$PTHREAD_CFLAGS"; then [AC_MSG_RESULT([yes]) NO_PTHREADS= PTHREAD_LIBS="$opt" + PTHREAD_CFLAGS="$opt" + threads_found=yes break ], [AC_MSG_RESULT([no])]) CFLAGS="$old_CFLAGS" done + if test $threads_found != yes; then + AC_CHECK_LIB([pthread], [pthread_create], + [PTHREAD_LIBS="-lpthread"], + [NO_PTHREADS=UnfortunatelyYes]) + fi else old_CFLAGS="$CFLAGS" CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
@@ -828,6 +840,7 @@ fi CFLAGS="$old_CFLAGS" +AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_LIBS) AC_SUBST(NO_PTHREADS)
config.mak.in +1 -0
@@ -57,4 +57,5 @@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@ FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@ NO_PTHREADS=@NO_PTHREADS@ +PTHREAD_CFLAGS=@PTHREAD_CFLAGS@ PTHREAD_LIBS=@PTHREAD_LIBS@
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 03/15] pthread.patch
Looked sane (I didn't apply nor test, only read it through, though); thanks.
PATCH 4/15 diff-export.patch
In reply to Gary V. VaughanSome of the flags used with the first diff found in PATH cause the vendor diff to choke.
--- Documentation/install-webdoc.sh | 2 +- Makefile | 4 +++- config.mak.in | 1 + configure.ac | 1 + git-merge-one-file.sh | 2 +- t/Makefile | 1 + 6 files changed, 8 insertions(+), 3 deletions(-)
Makefile +3 -1
@@ -280,6 +280,7 @@ export prefix bindir sharedir sysconfdir CC = gcc AR = ar RM = rm -f +DIFF = diff TAR = tar FIND = find INSTALL = install
@@ -1408,7 +1409,7 @@ endif ALL_CFLAGS += $(BASIC_CFLAGS) ALL_LDFLAGS += $(BASIC_LDFLAGS) -export TAR INSTALL DESTDIR SHELL_PATH +export DIFF TAR INSTALL DESTDIR SHELL_PATH ### Build rules
@@ -1698,6 +1699,7 @@ GIT-CFLAGS: FORCE GIT-BUILD-OPTIONS: FORCE @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@ + @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
configure.ac +1 -0
@@ -342,6 +342,7 @@ fi #AC_PROG_INSTALL # needs install-sh or install.sh in sources AC_CHECK_TOOLS(AR, [gar ar], :) AC_CHECK_PROGS(TAR, [gtar tar]) +AC_CHECK_PROGS(DIFF, [gnudiff gdiff diff]) # TCLTK_PATH will be set to some value if we want Tcl/Tk # or will be empty otherwise. if test -z "$NO_TCLTK"; then
Documentation/install-webdoc.sh +1 -1
@@ -12,7 +12,7 @@ do then : did not match elif test -f "$T/$h" && - diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h" + $DIFF -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h" then :; # up to date else
git-merge-one-file.sh +1 -1
@@ -107,7 +107,7 @@ case "${1:-.}${2:-.}${3:-.}" in # remove lines that are unique to ours. orig=`git-unpack-file $2` sz0=`wc -c <"$orig"` - diff -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add + $DIFF -u -La/$orig -Lb/$orig $orig $src2 | git apply --no-add sz1=`wc -c <"$orig"` # If we do not have enough common material, it is not
config.mak.in +1 -0
@@ -8,6 +8,7 @@ LDFLAGS = @LDFLAGS@ CC_LD_DYNPATH = @CC_LD_DYNPATH@ AR = @AR@ TAR = @TAR@ +DIFF = @DIFF@ #INSTALL = @INSTALL@ # needs install-sh or install.sh in sources TCLTK_PATH = @TCLTK_PATH@
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 04/15] diff-export.patch
Looked sane (I didn't apply nor test, only read it through, though). Thanks.
PATCH 5/15 diff-test_cmp.patch
In reply to Gary V. VaughanIn tests, call test_cmp rather than raw diff where possible (i.e. if the output does not go to a pipe), to allow the use of, say, 'cmp' when the default 'diff -u' is not compatible with a vendor diff.
When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.
--- t/Makefile | 1 + t/t0000-basic.sh | 2 +- t/t3200-branch.sh | 4 ++-- t/t3210-pack-refs.sh | 8 ++++---- t/t3903-stash.sh | 2 +- t/t4002-diff-basic.sh | 2 +- t/t4124-apply-ws-rule.sh | 10 +++++----- t/t4127-apply-same-fn.sh | 6 +++--- t/t5300-pack-object.sh | 6 +++--- t/t5510-fetch.sh | 2 +- t/t5520-pull.sh | 2 +- t/t5700-clone-reference.sh | 8 ++++---- t/t6000lib.sh | 2 +- t/t6001-rev-list-graft.sh | 2 +- t/t6022-merge-rename.sh | 4 ++-- t/t7002-grep.sh | 16 ++++++++-------- t/t7005-editor.sh | 6 +++--- t/t9200-git-cvsexportcommit.sh | 26 +++++++++++++------------- t/t9400-git-cvsserver-server.sh | 24 ++++++++++++------------ 19 files changed, 67 insertions(+), 66 deletions(-)
t/t0000-basic.sh +1 -1
@@ -280,7 +280,7 @@ $expectfilter >expected <<\EOF EOF test_expect_success \ 'validate git diff-files output for a know cache/work tree state.' \ - 'git diff-files >current && diff >/dev/null -b current expected' + 'git diff-files >current && test_cmp current expected >/dev/null' test_expect_success \ 'git update-index --refresh should succeed.' \
t/t3200-branch.sh +2 -2
@@ -43,7 +43,7 @@ test_expect_success \ git branch -l d/e/f && test -f .git/refs/heads/d/e/f && test -f .git/logs/refs/heads/d/e/f && - diff expect .git/logs/refs/heads/d/e/f' + test_cmp expect .git/logs/refs/heads/d/e/f' test_expect_success \ 'git branch -d d/e/f should delete a branch and a log' \
@@ -222,7 +222,7 @@ test_expect_success \ git checkout -b g/h/i -l master && test -f .git/refs/heads/g/h/i && test -f .git/logs/refs/heads/g/h/i && - diff expect .git/logs/refs/heads/g/h/i' + test_cmp expect .git/logs/refs/heads/g/h/i' test_expect_success 'avoid ambiguous track' ' git config branch.autosetupmerge true &&
t/t3210-pack-refs.sh +4 -4
@@ -28,7 +28,7 @@ test_expect_success \ SHA1=`cat .git/refs/heads/a` && echo "$SHA1 refs/heads/a" >expect && git show-ref a >result && - diff expect result' + test_cmp expect result' test_expect_success \ 'see if a branch still exists when packed' \
@@ -37,7 +37,7 @@ test_expect_success \ rm -f .git/refs/heads/b && echo "$SHA1 refs/heads/b" >expect && git show-ref b >result && - diff expect result' + test_cmp expect result' test_expect_success 'git branch c/d should barf if branch c exists' ' git branch c &&
@@ -52,7 +52,7 @@ test_expect_success \ git pack-refs --all --prune && echo "$SHA1 refs/heads/e" >expect && git show-ref e >result && - diff expect result' + test_cmp expect result' test_expect_success 'see if git pack-refs --prune remove ref files' ' git branch f &&
@@ -109,7 +109,7 @@ test_expect_success 'pack, prune and rep git show-ref >all-of-them && git pack-refs && git show-ref >again && - diff all-of-them again + test_cmp all-of-them again ' test_done
t/t4002-diff-basic.sh +1 -1
@@ -135,7 +135,7 @@ cmp_diff_files_output () { # filesystem. sed <"$2" >.test-tmp \ -e '/^:000000 /d;s/'$x40'\( [MCRNDU][0-9]*\) /'$z40'\1 /' && - diff "$1" .test-tmp + test_cmp "$1" .test-tmp } test_expect_success \
t/t4124-apply-ws-rule.sh +5 -5
@@ -44,7 +44,7 @@ test_fix () { apply_patch --whitespace=fix || return 1 # find touched lines - diff file target | sed -n -e "s/^> //p" >fixed + $DIFF file target | sed -n -e "s/^> //p" >fixed # the changed lines are all expeced to change fixed_cnt=$(wc -l <fixed)
@@ -85,14 +85,14 @@ test_expect_success setup ' test_expect_success 'whitespace=nowarn, default rule' ' apply_patch --whitespace=nowarn && - diff file target + test_cmp file target ' test_expect_success 'whitespace=warn, default rule' ' apply_patch --whitespace=warn && - diff file target + test_cmp file target '
@@ -108,7 +108,7 @@ test_expect_success 'whitespace=error-al git config core.whitespace -trailing,-space-before,-indent && apply_patch --whitespace=error-all && - diff file target + test_cmp file target '
@@ -117,7 +117,7 @@ test_expect_success 'whitespace=error-al git config --unset core.whitespace && echo "target -whitespace" >.gitattributes && apply_patch --whitespace=error-all && - diff file target + test_cmp file target '
t/t5300-pack-object.sh +3 -3
@@ -147,7 +147,7 @@ test_expect_success \ git cat-file $t $object || return 1 done <obj-list } >current && - diff expect current' + test_cmp expect current' test_expect_success \ 'use packed deltified (REF_DELTA) objects' \
@@ -162,7 +162,7 @@ test_expect_success \ git cat-file $t $object || return 1 done <obj-list } >current && - diff expect current' + test_cmp expect current' test_expect_success \ 'use packed deltified (OFS_DELTA) objects' \
@@ -177,7 +177,7 @@ test_expect_success \ git cat-file $t $object || return 1 done <obj-list } >current && - diff expect current' + test_cmp expect current' unset GIT_OBJECT_DIRECTORY
t/t5510-fetch.sh +1 -1
@@ -71,7 +71,7 @@ test_expect_success "fetch test for-merg echo "$one_in_two " } >expected && cut -f -2 .git/FETCH_HEAD >actual && - diff expected actual' + test_cmp expected actual' test_expect_success 'fetch tags when there is no tags' '
t/t5520-pull.sh +1 -1
@@ -26,7 +26,7 @@ cd "$D" test_expect_success 'checking the results' ' test -f file && test -f cloned/file && - diff file cloned/file + test_cmp file cloned/file ' test_expect_success 'pulling into void using master:master' '
t/t5700-clone-reference.sh +4 -4
@@ -48,7 +48,7 @@ test_expect_success 'that reference gets 'cd C && echo "0 objects, 0 kilobytes" > expected && git count-objects > current && -diff expected current' +test_cmp expected current' cd "$base_dir"
@@ -75,7 +75,7 @@ cd "$base_dir" test_expect_success 'that reference gets used' \ 'cd D && echo "0 objects, 0 kilobytes" > expected && git count-objects > current && -diff expected current' +test_cmp expected current' cd "$base_dir"
@@ -100,7 +100,7 @@ test_expect_success 'that alternate to o 'cd C && echo "2 objects" > expected && git count-objects | cut -d, -f1 > current && -diff expected current' +test_cmp expected current' cd "$base_dir"
@@ -116,7 +116,7 @@ test_expect_success 'check objects expec 'cd D && echo "5 objects" > expected && git count-objects | cut -d, -f1 > current && -diff expected current' +test_cmp expected current' cd "$base_dir"
t/t6000lib.sh +1 -1
@@ -91,7 +91,7 @@ check_output() shift 1 if eval "$*" | entag > $_name.actual then - diff $_name.expected $_name.actual + test_cmp $_name.expected $_name.actual else return 1; fi
t/t6001-rev-list-graft.sh +1 -1
@@ -84,7 +84,7 @@ check () { git rev-list --parents --pretty=raw $arg | sed -n -e 's/^commit //p' >test.actual fi - diff test.expect test.actual + test_cmp test.expect test.actual } for type in basic parents parents-raw
t/t6022-merge-rename.sh +2 -2
@@ -280,7 +280,7 @@ test_expect_success 'updated working tre echo "BAD: should have complained" return 1 } - diff M M.saved || { + test_cmp M M.saved || { echo "BAD: should have left M intact" return 1 }
@@ -301,7 +301,7 @@ test_expect_success 'updated working tre echo "BAD: should have complained" return 1 } - diff M M.saved || { + test_cmp M M.saved || { echo "BAD: should have left M intact" return 1 }
t/t7002-grep.sh +8 -8
@@ -60,7 +60,7 @@ do echo ${HC}file:5:foo_mmap bar mmap baz } >expected && git grep -n -w -e mmap $H >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep -w $L (w)" '
@@ -74,7 +74,7 @@ do echo ${HC}x:1:x x xx x } >expected && git grep -n -w -e "x xx* x" $H >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep -w $L (y-1)" '
@@ -82,7 +82,7 @@ do echo ${HC}y:1:y yy } >expected && git grep -n -w -e "^y" $H >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep -w $L (y-2)" '
@@ -93,7 +93,7 @@ do cat actual false else - diff expected actual + test_cmp expected actual fi '
@@ -105,14 +105,14 @@ do cat actual false else - diff expected actual + test_cmp expected actual fi ' test_expect_success "grep $L (t-1)" ' echo "${HC}t/t:1:test" >expected && git grep -n -e test $H >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep $L (t-2)" '
@@ -121,7 +121,7 @@ do cd t && git grep -n -e test $H ) >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep $L (t-3)" '
@@ -130,7 +130,7 @@ do cd t && git grep --full-name -n -e test $H ) >actual && - diff expected actual + test_cmp expected actual ' test_expect_success "grep -c $L (no /dev/null)" '
t/t7005-editor.sh +3 -3
@@ -38,7 +38,7 @@ test_expect_success setup ' test_commit "$msg" && echo "$msg" >expect && git show -s --format=%s > actual && - diff actual expect + test_cmp actual expect '
@@ -85,7 +85,7 @@ do git --exec-path=. commit --amend && git show -s --pretty=oneline | sed -e "s/^[0-9a-f]* //" >actual && - diff actual expect + test_cmp actual expect ' done
@@ -107,7 +107,7 @@ do git --exec-path=. commit --amend && git show -s --pretty=oneline | sed -e "s/^[0-9a-f]* //" >actual && - diff actual expect + test_cmp actual expect ' done
t/t9200-git-cvsexportcommit.sh +13 -13
@@ -63,10 +63,10 @@ test_expect_success \ check_entries B "newfile2.txt/1.1/" && check_entries C "newfile3.png/1.1/-kb" && check_entries D "newfile4.png/1.1/-kb" && - diff A/newfile1.txt ../A/newfile1.txt && - diff B/newfile2.txt ../B/newfile2.txt && - diff C/newfile3.png ../C/newfile3.png && - diff D/newfile4.png ../D/newfile4.png + test_cmp A/newfile1.txt ../A/newfile1.txt && + test_cmp B/newfile2.txt ../B/newfile2.txt && + test_cmp C/newfile3.png ../C/newfile3.png && + test_cmp D/newfile4.png ../D/newfile4.png )' test_expect_success \
@@ -89,10 +89,10 @@ test_expect_success \ check_entries D "newfile4.png/1.2/-kb" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && - diff A/newfile1.txt ../A/newfile1.txt && - diff D/newfile4.png ../D/newfile4.png && - diff E/newfile5.txt ../E/newfile5.txt && - diff F/newfile6.png ../F/newfile6.png + test_cmp A/newfile1.txt ../A/newfile1.txt && + test_cmp D/newfile4.png ../D/newfile4.png && + test_cmp E/newfile5.txt ../E/newfile5.txt && + test_cmp F/newfile6.png ../F/newfile6.png )' # Should fail (but only on the git cvsexportcommit stage)
@@ -137,9 +137,9 @@ test_expect_success \ check_entries D "" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && - diff A/newfile1.txt ../A/newfile1.txt && - diff E/newfile5.txt ../E/newfile5.txt && - diff F/newfile6.png ../F/newfile6.png + test_cmp A/newfile1.txt ../A/newfile1.txt && + test_cmp E/newfile5.txt ../E/newfile5.txt && + test_cmp F/newfile6.png ../F/newfile6.png )' test_expect_success \
@@ -155,8 +155,8 @@ test_expect_success \ check_entries D "" && check_entries E "newfile5.txt/1.1/" && check_entries F "newfile6.png/1.1/-kb" && - diff E/newfile5.txt ../E/newfile5.txt && - diff F/newfile6.png ../F/newfile6.png + test_cmp E/newfile5.txt ../E/newfile5.txt && + test_cmp F/newfile6.png ../F/newfile6.png )' test_expect_success \
t/t9400-git-cvsserver-server.sh +12 -12
@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && - diff -q cvswork cvswork2' + test_cmp cvswork cvswork2' >/dev/null rm -fr cvswork2 test_expect_success 'gitcvs.ext.enabled = false' \
@@ -247,7 +247,7 @@ test_expect_success 'gitcvs.dbname' \ 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite && GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && - diff -q cvswork cvswork2 && + test_cmp cvswork cvswork2 >/dev/null && test -f "$SERVERDIR/gitcvs.ext.master.sqlite" && cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"'
@@ -257,7 +257,7 @@ test_expect_success 'gitcvs.ext.dbname' GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && - diff -q cvswork cvswork2 && + test_cmp cvswork cvswork2 >/dev/null && test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" && test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" && cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
@@ -282,7 +282,7 @@ test_expect_success 'cvs update (create cd cvswork && GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" && - diff -q testfile1 ../testfile1' + test_cmp testfile1 ../testfile1' >/dev/null cd "$WORKDIR" test_expect_success 'cvs update (update existing file)' \
@@ -293,7 +293,7 @@ test_expect_success 'cvs update (update cd cvswork && GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" && - diff -q testfile1 ../testfile1' + test_cmp testfile1 ../testfile1' >/dev/null cd "$WORKDIR" #TODO: cvsserver doesn't support update w/o -d
@@ -322,7 +322,7 @@ test_expect_success 'cvs update (subdire (for dir in A A/B A/B/C A/D E; do filename="file_in_$(echo $dir|sed -e "s#/# #g")" && if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" && - diff -q "$dir/$filename" "../$dir/$filename"; then + test_cmp "$dir/$filename" "../$dir/$filename" >/dev/null; then : else echo >failure
@@ -349,7 +349,7 @@ test_expect_success 'cvs update (re-add cd cvswork && GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" && - diff -q testfile1 ../testfile1' + test_cmp testfile1 ../testfile1' >/dev/null cd "$WORKDIR" test_expect_success 'cvs update (merge)' \
@@ -366,7 +366,7 @@ test_expect_success 'cvs update (merge)' cd cvswork && GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" && - diff -q merge ../merge && + test_cmp merge ../merge >/dev/null && ( echo Line 0; cat merge ) >merge.tmp && mv merge.tmp merge && cd "$WORKDIR" &&
@@ -377,7 +377,7 @@ test_expect_success 'cvs update (merge)' cd cvswork && sleep 1 && touch merge && GIT_CONFIG="$git_config" cvs -Q update && - diff -q merge ../expected' + test_cmp merge ../expected' >/dev/null cd "$WORKDIR"
@@ -402,13 +402,13 @@ test_expect_success 'cvs update (conflic git push gitcvs.git >/dev/null && cd cvswork && GIT_CONFIG="$git_config" cvs -Q update && - diff -q merge ../expected.C' + test_cmp merge ../expected.C' >/dev/null cd "$WORKDIR" test_expect_success 'cvs update (-C)' \ 'cd cvswork && GIT_CONFIG="$git_config" cvs -Q update -C && - diff -q merge ../merge' + test_cmp merge ../merge' >/dev/null cd "$WORKDIR" test_expect_success 'cvs update (merge no-op)' \
@@ -420,7 +420,7 @@ test_expect_success 'cvs update (merge n cd cvswork && sleep 1 && touch merge && GIT_CONFIG="$git_config" cvs -Q update && - diff -q merge ../merge' + test_cmp merge ../merge' >/dev/null cd "$WORKDIR" test_expect_success 'cvs update (-p)' '
t/t3903-stash.sh +1 -1
@@ -81,7 +81,7 @@ test_expect_success 'drop top stash' ' git stash && git stash drop && git stash list > stashlist2 && - diff stashlist1 stashlist2 && + test_cmp stashlist1 stashlist2 && git stash apply && test 3 = $(cat file) && test 1 = $(git show :file) &&
t/t4127-apply-same-fn.sh +3 -3
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename cp same_fn same_fn2 && git reset --hard && git apply patch0 && - diff same_fn same_fn2 + test_cmp same_fn same_fn2 ' test_expect_success 'apply same filename with overlapping changes' '
@@ -40,7 +40,7 @@ test_expect_success 'apply same filename cp same_fn same_fn2 && git reset --hard && git apply patch0 && - diff same_fn same_fn2 + test_cmp same_fn same_fn2 ' test_expect_success 'apply same new filename after rename' '
@@ -54,7 +54,7 @@ test_expect_success 'apply same new file cp new_fn new_fn2 && git reset --hard && git apply --index patch1 && - diff new_fn new_fn2 + test_cmp new_fn new_fn2 ' test_expect_success 'apply same old filename after rename -- should fail.' '
t/Makefile +1 -0
@@ -6,6 +6,7 @@ -include ../config.mak #GIT_TEST_OPTS=--verbose --debug +GIT_TEST_CMP ?= $(DIFF) SHELL_PATH ?= $(SHELL) TAR ?= $(TAR) RM ?= rm -f
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 05/15] diff-test_cmp.patch
t/t0000-basic.sh $expectfilter >expected <<\EOF · line 283
Quoted 10 lines · Gary V. Vaughan
Index:
b/t/t0000-basic.sh
===================================================================t/t0000-basic.sh +1
-1@@ -280,7 +280,7 @@ $expectfilter >expected <<\EOF EOF test_expect_success \ 'validate git diff-files output for a know cache/work tree state.' \ - 'git diff-files >current && diff >/dev/null -b current expected' + 'git diff-files >current && test_cmp current expected >/dev/null'
The original says "compare ignoring whitespace changes" but the updated one says "they must match literally". Is this conversion safe?
For the purpose of debugging tests, I think it would be better to lose the redirection into /dev/null. If the test passes, we wouldn't see anything anyway, and if the test fails, we would see what's different, and that helps diagnosing the breakage. For systems with implementations of diff that is "-u" challenged, we could define test_cmp in terms of "diff -c" instead of "cmp".
t/t9400-git-cvsserver-server.sh test_expect_success 'gitcvs.ext.enabled · line 229
Quoted 10 lines
Index:
b/t/t9400-git-cvsserver-server.sh
===================================================================t/t9400-git-cvsserver-server.sh +1
-1@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && - diff -q cvswork cvswork2' + test_cmp cvswork cvswork2' >/dev/null
If the -q in the original really matters, then please add the redirection to /dev/null only for test_cmp; never redirect the output from the entire test_expect_success. On the other hand, if -q does not matter the outcome of the test, simply lose the "quiet". We really should not care, and make sure it is available easily to people who broke cvsserver and need to see the difference between expected and actual results while debugging.
There are similar dubious conversions in your patch to this file.
t/Makefile line 9
Quoted 9 lines
Index: b/t/Makefile
===================================================================t/Makefile +1
-0@@ -6,6 +6,7 @@ -include ../config.mak #GIT_TEST_OPTS=--verbose --debug +GIT_TEST_CMP ?= $(DIFF)
If this forces plain diff not more readable "diff -u" to everybody, that sounds like a regression to me.
Other than that, the conversion in this patch looked sane.
Thanks.
Re: [patch 05/15] diff-test_cmp.patch
Hi Junio,
Thanks for the reviews.
Quoted 15 lines · Junio C Hamano
t/t0000-basic.sh $expectfilter >expected <<\EOF · line 283
Quoted 10 lines · Gary V. Vaughan
Index:
b/t/t0000-basic.sh
===================================================================t/t0000-basic.sh +1
-1@@ -280,7 +280,7 @@ $expectfilter >expected <<\EOF EOF test_expect_success \ 'validate git diff-files output for a know cache/work tree state.' \ - 'git diff-files >current && diff >/dev/null -b current expected' + 'git diff-files >current && test_cmp current expected >/dev/null'The original says "compare ignoring whitespace changes" but the updated one says "they must match literally". Is this conversion safe?
Not all diff implementations support the '-b' option, unfortunately.
This change doesn't cause any regressions, at least the test suite continues to report success on the architectures where running it is safe (i.e. Linux and Solaris 8+).
Quoted 6 lines
For the purpose of debugging tests, I think it would be better to lose the redirection into
/dev/null. If the test passes, we wouldn't see anything anyway, and if the test fails, we would see what's different, and that helps diagnosing the breakage. For systems with implementations of diff that is "-u" challenged, we could definetest_cmpin terms of "diff -c" instead of "cmp".
Agreed. For all the hosts I have access to, diff -c is always available.
Quoted 6 lines
Quoted 6 lines
Index:
b/t/t9400-git-cvsserver-server.sh
===================================================================t/t9400-git-cvsserver-server.sh +0
-0@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
Quoted 8 lines
t/t9400-git-cvsserver-server.sh test_expect_success 'gitcvs.ext.enabled · line 229
Quoted 4 lines
t/t9400-git-cvsserver-server.sh +1
-1GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && - diff -q cvswork cvswork2' + test_cmp cvswork cvswork2' >/dev/nullIf the -q in the original really matters, then please add the redirection to
/dev/nullonly fortest_cmp; never redirect the output from the entiretest_expect_success.
Don't worry, I didn't do that:
$ echo 'test_expect_success' &&
Quoted 1 line
echo '
test_cmp' >/dev/null
test_expect_success
Quoted 6 lines
On the other hand, if -q does not matter the outcome
of the test, simply lose the "quiet". We really should not care, and make sure it is available easily to people who broke cvsserver and need to see the difference between expected and actual results while debugging.There are similar dubious conversions in your patch to this file.
I'd be even happier to see the >/dev/null redirections dropped if the patch is pushed. Part of the reason I didn't invest too much effort into debugging the massive testsuite failures everything but Linux and Solaris 8+ is because it's too difficult to find out why a particular test actually failed.
Quoted 7 lines
Quoted 7 lines
Index: b/t/Makefile
===================================================================t/Makefile +0
-0@@ -6,6 +6,7 @@ -include ../config.mak
Quoted 5 lines
t/Makefile line 9
Quoted 2 lines
t/Makefile +1
-0#GIT_TEST_OPTS=--verbose --debug +GIT_TEST_CMP ?= $(DIFF)If this forces plain diff not more readable "diff -u" to everybody, that sounds like a regression to me.
It does, because "diff -u" is not portable.
A more comprehensive patch might run a configure test to see whether -u is supported, and then fallback first to "${ac_cv_prog_DIFF} -c", or if that breaks too, finally settle on "cmp". And then we'd have to set matching defaults in Makefile.
I'm afraid I don't have time to help with that, since the testsuite is so very broken on nearly all of our architectures. I'll post some examples presently.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 6/15 diff-defaults.patch
In reply to Gary V. VaughanBy default the testsuite calls 'diff -u' whenever a file comparison is called for. Unfortunately that throws a "diff: unknown option '-u'" error for most non-GNU diffs.
This patch sets GIT_TEST_CMP to 'cmp' on all the architectures where that happens. As a matter of fact, the testsuite as a whole still fails around 70% of all tests, but I'm able to clone a repository and commit to a local branch on those machines, so I'm pretty sure that the problem is the testsuite itself.
--- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Makefile +15 -0
@@ -767,6 +767,16 @@ ifeq ($(uname_S),SunOS) NO_MKDTEMP = YesPlease NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease + ifeq ($(uname_R),5.6) + NO_IPV6 = YesPlease + NO_SOCKADDR_STORAGE = YesPlease + NO_UNSETENV = YesPlease + NO_SETENV = YesPlease + NO_STRLCPY = YesPlease + NO_C99_FORMAT = YesPlease + NO_STRTOUMAX = YesPlease + GIT_TEST_CMP = cmp + endif ifeq ($(uname_R),5.7) NEEDS_RESOLV = YesPlease NO_IPV6 = YesPlease
@@ -776,18 +786,21 @@ ifeq ($(uname_S),SunOS) NO_STRLCPY = YesPlease NO_C99_FORMAT = YesPlease NO_STRTOUMAX = YesPlease + GIT_TEST_CMP = cmp endif ifeq ($(uname_R),5.8) NO_UNSETENV = YesPlease NO_SETENV = YesPlease NO_C99_FORMAT = YesPlease NO_STRTOUMAX = YesPlease + GIT_TEST_CMP = cmp endif ifeq ($(uname_R),5.9) NO_UNSETENV = YesPlease NO_SETENV = YesPlease NO_C99_FORMAT = YesPlease NO_STRTOUMAX = YesPlease + GIT_TEST_CMP = cmp endif INSTALL = /usr/ucb/install TAR = gtar
@@ -861,6 +874,7 @@ ifeq ($(uname_S),AIX) else PTHREAD_LIBS = -lpthread endif + GIT_TEST_CMP = cmp endif ifeq ($(uname_S),GNU) # GNU/Hurd
@@ -915,6 +929,7 @@ ifeq ($(uname_S),HP-UX) NO_HSTRERROR = YesPlease NO_SYS_SELECT_H = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease + GIT_TEST_CMP = cmp endif ifeq ($(uname_S),Windows) GIT_VERSION := $(GIT_VERSION).MSVC
t/Makefile +1 -0
@@ -3,6 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # +-include ../config.mak.autogen -include ../config.mak #GIT_TEST_OPTS=--verbose --debug
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 06/15] diff-defaults.patch
Quoted 6 lines · Gary V. Vaughan
By default the testsuite calls 'diff -u' whenever a file comparison is called for. Unfortunately that throws a "diff: unknown option '-u'" error for most non-GNU diffs.
This patch sets
GIT_TEST_CMPto 'cmp' on all the architectures where that happens.
Wouldn't most of these platforms you listed have a working "diff -c" at least? Using it would make debugging the tests easier, as it would be more readable than output from "cmp".
I also saw your patch to install-webdoc used "$DIFF -u"; as the patch series seem to assume a unified-capable diff implementation is available somewhere, perhaps you do not need this patch after all, but instead just need to default GIT_TEST_CMP to "$DIFF -u" in t/test-lib.sh, no?
Re: [patch 06/15] diff-defaults.patch
Quoted 6 lines · Junio C Hamano
Quoted 4 lines · Gary V. Vaughan
By default the testsuite calls 'diff -u' whenever a file comparison is called for. Unfortunately that throws a "diff: unknown option '-u'" error for most non-GNU diffs.
Quoted 6 lines
Quoted 2 lines
This patch sets
GIT_TEST_CMPto 'cmp' on all the architectures where that happens.Wouldn't most of these platforms you listed have a working "diff -c" at least? Using it would make debugging the tests easier, as it would be more readable than output from "cmp".
Yes, I've checked, and everything I have access to supports "diff -c" with the vendor implementation.
Quoted 4 lines
I also saw your patch to install-webdoc used "$DIFF -u"; as the patch series seem to assume a unified-capable diff implementation is available somewhere, perhaps you do not need this patch after all, but instead just need to default
GIT_TEST_CMPto "$DIFF -u" int/test-lib.sh, no?
That is more than adequate for me, since one of our packages is GNU diffutils, and my git build recipe puts the path to our diffutils package first in PATH before launching configure and make.
However, anyone else that wants to build git on a non-"diff -u" capable machine won't necessarily have this luxury. At the moment it's hard for me to tell whether the diff changes are a net win, since I can't get the testsuite to run properly on any of the architectures that would be affected.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 7/15 host-IRIX.patch
In reply to Gary V. VaughanIrix 6.5 does not define 'sgi', but does define '__sgi'.
Also, Irix 6.5 requires _BSD_TYPES to be defined in order for the BSD u_short types et. al. to be declared properly.
--- git-compat-util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
git-compat-util.h +2 -1
@@ -55,13 +55,14 @@# else # define _XOPEN_SOURCE 500# endif -#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && !defined(_M_UNIX) && !defined(sgi) +#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() */ #define _XOPEN_SOURCE_EXTENDED 1/* AIX 5.3L needs this */ #endif #define _ALL_SOURCE 1#define _GNU_SOURCE 1#define _BSD_SOURCE 1 +#define _BSD_TYPES 1/* IRIX needs this for u_short et al */ #define _NETBSD_SOURCE 1#define _SGI_SOURCE 1
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 07/15] host-IRIX.patch
Quoted 4 lines · Gary V. Vaughan
Irix 6.5 does not define 'sgi', but does define '
__sgi'.Also, Irix 6.5 requires
_BSD_TYPESto be defined in order for the BSDu_shorttypes et. al. to be declared properly.
If Irix 6.5 defines __sgi and the patch _adds_ "defined(__sgi)" I wouldn't have to worry too much, but would replacing "defined(sgi)" with the double-underscore version make somebody who added "defined(sgi)" in the first place cry, if it was done for different version of Irix that does define "sgi" (worse yet, but not "__sgi")?
Another natural question is if defining _BSD_TYPES everywhere has negative effects on somebody else's platforms, but that is what people on different platforms will have to apply this patch, test, and report success or breakage. Help from the list audience is appreciated.
Thanks.
Re: [patch 07/15] host-IRIX.patch
Quoted 4 lines · Junio C Hamano
Quoted 2 lines · Gary V. Vaughan
Irix 6.5 does not define 'sgi', but does define '
__sgi'.
Quoted 8 lines
Quoted 2 lines
Also, Irix 6.5 requires
_BSD_TYPESto be defined in order for the BSDu_shorttypes et. al. to be declared properly.If Irix 6.5 defines
__sgiand the patch _adds_ "defined(__sgi)" I wouldn't have to worry too much, but would replacing "defined(sgi)" with the double-underscore version make somebody who added "defined(sgi)" in the first place cry, if it was done for different version of Irix that does define "sgi" (worse yet, but not "__sgi")?
Agreed. I've amended my local version of this patch to check both (sgi) and (__sgi) now. Thanks.
Quoted 4 lines
Another natural question is if defining
_BSD_TYPESeverywhere has negative effects on somebody else's platforms, but that is what people on different platforms will have to apply this patch, test, and report success or breakage. Help from the list audience is appreciated.
Good point. Perhaps better to make that change in the Makefile?
ifeq ($(uname_S),IRIX64)
# Need this for u_short definitions et al
BASIC_CFLAGS += -D_BSD_TYPES
endif
I only have use of mips-sgi-irix6.5 machines, so I'm not sure what other versions are affected... probably a safe bet that ifeq($(uname_S),IRIX) should get that definition too.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 07/15] host-IRIX.patch
In reply to Gary V. VaughanQuoted 5 lines · Gary V. Vaughan
Irix 6.5 does not define 'sgi', but does define '
__sgi'.Also, Irix 6.5 requires
_BSD_TYPESto be defined in order for the BSDu_shorttypes et. al. to be declared properly.
Which IRIX release (uname -R) and compiler version are you using?
I have IRIX 6.5.29m and MIPSpro Compiler 7.4.4m.
Both 'sgi' and '__sgi' appear to be predefined by the preprocessor on my system. I wasn't aware of '__sgi' when I added 'sgi', otherwise I would have used it.
On my system, defining _SGI_SOURCE causes _SGIAPI to be enabled which causes all of the BSD types to be enabled. In my header files in /usr/include/ everywhere I see a test for _BSD_TYPES, I also see a test for _SGIAPI (or something equivalent) like this:
#if _SGIAPI || defined(_BSD_TYPES)
So defining _BSD_TYPES will probably not affect compiling on IRIX for me (though I haven't tested your patches yet), but do your header files not do the same thing with _SGI_SOURCE, _SGIAPI, and _BSD_TYPES?
Which shell are you using? Bash? or the native Korn shell? If you're trying to use the Korn shell, then you'll need a patch to t/test-lib.sh in order for the test suite to work properly. I can send it to you if you'd like.
I compile and test with the following config.mak settings:
GIT_SKIP_TESTS := \
t3900.1[129] t3900.2[0234] \
t5100.5 t5100.1[09] \
t8005.[234]
export GIT_SKIP_TESTS
# perl 5.8.0 # python 2.1 # GNU tar 1.2 PERL_PATH = /apps/bin/perl PYTHON_PATH = /apps/bin/python TAR = /sw/local/bin/gtar
CC = c99
CFLAGS = -n32 -O2
NO_C99_FORMAT = 1NO_CURL = 1NO_TCLTK = 1NO_MMAP =NO_OPENSSL = 1BLK_SHA1 = 1DEFAULT_PAGER = more
# For IRIX <= 6.5.20 compatibility (uname -R)
# i.e. the next two are not necessary for IRIX > 6.5.20 NO_STRLCPY = 1 NO_DEFLATE_BOUND = 1
-brandon
Re: [patch 07/15] host-IRIX.patch
[It seems that while the list allows me to start a new thread, all my replies are actually discarded or held for moderation :( Please forward a copy to the list on my behalf]
Quoted 10 lines · Brandon Casey
Quoted 5 lines · Gary V. Vaughan
Irix 6.5 does not define 'sgi', but does define '
__sgi'.Also, Irix 6.5 requires
_BSD_TYPESto be defined in order for the BSDu_shorttypes et. al. to be declared properly.Which IRIX release (uname -R) and compiler version are you using?
I have IRIX 6.5.29m and MIPSpro Compiler 7.4.4m.
IRIX 6.5.26m here, with the same compiler.
Quoted 3 lines
Both 'sgi' and '
__sgi' appear to be predefined by the preprocessor on my system. I wasn't aware of '__sgi' when I added 'sgi', otherwise I would have used it.
I was quite surprised too, but __sgi is necessary here.
Quoted 10 lines
On my system, defining
_SGI_SOURCEcauses_SGIAPIto be enabled which causes all of the BSD types to be enabled. In my header files in/usr/include/everywhere I see a test for_BSD_TYPES, I also see a test for_SGIAPI(or something equivalent) like this:#if _SGIAPI || defined(_BSD_TYPES)So defining
_BSD_TYPESwill probably not affect compiling on IRIX for me (though I haven't tested your patches yet), but do your header files not do the same thing with_SGI_SOURCE,_SGIAPI, and_BSD_TYPES?
They do, but when I was looking for a macro to define to get the additional declarations, _BSD_TYPES was the first one I found. _SGI_SOURCE, _SGIAPI and even _BSD_COMPAT appear to work equally well.
Quoted 4 lines
Which shell are you using? Bash? or the native Korn shell? If you're trying to use the Korn shell, then you'll need a patch to
t/test-lib.shin order for the test suite to work properly. I can send it to you if you'd like.
I believe we're using bash. At least our environment has SHELL=/opt/fsw/bash32/bin/bash and we call configure with '${SHELL} ./configure ...' and gmake with 'make SHELL=${SHELL}'. But I suppose it's possible that if t/Makefile ignores those settings and the tests begin with '#!/bin/sh', then perhaps they are using Korn shell?
Thanks, yes, I'll be interested to see your patch... but shouldn't we try to fix git in the repo so that it respects the SHELL environment and make setting?
Quoted 26 lines
I compile and test with the following config.mak settings:
GIT_SKIP_TESTS := \ t3900.1[129] t3900.2[0234] \ t5100.5 t5100.1[09] \ t8005.[234]export
GIT_SKIP_TESTS# perl 5.8.0 # python 2.1 # GNU tar 1.2 PERL_PATH = /apps/bin/perl PYTHON_PATH = /apps/bin/python TAR = /sw/local/bin/gtarCC = c99
CFLAGS = -n32 -O2
NO_C99_FORMAT= 1NO_CURL= 1NO_TCLTK= 1NO_MMAP=NO_OPENSSL= 1BLK_SHA1= 1DEFAULT_PAGER= more
Quoted 4 lines
# For IRIX <= 6.5.20 compatibility (uname -R)
# i.e. the next two are not necessary for IRIX > 6.5.20 NO_STRLCPY = 1 NO_DEFLATE_BOUND = 1
And similarly, shouldn't these settings be fed back upstream for the benefit of other IRIX users of git?
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 8/15 host-HPUX10.patch
In reply to Gary V. VaughanHP-UX 10.20 has no PREAD, and while it does support mmap(), there is no system MAP_FAILED definition.
--- Makefile | 1 + git-compat-util.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
Makefile +3 -0
@@ -929,6 +929,9 @@ ifeq ($(uname_S),HP-UX) NO_HSTRERROR = YesPlease NO_SYS_SELECT_H = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease + ifeq ($(uname_R),B.10.20) + NO_PREAD = YesPlease + endif GIT_TEST_CMP = cmp endif ifeq ($(uname_S),Windows)
git-compat-util.h +4 -1
@@ -217,7 +217,6 @@ static inline const char *skip_prefix(co#define PROT_READ 1#define PROT_WRITE 2#define MAP_PRIVATE 1 -#define MAP_FAILED ((void*)-1)#endif #define mmap git_mmap
@@ -246,6 +245,10 @@ extern int git_munmap(void *start, size_#endif /* NO_MMAP */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void*)-1) +#endif +#ifdef NO_ST_BLOCKS_IN_STRUCT_STAT #define on_disk_bytes (st) ((st).st_size)#else
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 9/15 host-HPUX11.patch
In reply to Gary V. VaughanThere is no nanosecond field on HPUX.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -928,6 +928,7 @@ ifeq ($(uname_S),HP-UX) NO_UNSETENV = YesPlease NO_HSTRERROR = YesPlease NO_SYS_SELECT_H = YesPlease + NO_NSEC = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease ifeq ($(uname_R),B.10.20) NO_PREAD = YesPlease
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 10/15 host-OSF1.patch
In reply to Gary V. VaughanAdd defaults for Tru64 Unix. Without this patch I cannot compile git on Tru64 5.1.
--- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -695,6 +695,12 @@ EXTLIBS = # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer... +ifeq ($(uname_S),OSF1) + # Need this for u_short definitions et al + BASIC_CFLAGS += -D_OSF_SOURCE + NO_STRTOULL = YesPlease + NO_NSEC = YesPlease +endif ifeq ($(uname_S),Linux) NO_STRLCPY = YesPlease NO_MKSTEMPS = YesPlease
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 11/15 no-hstrerror.patch
In reply to Gary V. VaughanSunOS 5.6 and 5.5.1 do not have hstrerror, even in libresolv.
This patch improves the logic of the test for hstrerror, not to blindly assume that if there is no hstrerror in libc that it must exist in libresolv.
--- Makefile | 1 + config.mak.in | 1 + configure.ac | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-)
configure.ac +14 -3
@@ -526,11 +526,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS - # # 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([c], [hstrerror], +# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there. +AC_CHECK_LIB([c], [inet_ntop], [NEEDS_RESOLV=], [NEEDS_RESOLV=YesPlease]) +# +# Define NO_HSTRERROR if linking with -lresolv is not enough. +# Solaris 2.6 in particular has no hstrerror, even in -lresolv. +NO_HSTRERROR= +AC_CHECK_FUNC([hstrerror], + [], + [AC_CHECK_LIB([resolv], [hstrerror], + [NEEDS_RESOLV=YesPlease], + [NO_HSTRERROR=YesPlease]) +]) +AC_SUBST(NO_HSTRERROR) + AC_SUBST(NEEDS_RESOLV) test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
Makefile +1 -0
@@ -774,6 +774,7 @@ ifeq ($(uname_S),SunOS) NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease ifeq ($(uname_R),5.6) + NO_HSTRERROR = YesPlease NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease NO_UNSETENV = YesPlease
config.mak.in +1 -0
@@ -43,6 +43,7 @@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@ NO_IPV6=@NO_IPV6@ NO_C99_FORMAT=@NO_C99_FORMAT@ +NO_HSTRERROR=@NO_HSTRERROR@ NO_STRCASESTR=@NO_STRCASESTR@ NO_MEMMEM=@NO_MEMMEM@ NO_STRLCPY=@NO_STRLCPY@
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 11/15] no-hstrerror.patch
Quoted 16 lines · Gary V. Vaughan
SunOS 5.6 and 5.5.1 do not have hstrerror, even in libresolv.
This patch improves the logic of the test for hstrerror, not to blindly assume that if there is no hstrerror in libc that it must exist in libresolv.
--- Makefile | 1 + config.mak.in | 1 + configure.ac | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-)Index: b/configure.ac
===================================================================
configure.ac test -n "$NEEDS_SOCKET" && LIBS="$LIBS - · line 529
Quoted 7 lines
configure.ac +1
-3@@ -526,11 +526,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS - # # 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([c], [hstrerror], +# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
You lost the thing they are "additional" to, so this needs a bit of rewording?
Other than that the patch looked sane (I don't have access to any vintage of Solaris these days, so I only read it through, though).
Thanks.
Re: [patch 11/15] no-hstrerror.patch
Quoted 12 lines · Junio C Hamano
configure.ac test -n "$NEEDS_SOCKET" && LIBS="$LIBS - · line 529
Quoted 8 lines · Gary V. Vaughan
configure.ac +1
-3@@ -526,11 +526,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS - # # 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([c], [hstrerror], +# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.You lost the thing they are "additional" to, so this needs a bit of rewording?
I did that to minimise the changes in this patch. no-inet_ntop.patch rewrites the inet_ntop test and deletes the incomplete comment line too.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 12/15 no-inet_ntop.patch
In reply to Gary V. VaughanBeing careful not to overwrite the results of testing for hstrerror in libresolv, also test whether inet_ntop/inet_pton are available from that library.
--- Makefile | 6 ++++++ config.mak.in | 2 ++ configure.ac | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 8 deletions(-)
Makefile +6 -0
@@ -939,6 +939,12 @@ ifeq ($(uname_S),HP-UX) SNPRINTF_RETURNS_BOGUS = YesPlease ifeq ($(uname_R),B.10.20) NO_PREAD = YesPlease + NO_INET_NTOP = YesPlease + NO_INET_PTON = YesPlease + endif + ifeq ($(uname_R),B.11.00) + NO_INET_NTOP = YesPlease + NO_INET_PTON = YesPlease endif GIT_TEST_CMP = cmp endif
configure.ac +30 -8
@@ -525,11 +525,33 @@ 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 7 inet_ntop and inet_pton additionally reside there. -AC_CHECK_LIB([c], [inet_ntop], -[NEEDS_RESOLV=], -[NEEDS_RESOLV=YesPlease]) +# The next few tests will define NEEDS_RESOLV if linking with +# libresolv provides some of the functions we would normally get +# from libc. +NEEDS_RESOLV= +AC_SUBST(NEEDS_RESOLV) +# +# Define NO_INET_NTOP if linking with -lresolv is not enough. +# Solaris 2.7 in particular hos inet_ntop in -lresolv. +NO_INET_NTOP= +AC_SUBST(NO_INET_NTOP) +AC_CHECK_FUNC([inet_ntop], + [], + [AC_CHECK_LIB([resolv], [inet_ntop], + [NEEDS_RESOLV=YesPlease], + [NO_INET_NTOP=YesPlease]) +]) +# +# Define NO_INET_PTON if linking with -lresolv is not enough. +# Solaris 2.7 in particular hos inet_pton in -lresolv. +NO_INET_PTON= +AC_SUBST(NO_INET_PTON) +AC_CHECK_FUNC([inet_pton], + [], + [AC_CHECK_LIB([resolv], [inet_pton], + [NEEDS_RESOLV=YesPlease], + [NO_INET_PTON=YesPlease]) +]) # # Define NO_HSTRERROR if linking with -lresolv is not enough. # Solaris 2.6 in particular has no hstrerror, even in -lresolv.
@@ -541,8 +563,9 @@ AC_CHECK_FUNC([hstrerror], [NO_HSTRERROR=YesPlease]) ]) AC_SUBST(NO_HSTRERROR) - -AC_SUBST(NEEDS_RESOLV) +# +# If any of the above tests determined that -lresolv is needed at +# build-time, also set it here for remaining configure-time checks. test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv" AC_CHECK_LIB([c], [basename],
@@ -772,7 +795,6 @@ GIT_CHECK_FUNC(mkstemps, [NO_MKSTEMPS=YesPlease]) AC_SUBST(NO_MKSTEMPS) # -# # Define NO_MMAP if you want to avoid mmap. # # Define NO_ICONV if your libc does not properly support iconv.
config.mak.in +2 -0
@@ -53,6 +53,8 @@ NO_SETENV=@NO_SETENV@ NO_UNSETENV=@NO_UNSETENV@ NO_MKDTEMP=@NO_MKDTEMP@ NO_MKSTEMPS=@NO_MKSTEMPS@ +NO_INET_NTOP=@NO_INET_NTOP@ +NO_INET_PTON=@NO_INET_PTON@ NO_ICONV=@NO_ICONV@ OLD_ICONV=@OLD_ICONV@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 13/15 no-socklen_t.patch
In reply to Gary V. VaughanSunOS 2.6 and earlier do not have a socklen_t type declaration.
--- Makefile | 4 ++++ aclocal.m4 | 41 +++++++++++++++++++++++++++++++++++++++++ config.mak.in | 1 + configure.ac | 6 ++++++ 4 files changed, 52 insertions(+)
Makefile +4 -0
@@ -1064,6 +1064,10 @@ else BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' endif +ifneq (socklen_t,$(SOCKLEN_T)) + BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) +endif + ifeq ($(uname_S),Darwin) ifndef NO_FINK ifeq ($(shell test -d /sw/lib && echo y),y)
configure.ac +6 -0
@@ -613,6 +613,12 @@ AC_SUBST(OLD_ICONV) ## Checks for typedefs, structures, and compiler characteristics. AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) # +TYPE_SOCKLEN_T +case $ac_cv_type_socklen_t in + yes) AC_SUBST([SOCKLEN_T], [socklen_t]) ;; + *) AC_SUBST([SOCKLEN_T], [$git_cv_socklen_t_equiv]) ;; +esac + # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=],
config.mak.in +1 -0
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@ NO_ICONV=@NO_ICONV@ OLD_ICONV=@OLD_ICONV@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@ +SOCKLEN_T=@SOCKLEN_T@ FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@ NO_PTHREADS=@NO_PTHREADS@
aclocal.m4 new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
Gary V. Vaughan ([email protected])
Re: [patch 13/15] no-socklen_t.patch
Makefile else · line 1069
Quoted 3 lines · Gary V. Vaughan
Makefile +3
-0+ifneq (socklen_t,$(SOCKLEN_T)) + BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) +endif
This looks like making use of configure mandatory to me? Could you do this patch without doing so?
The same comment applies to [15/15].
Thanks.
Re: [patch 13/15] no-socklen_t.patch
Quoted 8 lines · Junio C Hamano
Review
Quoted 3 lines · Gary V. Vaughan
(quoted diff) +3
-0+ifneq (socklen_t,$(SOCKLEN_T)) + BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) +endifThis looks like making use of configure mandatory to me? Could you do this patch without doing so?
Sure.
SunOS 2.6 and earlier, HP-UX 10.20 and OSF1 do not have a socklen_t type declaration.
--- Makefile | 10 ++++++++++ aclocal.m4 | 41 +++++++++++++++++++++++++++++++++++++++++ config.mak.in | 1 + configure.ac | 6 ++++++ 4 files changed, 58 insertions(+)
Makefile +10 -0
@@ -8,6 +8,9 @@ all:: # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend # to PATH if your tools in /usr/bin are broken. # +# Define SOCKLEN_T to a suitable type (such as 'size_t') if your +# system headers do not define a socklen_t type. +# # 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.
@@ -698,6 +701,7 @@ EXTLIBS = ifeq ($(uname_S),OSF1) # Need this for u_short definitions et al BASIC_CFLAGS += -D_OSF_SOURCE + SOCKLEN_T = int NO_STRTOULL = YesPlease NO_NSEC = YesPlease endif
@@ -774,6 +778,7 @@ ifeq ($(uname_S),SunOS) NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease ifeq ($(uname_R),5.6) + SOCKLEN_T = int NO_HSTRERROR = YesPlease NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease
@@ -938,6 +943,7 @@ ifeq ($(uname_S),HP-UX) NO_NSEC = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease ifeq ($(uname_R),B.10.20) + SOCKLEN_T = size_t NO_PREAD = YesPlease NO_INET_NTOP = YesPlease NO_INET_PTON = YesPlease
@@ -1064,6 +1070,10 @@ else BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' endif +ifeq (,$(SOCKLEN_T) + BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) +endif + ifeq ($(uname_S),Darwin) ifndef NO_FINK ifeq ($(shell test -d /sw/lib && echo y),y)
configure.ac +6 -0
@@ -613,6 +613,12 @@ AC_SUBST(OLD_ICONV) ## Checks for typedefs, structures, and compiler characteristics. AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) # +TYPE_SOCKLEN_T +case $ac_cv_type_socklen_t in + yes) ;; + *) AC_SUBST([SOCKLEN_T], [$git_cv_socklen_t_equiv]) ;; +esac + # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=],
config.mak.in +1 -0
@@ -58,6 +58,7 @@ NO_INET_PTON=@NO_INET_PTON@ NO_ICONV=@NO_ICONV@ OLD_ICONV=@OLD_ICONV@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@ +SOCKLEN_T=@SOCKLEN_T@ FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@ NO_PTHREADS=@NO_PTHREADS@
aclocal.m4 new file +41 -0
41 lines not on this page · raw message
Cheeers,
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 14/15 no-ss_family.patch
In reply to Gary V. VaughanSystems that do not provide ss_family in sockaddr_storage do not compile.
This patch adds a configure test, and a new Makefile define along with default settings for HPUX-11.00, Solaris-2.6 and others.
I've also added a configure test to set NO_SOCKADDR_STORAGE appropriately, rather than relying on the default settings in Makefile.
--- Makefile | 15 +++++++++++++++ config.mak.in | 1 + configure.ac | 17 +++++++++++++++++ daemon.c | 31 ++++++++++++++++++++----------- 4 files changed, 53 insertions(+), 11 deletions(-)
daemon.c +20 -11
@@ -591,19 +591,28 @@ static int execute(struct sockaddr *addrstatic int addrcmp (const struct sockaddr_storage *s1,const struct sockaddr_storage *s2) { -if (s1->ss_family != s2->ss_family) -return s1->ss_family - s2->ss_family; -if (s1->ss_family ==AF_INET ) -return memcmp (&((struct sockaddr_in *)s1)->sin_addr, - &((struct sockaddr_in *)s2)->sin_addr, -sizeof (struct in_addr )); +#ifndef NO_SS_FAMILY_IN_SOCKADDR_X +sa_family_t family = s1->ss_family; +sa_family_t family2 = s2->ss_family; +#else +sa_family_t family = ((struct sockaddr *)s1)->sa_family; +sa_family_t family2 = ((struct sockaddr *)s2)->sa_family; +#endif + +if (family != family2) +return family - family2; +if (family ==AF_INET ) +return memcmp (&((struct sockaddr_in *)s1)->sin_addr, + &((struct sockaddr_in *)s2)->sin_addr, +sizeof (struct in_addr ));#ifndef NO_IPV6 -if (s1->ss_family ==AF_INET6 ) -return memcmp (&((struct sockaddr_in6 *)s1)->sin6_addr, - &((struct sockaddr_in6 *)s2)->sin6_addr, -sizeof (struct in6_addr )); +if (family ==AF_INET6 ) +return memcmp (&((struct sockaddr_in6 *)s1)->sin6_addr, + &((struct sockaddr_in6 *)s2)->sin6_addr, +sizeof (struct in6_addr ));#endif -return 0 ; + +return 0 ; }static int max_connections =32 ;
Makefile +15 -0
@@ -122,6 +122,9 @@ all:: # Define NO_SOCKADDR_STORAGE if your platform does not have struct # sockaddr_storage. # +# Define NO_SS_FAMILY_IN_SOCKADDR_X if your platform lacks ss_family +# in sockaddr_storage, sockaddr_in and sockaddr_in6. +# # Define NO_ICONV if your libc does not properly support iconv. # # Define OLD_ICONV if your library has an old iconv(), where the second
@@ -700,6 +703,7 @@ ifeq ($(uname_S),OSF1) BASIC_CFLAGS += -D_OSF_SOURCE NO_STRTOULL = YesPlease NO_NSEC = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease endif ifeq ($(uname_S),Linux) NO_STRLCPY = YesPlease
@@ -777,6 +781,7 @@ ifeq ($(uname_S),SunOS) NO_HSTRERROR = YesPlease NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease NO_UNSETENV = YesPlease NO_SETENV = YesPlease NO_STRLCPY = YesPlease
@@ -788,6 +793,7 @@ ifeq ($(uname_S),SunOS) NEEDS_RESOLV = YesPlease NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease NO_UNSETENV = YesPlease NO_SETENV = YesPlease NO_STRLCPY = YesPlease
@@ -847,6 +853,9 @@ ifeq ($(uname_S),FreeBSD) NO_UINTMAX_T = YesPlease NO_STRTOUMAX = YesPlease endif + ifeq ($(shell expr "$(uname_V).$(uname_R)" : '5\.[012]'),3) + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease + endif endif ifeq ($(uname_S),OpenBSD) NO_STRCASESTR = YesPlease
@@ -895,6 +904,7 @@ ifeq ($(uname_S),IRIX) NO_MEMMEM = YesPlease NO_MKSTEMPS = YesPlease NO_MKDTEMP = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease # When compiled with the MIPSpro 7.4.4m compiler, and without pthreads # (i.e. NO_PTHREADS is set), and _with_ MMAP (i.e. NO_MMAP is not set), # git dies with a segmentation fault when trying to access the first
@@ -941,10 +951,12 @@ ifeq ($(uname_S),HP-UX) NO_PREAD = YesPlease NO_INET_NTOP = YesPlease NO_INET_PTON = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease endif ifeq ($(uname_R),B.11.00) NO_INET_NTOP = YesPlease NO_INET_PTON = YesPlease + NO_SS_FAMILY_IN_SOCKADDR_X = YesPlease endif GIT_TEST_CMP = cmp endif
@@ -1284,6 +1296,9 @@ else BASIC_CFLAGS += -Dsockaddr_storage=sockaddr_in6 endif endif +ifdef NO_SS_FAMILY_IN_SOCKADDR_X + BASIC_CFLAGS += -DNO_SS_FAMILY_IN_SOCKADDR_X +endif ifdef NO_INET_NTOP LIB_OBJS += compat/inet_ntop.o endif
config.mak.in +1 -0
@@ -42,6 +42,7 @@ NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@ NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@ NO_IPV6=@NO_IPV6@ +NO_SS_FAMILY_IN_SOCKADDR_X=@NO_SS_FAMILY_IN_SOCKADDR_X@ NO_C99_FORMAT=@NO_C99_FORMAT@ NO_HSTRERROR=@NO_HSTRERROR@ NO_STRCASESTR=@NO_STRCASESTR@
configure.ac +17 -0
@@ -656,6 +656,23 @@ AC_CHECK_TYPE([struct addrinfo],[ ]) AC_SUBST(NO_IPV6) # +# Define NO_SS_FAMILY_IN_SOCKADDR_X if your platform lacks ss_family +# in struct sockaddr_storage, sockaddr_in6 and sockaddr_in. +save_CPPFLAGS="$CPPFLAGS" +case $NO_SOCKADDR_STORAGE:$NO_IPV6 in +YesPlease:YesPlease) + CPPFLAGS="-Dsockaddr_storage=sockaddr_in${CPPFLAGS+ $CPPFLAGS}" ;; +YesPlease:) + CPPFLAGS="-Dsockaddr_storage=sockaddr_in6${CPPFLAGS+ $CPPFLAGS}" ;; +esac +AC_CHECK_MEMBER(struct sockaddr_storage.ss_family, +[NO_SS_FAMILY_IN_SOCKADDR_X=], +[NO_SS_FAMILY_IN_SOCKADDR_X=YesPlease],[ +#include <sys/types.h> +#include <sys/socket.h> +]) +AC_SUBST(NO_SS_FAMILY_IN_SOCKADDR_X) +# # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) # do not support the 'size specifiers' introduced by C99, namely ll, hh, # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
Signature · 1 line
Gary V. Vaughan ([email protected])
PATCH 15/15 no-inline.patch
In reply to Gary V. VaughanWithout this patch, git does not compile correctly on HPUX 11.11 and earlier.
Compiler support for inline is sometimes buggy, and occasionally missing entirely. This patch adds a test for inline support, and redefines the keyword with the preprocessor if necessary at compile time.
--- Makefile | 4 ++++ config.mak.in | 1 + configure.ac | 7 +++++++ 3 files changed, 12 insertions(+)
Makefile +4 -0
@@ -1076,6 +1076,10 @@ else BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' endif +ifneq (inline,$(INLINE)) + BASIC_CFLAGS += -Dinline=$(INLINE) +endif + ifneq (socklen_t,$(SOCKLEN_T)) BASIC_CFLAGS += -Dsocklen_t=$(SOCKLEN_T) endif
configure.ac +7 -0
@@ -307,6 +307,13 @@ GIT_PARSE_WITH(tcltk)) AC_MSG_NOTICE([CHECKS for programs]) # AC_PROG_CC([cc gcc]) +AC_C_INLINE +case $ac_cv_c_inline in + no) AC_SUBST([INLINE], []) ;; + inline | yes) AC_SUBST([INLINE], [inline]) ;; + *) AC_SUBST([INLINE], [$ac_cv_c_inline]) ;; +esac + # which switch to pass runtime path to dynamic libraries to the linker AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [ SAVE_LDFLAGS="${LDFLAGS}"
config.mak.in +1 -0
@@ -59,6 +59,7 @@ NO_INET_PTON=@NO_INET_PTON@ NO_ICONV=@NO_ICONV@ OLD_ICONV=@OLD_ICONV@ NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@ +INLINE=@INLINE@ SOCKLEN_T=@SOCKLEN_T@ FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@ SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@
Signature · 1 line
Gary V. Vaughan ([email protected])
Quoted 7 lines · Gary V. Vaughan
Here are the portability patches we needed at TWW to enable git-1.7.0.2 to compile and run on all of the wide range of Unix machines we support. These patches apply to the git-1.7.0.2 release, and address all of the feedback from the previous two times I posted them to this list, most particularly splitting everything into many small self-contained chunks.
Quoted 8 lines
Note that I have not invested the time to figure out why the testsuite is mostly useless on everything but Linux and Solaris 8+, because I'm reasonably satisfied that the build itself is working properly. Most likely, it is merely GNUisms in the way the test cases call external tools. But maybe I'm missing something, but even the 3 new patches to address test errors when diff does not support the -u option don't improve the testsuite situation on HPUX, AIX, OSF1 and Solaris 7 and older.
Which shell are you using? If you're trying to use Korn or /usr/xpg4/bin/sh on Solaris, you'll have problems, but it is possible. I can send you a patch.
I have 3 patches that I apply on top of master which allows me to compile and test on Solaris 7. I remove all but the first when installing, since it is necessary to compile and the others are only necessary for the test suite.
1) Remove const declaration from arrays with non-constant initializers
2) t5100/*.mbox: use '646' rather than 'us-ascii' for Solaris
3) t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE
Here's the config.mak file I use:
GIT_SKIP_TESTS := \
t1304.3 \
t3900.2[23] \
t5000.1[5-79] t5000.2[013-6] t5000.41 \
t6030.1[23] \
t8005.[23]
GIT_TEST_CMP = cmp -s
export GIT_SKIP_TESTS GIT_TEST_CMP
SHELL_PATH = /usr/xpg4/bin/sh
# This is an old GNU tar that's why some of the
# tests in t5000? still fail TAR = /apps/bin/gtar
CC = /opt/SUNWspro/bin/cc
# zlib is installed in /apps CFLAGS = -fast -native -I/apps/include LDFLAGS = -L/apps/lib
NO_CURL = 1NO_TCLTK = 1NO_OPENSSL = 1BLK_SHA1 = 1NO_PYTHON = 1DEFAULT_PAGER = more
-brandon
Heya,
Quoted 3 lines · Gary V. Vaughan
Here are the portability patches we needed at TWW to enable git-1.7.0.2 to compile and run on all of the wide range of Unix machines we support.
Oh wow, thanks! Glad to see you followed up on this, awesome!
Quoted 3 lines
Note that I have not invested the time to figure out why the testsuite is mostly useless on everything but Linux and Solaris 8+, because I'm reasonably satisfied that the build itself is working properly.
I'm curious now, what kind of errors are you getting? Would you mind perhaps posting a few to the list in a new thread?
Signature · 3 lines
Cheers, Sverre Rabbelier