Bug 2341021

Summary: perl-CommonMark-0.310100-2.fc42 FTBFS: CommonMark.c:675:18: error: too many arguments to function ‘XSFUNCTION’; expected 0, have 1
Product: [Fedora] Fedora Reporter: Fedora Release Engineering <releng>
Component: perl-CommonMarkAssignee: Emmanuel Seyman <emmanuel>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 42CC: emmanuel, ppisar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: perl-CommonMark-0.310100-3.fc43 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-08-31 08:51:15 UTC Type: ---
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: 2300528    
Attachments:
Description Flags
build.log
none
root.log
none
state.log none

Description Fedora Release Engineering 2025-01-22 21:18:04 UTC
perl-CommonMark failed to build from source in Fedora rawhide/f42

https://koji.fedoraproject.org/koji/taskinfo?taskID=128031648


For details on the mass rebuild see:

https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
Please fix perl-CommonMark at your earliest convenience and set the bug's status to
ASSIGNED when you start fixing it. If the bug remains in NEW state for 8 weeks,
perl-CommonMark will be orphaned. Before branching of Fedora 43,
perl-CommonMark will be retired, if it still fails to build.

For more details on the FTBFS policy, please visit:
https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/

Comment 1 Fedora Release Engineering 2025-01-22 21:18:07 UTC
Created attachment 2071594 [details]
build.log

Comment 2 Fedora Release Engineering 2025-01-22 21:18:08 UTC
Created attachment 2071595 [details]
root.log

file root.log too big, will only attach last 32768 bytes

Comment 3 Fedora Release Engineering 2025-01-22 21:18:09 UTC
Created attachment 2071596 [details]
state.log

Comment 4 Aoife Moloney 2025-02-26 13:41:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 5 Petr Pisar 2025-03-24 09:41:12 UTC
From build.log:

gcc -c   -D_REENTRANT -D_GNU_SOURCE -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -DVERSION=\"0.310100\" -DXS_VERSION=\"0.310100\" -fPIC "-I/usr/lib64/perl5/CORE"   CommonMark.c
CommonMark.c: In function ‘XS_CommonMark__Node_interface_get_node’:
CommonMark.c:675:18: error: too many arguments to function ‘XSFUNCTION’; expected 0, have 1
  675 |         RETVAL = XSFUNCTION(node);
      |                  ^~~~~~~~~~ ~~~~
CommonMark.c: In function ‘XS_CommonMark__Node_interface_get_int’:
CommonMark.c:701:18: error: too many arguments to function ‘XSFUNCTION’; expected 0, have 1
  701 |         RETVAL = XSFUNCTION(node);
      |                  ^~~~~~~~~~ ~~~~
[...]

A difference between passing and failing build root is at <https://koschei.fedoraproject.org/build/19465911>. This failure is triggered by upgrading gcc from version 14 to 15.

Comment 6 Petr Pisar 2025-06-12 09:07:13 UTC
The offending generated C code from XS file with Extutils::ParseXS:

XS_EUPXS(XS_CommonMark__Node_interface_get_node); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_CommonMark__Node_interface_get_node)
{
    dVAR; dXSARGS;
    dXSFUNCTION(cmark_node *);
    if (items != 1)
       croak_xs_usage(cv,  "node");
    {
    cmark_node *    RETVAL;
    cmark_node *    node = (cmark_node*)S_sv2c(aTHX_ ST(0), "CommonMark::Node", 16, cv,
                               "node")
;
    XSFUNCTION = XSINTERFACE_FUNC(cmark_node *,cv,XSANY.any_dptr);

→   RETVAL = XSFUNCTION(node);
    {
        SV * RETVALSV;
    RETVALSV = S_node2sv(aTHX_ RETVAL);
        RETVALSV = sv_2mortal(RETVALSV);
        ST(0) = RETVALSV;
    }
    }
    XSRETURN(1);
}


XSFUNCTION is declared with dXSFUNCTION() macro defined in XSUB.h as:

#ifdef __cplusplus
#  define XSINTERFACE_CVT(ret,name) ret (*name)(...)
#  define XSINTERFACE_CVT_ANON(ret) ret (*)(...)
#else
#  define XSINTERFACE_CVT(ret,name) ret (*name)()
#  define XSINTERFACE_CVT_ANON(ret) ret (*)()
#endif
#define dXSFUNCTION(ret)                XSINTERFACE_CVT(ret,XSFUNCTION)
#define XSINTERFACE_FUNC(ret,cv,f)     ((XSINTERFACE_CVT_ANON(ret))(f))
#define XSINTERFACE_FUNC_SET(cv,f)      \
                CvXSUBANY(cv).any_dxptr = (void (*) (pTHX_ void*))(f)

It seems that ExtUtils::ParseXS does not conform to C23 and declares the function pointer as a pointer to a function with an empty argument list ("ret (*)()").

Comment 7 Petr Pisar 2025-06-12 10:35:58 UTC
It is a bug in ExtUtils::ParseXS <https://github.com/Perl/perl5/issues/23192>. Until it is fixed, I recommend adding -std=c99 to CCFLAGS in Makefile.PL.

Comment 8 Emmanuel Seyman 2025-08-31 08:51:15 UTC
Fixed by Adam Williamson a while back:
https://koji.fedoraproject.org/koji/buildinfo?buildID=2744003