Bug 2179882

Summary: cube: Inconsistency in autoconf checks regarding AC_INCLUDES_DEFAULT
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: cubeAssignee: Florian Weimer <fweimer>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dave.love, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cube-4.8.1-2.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-20 12:56:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2141798    
Attachments:
Description Flags
cube-configure-c99.patch none

Description Florian Weimer 2023-03-20 10:44:03 UTC
ac_cube_posix_functions.m4 uses AC_CHECK_DECLS (which implies AC_INCLUDES_DEFAULT headers) to check for gethostid, gethosname, followed by a check for link-time availability using AC_LINK_IFELSE (not AC_CHECK_FUNC). The way AC_LINK_IFELSE used, AC_INCLUDES_DEFAULT headers are not applied, so the condition

            #if !HAVE_DECL_GETHOSTID
            long gethostid(void);
            #endif

does not give the right result because <unistd.h> is not included at this point even though HAVE_DECL_GETHOSTID is defined.

This causes problems with future compilers which do not support implicit function declarations.

Filing this here because upstream does not seem to have a public bug tracker.

Comment 1 Dave Love 2023-03-20 12:04:08 UTC
I've forwarded it to the maintainers, thanks.
Is this just a problem for gcc 14, i.e. not imminent?

Comment 2 Florian Weimer 2023-03-20 12:15:12 UTC
(In reply to Dave Love from comment #1)
> I've forwarded it to the maintainers, thanks.

Okay, then I'll hold off sending my message. I'm testing a patch.

> Is this just a problem for gcc 14, i.e. not imminent?

I want to add approximating -Werror flags to the default flags fairly soon, certainly before GCC 14 lands in December or so.

For upstream, it might be more pressing because they also have users with Clang, which has already made the switch.

Comment 3 Florian Weimer 2023-03-20 12:36:21 UTC
Created attachment 1952064 [details]
cube-configure-c99.patch

This patch seems to work. Upstream may need a different approach (e.g. for systems which do not have <unistd.h>).