Bug 2155642

Summary: qt5-qtwebengine: libsync should not build with -Wno-implicit-function-declaration -std=gnu11
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: qt5-qtwebengineAssignee: Florian Weimer <fweimer>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jgrulich, kde-sig, kevin, rdieter
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qt5-qtwebengine-5.15.12-4.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-23 15:28:19 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: 2137512    
Attachments:
Description Flags
qt5-qtwebengine-c99.patch none

Description Florian Weimer 2022-12-21 17:33:20 UTC
If the code has implicit function declarations, it needs to be build with -std=gnu89 because these declarations are a C89 feature.

A future compiler will likely reject this:

../../3rdparty/chromium/third_party/libsync/src/sync.c:80:5: error: implicit declaration of function 'strlcpy'
   80 |     strlcpy(data.name, name, sizeof(data.name));
      |     ^~~~~~~

In GCC, warning flags do not gate access to obsolete language constructs, so -Wno-implicit-function-declaration is unlikely to work for this. If this is old, pre-ANSI code, -std=gnu89 should work fine.

Comment 1 Florian Weimer 2022-12-21 17:35:45 UTC
Do you know where qt5-webengine/Chromium get their copy of libsync from?

Comment 2 Ben Cotton 2023-02-07 15:04:04 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 3 Jan Grulich 2023-02-08 10:32:46 UTC
(In reply to Florian Weimer from comment #1)
> Do you know where qt5-webengine/Chromium get their copy of libsync from?

https://source.chromium.org/chromium/chromium/src/+/main:third_party/libsync/README.chromium

Comment 4 Jan Grulich 2023-02-08 10:34:39 UTC
It looks strlcpy() is an addition Chromium adds on its own.

Comment 5 Florian Weimer 2023-02-23 11:22:48 UTC
Created attachment 1945899 [details]
qt5-qtwebengine-c99.patch

This patch seems to fix it.

Comment 6 Kevin Kofler 2023-02-23 13:21:34 UTC
I think it would be cleaner to use a proper header file for strlcpy, but sure, as long as the function is only used in one .c file, this will work.

And for jgrulich: strlcpy is one of those safer string functions from BSD that glibc unfortunately refuses to add (see https://lwn.net/Articles/507319/ – more than 10 years old and yet still current) because they are not required by any standard. They can be found in libbsd, but sadly many projects prefer just copying&pasting the code over adding a small dependency, and that is what Chromium is doing here.

Comment 7 Florian Weimer 2023-02-23 15:15:27 UTC
Any further comments before i push this patch? Thanks.

Comment 8 Kevin Kofler 2023-02-23 15:22:04 UTC
Just to be clear: I'm OK with you pushing this.