* [PATCH] Makefile: update the default build options for AIX
@ 2008-05-07 8:35 Mike Ralphson
2008-05-07 11:57 ` Johannes Sixt
0 siblings, 1 reply; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 8:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, mike.ralphson, Mike Ralphson
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
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
---
Makefile | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 7c70b00..4296656 100644
--- a/Makefile
+++ b/Makefile
@@ -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
--
1.5.5.1.dirty
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 8:35 [PATCH] Makefile: update the default build options for AIX Mike Ralphson
@ 2008-05-07 11:57 ` Johannes Sixt
2008-05-07 12:51 ` Mike Ralphson
2008-05-16 10:19 ` [PATCH] Makefile: update the default build options for AIX Mike Ralphson
0 siblings, 2 replies; 20+ messages in thread
From: Johannes Sixt @ 2008-05-07 11:57 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Junio C Hamano, git, mike.ralphson
Mike Ralphson schrieb:
> 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
>
> Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
> ---
> Makefile | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 7c70b00..4296656 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 11:57 ` Johannes Sixt
@ 2008-05-07 12:51 ` Mike Ralphson
2008-05-07 13:05 ` Mike Ralphson
2008-05-07 13:14 ` Johannes Sixt
2008-05-16 10:19 ` [PATCH] Makefile: update the default build options for AIX Mike Ralphson
1 sibling, 2 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 12:51 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, git, Brandon Casey
2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
>
> 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?
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 12:51 ` Mike Ralphson
@ 2008-05-07 13:05 ` Mike Ralphson
2008-05-07 13:14 ` Johannes Sixt
1 sibling, 0 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 13:05 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, git, Brandon Casey
2008/5/7 Mike Ralphson <mike.ralphson@gmail.com>:
> 2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
> >
> > Did you also get this warning? Is _LARGE_FILES support 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 12:51 ` Mike Ralphson
2008-05-07 13:05 ` Mike Ralphson
@ 2008-05-07 13:14 ` Johannes Sixt
2008-05-07 14:20 ` Mike Ralphson
2008-05-07 14:38 ` Brandon Casey
1 sibling, 2 replies; 20+ messages in thread
From: Johannes Sixt @ 2008-05-07 13:14 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Junio C Hamano, git, Brandon Casey
Mike Ralphson schrieb:
> 2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
>> 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?
>
> 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
So you we in the same boat.
> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 13:14 ` Johannes Sixt
@ 2008-05-07 14:20 ` Mike Ralphson
2008-05-07 14:38 ` Brandon Casey
1 sibling, 0 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 14:20 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, git, Brandon Casey
2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
> Mike Ralphson schrieb:
>
> > 2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
> So you we in the same boat.
>
> > 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?
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 13:14 ` Johannes Sixt
2008-05-07 14:20 ` Mike Ralphson
@ 2008-05-07 14:38 ` Brandon Casey
2008-05-07 15:15 ` Mike Ralphson
1 sibling, 1 reply; 20+ messages in thread
From: Brandon Casey @ 2008-05-07 14:38 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Mike Ralphson, Junio C Hamano, git
Johannes Sixt wrote:
> 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).
>
How about something like this?
diff --git a/compat/fopen.c b/compat/fopen.c
index ccb9e89..70b0d4d 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -1,5 +1,5 @@
+#undef FREAD_READS_DIRECTORIES
#include "../git-compat-util.h"
-#undef fopen
FILE *git_fopen(const char *path, const char *mode)
{
FILE *fp;
-brandon
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 14:38 ` Brandon Casey
@ 2008-05-07 15:15 ` Mike Ralphson
2008-05-07 15:39 ` Johannes Sixt
2008-05-07 15:40 ` Brandon Casey
0 siblings, 2 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 15:15 UTC (permalink / raw)
To: Brandon Casey; +Cc: Johannes Sixt, Junio C Hamano, git
2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
> Johannes Sixt wrote:
> > 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).
> >
>
> How about something like this?
>
> diff --git a/compat/fopen.c b/compat/fopen.c
> index ccb9e89..70b0d4d 100644
> --- a/compat/fopen.c
> +++ b/compat/fopen.c
> @@ -1,5 +1,5 @@
> +#undef FREAD_READS_DIRECTORIES
> #include "../git-compat-util.h"
> -#undef fopen
> FILE *git_fopen(const char *path, const char *mode)
> {
> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 15:15 ` Mike Ralphson
@ 2008-05-07 15:39 ` Johannes Sixt
2008-05-07 15:40 ` Brandon Casey
1 sibling, 0 replies; 20+ messages in thread
From: Johannes Sixt @ 2008-05-07 15:39 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Brandon Casey, Junio C Hamano, git
Mike Ralphson schrieb:
> 2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
>> How about something like this?
>>
>> diff --git a/compat/fopen.c b/compat/fopen.c
>> index ccb9e89..70b0d4d 100644
>> --- a/compat/fopen.c
>> +++ b/compat/fopen.c
>> @@ -1,5 +1,5 @@
>> +#undef FREAD_READS_DIRECTORIES
>> #include "../git-compat-util.h"
>> -#undef fopen
>> FILE *git_fopen(const char *path, const char *mode)
>> {
>> 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.
You should get one less warning (the one from compat/fopen.c), but this
time they *are* harmless. ;)
-- Hannes
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 15:15 ` Mike Ralphson
2008-05-07 15:39 ` Johannes Sixt
@ 2008-05-07 15:40 ` Brandon Casey
2008-05-07 16:04 ` Junio C Hamano
1 sibling, 1 reply; 20+ messages in thread
From: Brandon Casey @ 2008-05-07 15:40 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Johannes Sixt, Junio C Hamano, git
Mike Ralphson wrote:
> 2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
>> Johannes Sixt wrote:
>> > 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).
>> >
>>
>> How about something like this?
>>
>> diff --git a/compat/fopen.c b/compat/fopen.c
>> index ccb9e89..70b0d4d 100644
>> --- a/compat/fopen.c
>> +++ b/compat/fopen.c
>> @@ -1,5 +1,5 @@
>> +#undef FREAD_READS_DIRECTORIES
>> #include "../git-compat-util.h"
>> -#undef fopen
>> FILE *git_fopen(const char *path, const char *mode)
>> {
>> 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.
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 15:40 ` Brandon Casey
@ 2008-05-07 16:04 ` Junio C Hamano
2008-05-07 16:20 ` Mike Ralphson
2008-05-07 17:34 ` [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro Brandon Casey
0 siblings, 2 replies; 20+ messages in thread
From: Junio C Hamano @ 2008-05-07 16:04 UTC (permalink / raw)
To: Brandon Casey; +Cc: Mike Ralphson, Johannes Sixt, git
Brandon Casey <casey@nrlssc.navy.mil> writes:
> Mike Ralphson wrote:
>> 2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
>>> Johannes Sixt wrote:
>>> > 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).
>>> >
>>>
>>> How about something like this?
>>>
>>> diff --git a/compat/fopen.c b/compat/fopen.c
>>> index ccb9e89..70b0d4d 100644
>>> --- a/compat/fopen.c
>>> +++ b/compat/fopen.c
>>> @@ -1,5 +1,5 @@
>>> +#undef FREAD_READS_DIRECTORIES
>>> #include "../git-compat-util.h"
>>> -#undef fopen
>>> FILE *git_fopen(const char *path, const char *mode)
>>> {
>>> 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.
>
> 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.
In any case, that #undef then #include dance needs a big comment on why it
has to be so.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 16:04 ` Junio C Hamano
@ 2008-05-07 16:20 ` Mike Ralphson
2008-05-07 17:36 ` Brandon Casey
2008-05-07 17:34 ` [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro Brandon Casey
1 sibling, 1 reply; 20+ messages in thread
From: Mike Ralphson @ 2008-05-07 16:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Brandon Casey, Johannes Sixt, git
2008/5/7 Junio C Hamano <gitster@pobox.com>:
>
> Brandon Casey <casey@nrlssc.navy.mil> writes:
>
> > Mike Ralphson wrote:
> >> 2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
> >>> Johannes Sixt wrote:
> >>> > 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).
> >>> >
> >>>
> >>> How about something like this?
> >>>
> >>> diff --git a/compat/fopen.c b/compat/fopen.c
> >>> index ccb9e89..70b0d4d 100644
> >>> --- a/compat/fopen.c
> >>> +++ b/compat/fopen.c
> >>> @@ -1,5 +1,5 @@
> >>> +#undef FREAD_READS_DIRECTORIES
> >>> #include "../git-compat-util.h"
> >>> -#undef fopen
> >>> FILE *git_fopen(const char *path, const char *mode)
> >>> {
> >>> 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.
> >
> > 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.
>
> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 16:20 ` Mike Ralphson
@ 2008-05-07 17:36 ` Brandon Casey
0 siblings, 0 replies; 20+ messages in thread
From: Brandon Casey @ 2008-05-07 17:36 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Junio C Hamano, Johannes Sixt, git
Mike Ralphson wrote:
> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008-05-07 16:04 ` Junio C Hamano
2008-05-07 16:20 ` Mike Ralphson
@ 2008-05-07 17:34 ` Brandon Casey
2008-05-08 7:27 ` Mike Ralphson
1 sibling, 1 reply; 20+ messages in thread
From: Brandon Casey @ 2008-05-07 17:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mike Ralphson, Johannes Sixt, Git Mailing List
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 <casey@nrlssc.navy.mil>
---
compat/fopen.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/compat/fopen.c b/compat/fopen.c
index ccb9e89..b5ca142 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -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;
--
1.5.5
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008-05-07 17:34 ` [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro Brandon Casey
@ 2008-05-08 7:27 ` Mike Ralphson
2008-05-08 7:34 ` Johannes Sixt
2008-05-08 10:37 ` H.Merijn Brand
0 siblings, 2 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-08 7:27 UTC (permalink / raw)
To: Brandon Casey, H.Merijn Brand
Cc: Junio C Hamano, Johannes Sixt, Git Mailing List
2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
>
> 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 <casey@nrlssc.navy.mil>
>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008-05-08 7:27 ` Mike Ralphson
@ 2008-05-08 7:34 ` Johannes Sixt
2008-05-08 7:59 ` Mike Ralphson
2008-05-08 10:37 ` H.Merijn Brand
1 sibling, 1 reply; 20+ messages in thread
From: Johannes Sixt @ 2008-05-08 7:34 UTC (permalink / raw)
To: Mike Ralphson
Cc: Brandon Casey, H.Merijn Brand, Junio C Hamano, Git Mailing List
Mike Ralphson schrieb:
> 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.
Since with this patch we are treating fopen specially anyway, we could go
one step further and do this, too:
---
diff --git a/git-compat-util.h b/git-compat-util.h
index b2708f3..dad4d48 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008-05-08 7:34 ` Johannes Sixt
@ 2008-05-08 7:59 ` Mike Ralphson
0 siblings, 0 replies; 20+ messages in thread
From: Mike Ralphson @ 2008-05-08 7:59 UTC (permalink / raw)
To: Johannes Sixt
Cc: Brandon Casey, H.Merijn Brand, Junio C Hamano, Git Mailing List
2008/5/8 Johannes Sixt <j.sixt@viscovery.net>:
> Mike Ralphson schrieb:
>> 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.
>
> Since with this patch we are treating fopen specially anyway, we could go
> one step further and do this, too:
> ---
> diff --git a/git-compat-util.h b/git-compat-util.h
> index b2708f3..dad4d48 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro
2008-05-08 7:27 ` Mike Ralphson
2008-05-08 7:34 ` Johannes Sixt
@ 2008-05-08 10:37 ` H.Merijn Brand
1 sibling, 0 replies; 20+ messages in thread
From: H.Merijn Brand @ 2008-05-08 10:37 UTC (permalink / raw)
To: Mike Ralphson
Cc: Brandon Casey, Junio C Hamano, Johannes Sixt, Git Mailing List
On Thu, 8 May 2008 08:27:48 +0100, "Mike Ralphson"
<mike.ralphson@gmail.com> wrote:
> 2008/5/7 Brandon Casey <casey@nrlssc.navy.mil>:
> >
> > 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 <casey@nrlssc.navy.mil>
> >
>
> Tested-by: Mike Ralphson <mike@abacus.co.uk>
>
> 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
> 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.
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.
> Maybe instead having a comment for those who need large pack-file
> support? Will submit amended Makefile patch if there's interest.
--
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/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-07 11:57 ` Johannes Sixt
2008-05-07 12:51 ` Mike Ralphson
@ 2008-05-16 10:19 ` Mike Ralphson
2008-05-16 13:37 ` Johannes Sixt
1 sibling, 1 reply; 20+ messages in thread
From: Mike Ralphson @ 2008-05-16 10:19 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, git
2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
> Mike Ralphson schrieb:
>> 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.
>
> 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 the
wt-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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] Makefile: update the default build options for AIX
2008-05-16 10:19 ` [PATCH] Makefile: update the default build options for AIX Mike Ralphson
@ 2008-05-16 13:37 ` Johannes Sixt
0 siblings, 0 replies; 20+ messages in thread
From: Johannes Sixt @ 2008-05-16 13:37 UTC (permalink / raw)
To: Mike Ralphson; +Cc: Junio C Hamano, git
Mike Ralphson schrieb:
> 2008/5/7 Johannes Sixt <j.sixt@viscovery.net>:
>> Mike Ralphson schrieb:
>>> 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.
>> 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 the
> wt-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.
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:
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
-- Hannes
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2008-05-16 13:38 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 8:35 [PATCH] Makefile: update the default build options for AIX Mike Ralphson
2008-05-07 11:57 ` Johannes Sixt
2008-05-07 12:51 ` Mike Ralphson
2008-05-07 13:05 ` Mike Ralphson
2008-05-07 13:14 ` Johannes Sixt
2008-05-07 14:20 ` Mike Ralphson
2008-05-07 14:38 ` Brandon Casey
2008-05-07 15:15 ` Mike Ralphson
2008-05-07 15:39 ` Johannes Sixt
2008-05-07 15:40 ` Brandon Casey
2008-05-07 16:04 ` Junio C Hamano
2008-05-07 16:20 ` Mike Ralphson
2008-05-07 17:36 ` Brandon Casey
2008-05-07 17:34 ` [PATCH] compat/fopen.c: avoid clobbering the system defined fopen macro Brandon Casey
2008-05-08 7:27 ` Mike Ralphson
2008-05-08 7:34 ` Johannes Sixt
2008-05-08 7:59 ` Mike Ralphson
2008-05-08 10:37 ` H.Merijn Brand
2008-05-16 10:19 ` [PATCH] Makefile: update the default build options for AIX Mike Ralphson
2008-05-16 13:37 ` Johannes Sixt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).