On Nov 11, 2021, at 7:22 PM, Stuart Henderson <s...@spacehopper.org> wrote:
> 
> On 2021/11/11 15:31, k...@openbsd.org wrote:
>> http://build-failures.rhaalovely.net/sparc64/2021-11-09/sysutils/polkit.log
> 
> I don't see how to fix it properly in meson.build, but here is the problem,
> this is detected incorrectly with ports-gcc,
> 
> Checking if "setnetgrent return support" : compiles: YES 
> 
> Should be NO.
> 
> Looking in meson.build
> 
> 150 
> 151 # Check whether setnetgrent has a return value
> 152 config_h.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h'))
> 153 
> 
> this is detecting netgroup.h and is setting it in config.h, but it is
> *not* defining HAVE_NETGROUP_H when it compiles the following test
> 
> 154 setnetgrent_return_src = '''
> 155   #include <stddef.h>
> 156   #ifdef HAVE_NETGROUP_H
> 157   #include <netgroup.h>
> 158   #else
> 159   #include <netdb.h>
> 160   #endif
> 161   int main() {
> 162       int r = setnetgrent (NULL);
> 163   };
> 164 '''
> 165 
> 166 config_h.set('HAVE_SETNETGRENT_RETURN', 
> cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support'))
> 
> The difference between the compilers is that gcc returns
> 
> warning: implicit declaration of function 'setnetgrent'; did you mean 
> 'setnetent'? [-Wimplicit-function-declaration]
> 
> whereas clang gives
> 
> error: implicit declaration of function 'setnetgrent' is invalid in C99 
> [-Werror,-Wimplicit-function-declaration]
> 
> so the test compile is giving wrong results, so it takes the wrong
> ifdef path resulting in the build failure
> 
> ../polkit-0.120/src/polkitbackend/polkitbackendinteractiveauthority.c:2239:7: 
> error: void value not ignored as it ought to be
> 
> Bodging it with
> 
> 166 config_h.set('HAVE_SETNETGRENT_RETURN', 
> cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support', args: 
> '-DHAVE_NETGROUP_H'))
> 
> does work well enough for OpenBSD but obviously not correct ..
> 

I believe the attached diff is a correct fix for this. Works on sparc64 and 
amd64.
Sorry its an attachment (mua on macosx doesn’t inline patches correctly I 
believe).

-Kurt

Attachment: polkit.setnetgrent.diff
Description: Binary data


Reply via email to