Makefile: update the default build options for AIX
PATCH 1/1 Makefile: update the default build options for AIX
NO_MKDTEMP is required to build, FREAD_READS_DIRECTORIES and the definition of _LARGE_FILES fix test suite failures and INTERNAL_QSORT is required for adequate performance.
Tested on AIX v5.3 Maintenance Level 06
--- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
Makefile +4 -0
@@ -632,8 +632,12 @@ endif ifeq ($(uname_S),AIX) NO_STRCASESTR=YesPlease NO_MEMMEM = YesPlease + NO_MKDTEMP = YesPlease NO_STRLCPY = YesPlease + FREAD_READS_DIRECTORIES = UnfortunatelyYes + INTERNAL_QSORT = UnfortunatelyYes NEEDS_LIBICONV=YesPlease + BASIC_CFLAGS += -D_LARGE_FILES endif ifeq ($(uname_S),GNU) # GNU/Hurd
Signature · 1 line
1.5.5.1.dirty
Quoted 18 lines · Mike Ralphson
NO_MKDTEMPis required to build,FREAD_READS_DIRECTORIESand the definition of_LARGE_FILESfix test suite failures andINTERNAL_QSORTis required for adequate performance.Tested on AIX v5.3 Maintenance Level 06
Signed-off-by Mike Ralphson <[email protected]>--- Makefile | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)Makefile +0
-0@@ -632,8 +632,12 @@ endif ifeq ($(uname_S),AIX) NO_STRCASESTR=YesPlease
Makefile endif · line 643
Quoted 10 lines
Makefile +4
-0NO_MEMMEM = YesPlease + NO_MKDTEMP = YesPlease NO_STRLCPY = YesPlease + FREAD_READS_DIRECTORIES = UnfortunatelyYes + INTERNAL_QSORT = UnfortunatelyYes NEEDS_LIBICONV=YesPlease + BASIC_CFLAGS += -D_LARGE_FILES endif ifeq ($(uname_S),GNU) # GNU/Hurd
I'm trying this patch on AIX 4.3.3 (sigh!) with gcc3. I get this:
git-compat-util.h:209:1: warning: "fopen" redefined In file included from git-compat-util.h:51,
from builtin.h:4,
from git.c:1:/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.2.1/include/stdio.h:110:1:
warning: this is the location of the previous definition
Line 110 in ...include/stdio.h is inside a #ifdef _LARGE_FILES section and says:
#define fopen fopen64
Did you also get this warning? Is _LARGE_FILES support solved in a different way on 5.3?
-- Hannes
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 10 lines
I'm trying this patch on AIX 4.3.3 (sigh!) with gcc3. I get this:
git-compat-util.h:209:1: warning: "fopen" redefined In file included from git-compat-util.h:51,
from builtin.h:4, from git.c:1:
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.2.1/include/stdio.h:110:1:
warning: this is the location of the previous definition
Quoted 7 lines
Line 110 in
...include/stdio.his inside a #ifdef_LARGE_FILESsection and says:#define fopen fopen64
Did you also get this warning? Is
_LARGE_FILESsupport solved in a different way on 5.3?
The warning (I get rather a lot of them) is caused by the compat/fopen.c included when FREAD_READS_DIRECTORIES is defined. I tried moving the #undef fopen to git-compat-util.h but that resulted in a broken build and me reaching the end of my limited ability with c.
In file included from cache.h:4,
from daemon.c:1:
git-compat-util.h:209:1: warning: "fopen" redefined In file included from git-compat-util.h:51,
from cache.h:4,
from daemon.c:1:/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/include/stdio.h:110:1:
warning: this is the location of the previous definition
The warnings are harmless, though untidy.
I don't believe it's anything to do with _LARGE_FILES. Could you try building first with one commented out, then the other? I don't think I have access to a 4.3.3 box any more.
Mike
Quoted 24 lines · Mike Ralphson
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 9 lines
I'm trying this patch on AIX 4.3.3 (sigh!) with gcc3. I get this:
git-compat-util.h:209:1: warning: "fopen" redefined In file included from git-compat-util.h:51,
from builtin.h:4, from git.c:1:
/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.2.1/include/stdio.h:110:1:
warning: this is the location of the previous definitionQuoted 7 lines
Line 110 in
...include/stdio.his inside a #ifdef_LARGE_FILESsection and says:#define fopen fopen64
Did you also get this warning? Is
_LARGE_FILESsupport solved in a different way on 5.3?The warning (I get rather a lot of them) is caused by the
compat/fopen.cincluded whenFREAD_READS_DIRECTORIESis defined. I tried moving the #undef fopen togit-compat-util.hbut that resulted in a broken build and me reaching the end of my limited ability with c.
Quoted 8 lines
In file included from cache.h:4,
from daemon.c:1:
git-compat-util.h:209:1: warning: "fopen" redefined In file included from git-compat-util.h:51,from cache.h:4, from daemon.c:1:
/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.3.0.0/3.3.2/include/stdio.h:110:1:
warning: this is the location of the previous definition
So you we in the same boat.
Quoted 4 lines
The warnings are harmless, though untidy.
I don't believe it's anything to do with_LARGE_FILES. Could you try building first with one commented out, then the other? I don't think I have access to a 4.3.3 box any more.
Untidy, yes; harmless: not necessarily. It has a lot to do with _LARGE_FILES.
The #define fopen in git-compat-util.h essentially defeats the effect of _LARGE_FILES as far as fopen() calls are concerned: If FREAD_READS_DIRECTORIES is not defined, fopen() would be redirected to fopen64(), but when it is defined, it is redirected to git_fopen(), which in turn uses fopen() instead of fopen64() (due to the #undef in compat/fopen.c).
This might be dangerous if some other function of the f*64() family uses the FILE* that the fopen() call returned. I don't know if there is such a usage pattern somewhere in git.
Why did you need _LARGE_FILES in the first place?
-- Hannes
Quoted 7 lines · Johannes Sixt
The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).
How about something like this?
compat/fopen.c +1 -1
@@ -1,5 +1,5 @@ +#undef FREAD_READS_DIRECTORIES#include "../git-compat-util.h" -#undef fopenFILE *git_fopen (const char *path,const char *mode) {FILE *fp;
-brandon
2008/5/7 Brandon Casey <[email protected]>:
Quoted 20 lines
Quoted 7 lines · Johannes Sixt
The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).How about something like this?
diff --git
a/compat/fopen.cb/compat/fopen.cindex ccb9e89..70b0d4d 100644
---a/compat/fopen.c
+++b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undefFREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode)
Quoted 6 lines
{ FILE *fp;-brandon
Ta. I still get all the warnings with that, was that what you were trying to solve? The 64 bit specific tests in t5302 do still pass.
Mike
Quoted 16 lines · Mike Ralphson
2008/5/7 Brandon Casey <[email protected]>:
Quoted 15 lines
How about something like this?
diff --git
a/compat/fopen.cb/compat/fopen.cindex ccb9e89..70b0d4d 100644
---a/compat/fopen.c
+++b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undefFREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode){ FILE *fp;
Quoted 5 lines
Quoted 2 lines
-brandon
Ta. I still get all the warnings with that, was that what you were trying to solve? The 64 bit specific tests in t5302 do still pass.
You should get one less warning (the one from compat/fopen.c), but this time they *are* harmless. ;)
-- Hannes
Quoted 25 lines · Mike Ralphson
2008/5/7 Brandon Casey <[email protected]>:
Quoted 24 lines
Quoted 7 lines · Johannes Sixt
The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).How about something like this?
diff --git
a/compat/fopen.cb/compat/fopen.cindex ccb9e89..70b0d4d 100644
---a/compat/fopen.c
+++b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undefFREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode){ FILE *fp;
Quoted 5 lines
Quoted 2 lines
-brandon
Ta. I still get all the warnings with that, was that what you were trying to solve? The 64 bit specific tests in t5302 do still pass.
Ah, yes. You would still get the warnings for every other file that includes git-compat-util.h, except compat/fopen.c. I didn't think about all of those. :) In this case those are indeed harmless. And now the git provided git_fopen() will use the compiler selected fopen() which should avoid any of the gotchas that Hannes brought up.
-brandon
Quoted 29 lines · Brandon Casey
Quoted 28 lines · Mike Ralphson
2008/5/7 Brandon Casey <[email protected]>:
Quoted 26 lines
Quoted 7 lines · Johannes Sixt
The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).How about something like this?
diff --git
a/compat/fopen.cb/compat/fopen.cindex ccb9e89..70b0d4d 100644
---a/compat/fopen.c
+++b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undefFREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode){ FILE *fp;-brandon
Quoted 8 lines
Quoted 2 lines
Ta. I still get all the warnings with that, was that what you were trying to solve? The 64 bit specific tests in t5302 do still pass.
Ah, yes. You would still get the warnings for every other file that includes
git-compat-util.h, exceptcompat/fopen.c. I didn't think about all of those. :) In this case those are indeed harmless. And now the git providedgit_fopen()will use the compiler selectedfopen()which should avoid any of the gotchas that Hannes brought up.
In any case, that #undef then #include dance needs a big comment on why it has to be so.
2008/5/7 Junio C Hamano <[email protected]>:
Quoted 35 lines
Quoted 32 lines · Brandon Casey
Quoted 30 lines · Mike Ralphson
2008/5/7 Brandon Casey <[email protected]>:
Quoted 20 lines
Quoted 7 lines · Johannes Sixt
The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).How about something like this?
diff --git
a/compat/fopen.cb/compat/fopen.cindex ccb9e89..70b0d4d 100644
---a/compat/fopen.c
+++b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undefFREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode)Quoted 6 lines
{ FILE *fp;-brandon
Ta. I still get all the warnings with that, was that what you were trying to solve? The 64 bit specific tests in t5302 do still pass.
Quoted 9 lines
Quoted 5 lines
Ah, yes. You would still get the warnings for every other file that includes
git-compat-util.h, exceptcompat/fopen.c. I didn't think about all of those. :) In this case those are indeed harmless. And now the git providedgit_fopen()will use the compiler selectedfopen()which should avoid any of the gotchas that Hannes brought up.In any case, that #undef then #include dance needs a big comment on why it has to be so.
Indeed. Please add ascii-art diagrams and don't use long words. I may then have a chance of understanding how this works, and how I should have spotted 5 potentially non-harmless warnings among 400 noise ones, when all I did was get the testsuite from non-passing to passing! 8-)
In reality, thanks to all for pitching in.
Mike
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 19 lines
Quoted 1 line · Mike Ralphson
2008/5/7 Johannes Sixt <[email protected]>:
So you we in the same boat.
Quoted 4 lines
The warnings are harmless, though untidy.
I don't believe it's anything to do with_LARGE_FILES. Could you try building first with one commented out, then the other? I don't think I have access to a 4.3.3 box any more.Untidy, yes; harmless: not necessarily. It has a lot to do with
_LARGE_FILES.The #define fopen in
git-compat-util.hessentially defeats the effect of_LARGE_FILESas far asfopen()calls are concerned: IfFREAD_READS_DIRECTORIESis not defined,fopen()would be redirected tofopen64(), but when it is defined, it is redirected togit_fopen(), which in turn usesfopen()instead offopen64()(due to the #undef incompat/fopen.c).
Quoted 5 lines
This might be dangerous if some other function of the f*64() family uses the FILE* that the
fopen()call returned. I don't know if there is such a usage pattern somewhere in git.Why did you need
_LARGE_FILESin the first place?
Welcome aboard!
I was seeing test failures in t5302-pack-index.sh
Specifically tests 9 and 20
# 9: index v2: force some 64-bit offsets with pack-objects
# 20: create a stealth corruption in a delta base reference
These tests seem to be skipped these days if off_t isn't large enough, I preferred the passing tests to the skipped ones. Maybe it isn't an issue in the real world.
Mike
2008/5/7 Mike Ralphson <[email protected]>:
Quoted 8 lines
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 3 lines
Did you also get this warning? Is
_LARGE_FILESsupport solved in a different way on 5.3?I don't believe it's anything to do with
_LARGE_FILES. Could you try building first with one commented out, then the other? I don't think I have access to a 4.3.3 box any more.
I'm full of it (and I didn't try my own suggestion). It does appear to be related to defining _LARGE_FILES.
I'm afraid I can't see how the current #undef is working, let alone suggest how to fix it when fopen is already redefined. 8-(
Mike
Quoted 2 lines · Mike Ralphson
Indeed. Please add ascii-art diagrams and don't use long words. I may then have a chance of understanding how this works,
I think this is simpler than you are making it out to be.
All the git source files currently #include git-compat-util.h. When a platform is missing a function, we implement that function in the compat/ subdirectory and add an entry for it in git-compat-util.h.
In this case we found a problem that could be worked around by replacing every call to fopen with an internal function. So we did the standard thing of creating a new function in the compat/ subdirectory named git_fopen() and added macro statements within git-compat-util.h to redefine fopen to be git_fopen. But, git_fopen needs to call the _real_ fopen and it _also_ includes git-compat-util.h. So, after including git-compat-util.h, we undefined the fopen macro to undo the assignment that we had just performed. This doesn't work if the system is also setting an fopen macro. So the fix is to avoid clobbering the system setting at all when compiling compat/fopen.c
-brandon
PATCH 1/1 compat/fopen.c: avoid clobbering the system defined fopen macro
In reply to Junio C HamanoSome systems define fopen as a macro based on compiler settings. The previous technique for reverting to the system fopen function by merely undefining fopen is inadequate in this case. Instead, avoid defining fopen entirely when compiling this source file.
--- compat/fopen.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
compat/fopen.c +12 -1
@@ -1,5 +1,16 @@ +/* +* The order of the following two lines is important. +* +* FREAD_READS_DIRECTORIES is undefined before including git-compat-util.h +* to avoid the redefinition of fopen within git-compat-util.h. This is +* necessary since fopen is a macro on some platforms which may be set +* based on compiler options. For example, on AIX fopen is set to fopen64 +* when _LARGE_FILES is defined. The previous technique of merely undefining +* fopen after including git-compat-util.h is inadequate in this case. +*/ +#undef FREAD_READS_DIRECTORIES#include "../git-compat-util.h" -#undef fopen +FILE *git_fopen (const char *path,const char *mode) {FILE *fp;
Signature · 1 line
1.5.5
Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008/5/7 Brandon Casey <[email protected]>:
Quoted 8 lines
Some systems define fopen as a macro based on compiler settings. The previous technique for reverting to the system fopen function by merely undefining fopen is inadequate in this case. Instead, avoid defining fopen entirely when compiling this source file.
Signed-off-by Brandon Casey <[email protected]>
Both with and without -D_LARGE_FILES. Many thanks.
H.Merijn, is this change also ok for your HP-UX?
I guess there may still be a case for not defining _LARGE_FILES by default on AIX as all the warnings may be off-putting or mask other issues. Maybe instead having a comment for those who need large pack-file support? Will submit amended Makefile patch if there's interest.
Mike
Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
Quoted 7 lines · Mike Ralphson
2008/5/7 Brandon Casey <[email protected]>:
Quoted 6 lines
Some systems define fopen as a macro based on compiler settings. The previous technique for reverting to the system fopen function by merely undefining fopen is inadequate in this case. Instead, avoid defining fopen entirely when compiling this source file.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Brandon Casey <[email protected]>Tested-by Mike Ralphson <[email protected]>Both with and without -D_LARGE_FILES. Many thanks.
H.Merijn, is this change also ok for your HP-UX?
I'm not really actively following the ML anymore, as it is kinda busy :) I was able to compile/test/install 1.5.5.1 on HP-UX 11.00/32 and on HP-UX 11.23-ilp64 with a reasonable small set of additional changes.
Main thing I found to make most tests that used to fail now pass is to use bash, instead of HP's native POSIX shell.
http://www.xs4all.nl/~procura/git-1.5.5.1-11.00.diff
http://www.xs4all.nl/~procura/git-1.5.5.1-11.23.diff
We - as a company - now actively use git on HP-UX 11.00 and Linux
Quoted 3 lines
I guess there may still be a case for not defining
_LARGE_FILESby default on AIX as all the warnings may be off-putting or mask other issues.
I also have AIX, but I hate it, and don't really care about it. It's just that we have some poor customers whose IT people forced this OS upon them.
Quoted 2 lines
Maybe instead having a comment for those who need large pack-file support? Will submit amended
Makefilepatch if there's interest.
Signature · 5 lines
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
In reply to Mike RalphsonQuoted 5 lines · Mike Ralphson
I guess there may still be a case for not defining
_LARGE_FILESby default on AIX as all the warnings may be off-putting or mask other issues. Maybe instead having a comment for those who need large pack-file support? Will submit amendedMakefilepatch if there's interest.
Since with this patch we are treating fopen specially anyway, we could go one step further and do this, too:
---
git-compat-util.h +3 -0
@@ -230,6 +230,9 @@ void *gitmemmem(const void *haystack,#endif #ifdef FREAD_READS_DIRECTORIES +#ifdef fopen +#undef fopen +#endif #define fopen (a,b) git_fopen(a,b)extern FILE *git_fopen (const char *,const char *);#endif
Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008/5/8 Johannes Sixt <[email protected]>:
Quoted 16 lines
Quoted 5 lines · Mike Ralphson
I guess there may still be a case for not defining
_LARGE_FILESby default on AIX as all the warnings may be off-putting or mask other issues. Maybe instead having a comment for those who need large pack-file support? Will submit amendedMakefilepatch if there's interest.Since with this patch we are treating fopen specially anyway, we could go one step further and do this, too:
---git-compat-util.h +0
-0
git-compat-util.h void *gitmemmem(const void *haystack, · line 238
Quoted 9 lines
git-compat-util.h +3
-0@@ -230,6 +230,9 @@ void *gitmemmem(const void *haystack,#endif #ifdef FREAD_READS_DIRECTORIES +#ifdef fopen +#undef fopen +#endif #define fopen (a,b) git_fopen(a,b)extern FILE *git_fopen (const char *,const char *);#endif
Loving your work! Squashes all the related warnings, re-tested etc. Technically, is the #ifdef / #endif actually required? Or is #undef'ing an undefined macro not portable? I agree it aids clarity for no cost.
Mike
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 6 lines
Quoted 3 lines · Mike Ralphson
NO_MKDTEMPis required to build,FREAD_READS_DIRECTORIESand the definition of_LARGE_FILESfix test suite failures andINTERNAL_QSORTis required for adequate performance.I'm trying this patch on AIX 4.3.3 (sigh!) with gcc3...
Now the interaction between FREAD_READS_DIRECTORIES and _LARGE_FILES has been sorted out, and thewt-status.h warning fix is also in, did you manage to finish testing this? The INTERNAL_QSORT gave me a 2 orders of magnitude speed up on git status / commit etc.
I should have mentioned that I build with SHELL_PATH = /bin/bash and ensure that /usr/linux/bin (or /opt/freeware/bin) from the AIX toolbox is prepended to the PATH to run the test-suite. I didn't want to fold these into the patch as the paths are somewhat environment specific.
Mike
Johannes Sixt
Tested-byQuoted 13 lines · Mike Ralphson
2008/5/7 Johannes Sixt <[email protected]>:
Quoted 5 lines
Quoted 3 lines · Mike Ralphson
NO_MKDTEMPis required to build,FREAD_READS_DIRECTORIESand the definition of_LARGE_FILESfix test suite failures andINTERNAL_QSORTis required for adequate performance.I'm trying this patch on AIX 4.3.3 (sigh!) with gcc3...
Now the interaction between
FREAD_READS_DIRECTORIESand_LARGE_FILEShas been sorted out, and thewt-status.hwarning fix is also in, did you manage to finish testing this? TheINTERNAL_QSORTgave me a 2 orders of magnitude speed up on git status / commit etc.
Quoted 4 lines
I should have mentioned that I build with
SHELL_PATH=/bin/bashand ensure that/usr/linux/bin(or/opt/freeware/bin) from the AIX toolbox is prepended to the PATH to run the test-suite. I didn't want to fold these into the patch as the paths are somewhat environment specific.
I compiled git on AIX 4.3.3. Even though the testsuite does not pass (due to a too old perl, non-working libiconv, and a sed that does not print the last line if there's no LF at the end), there's no failure that I would attribute to your changes. Therefore, I'd say:
-- Hannes