Bug 2252635
| Summary: | (regression) 0.0.19.20170219gita59fd76 FTBFS patch broke webkit2-sharp | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Hin-Tak Leung <htl10> |
| Component: | webkit2-sharp | Assignee: | Timotheus Pokorra <mailinglists> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 39 | CC: | mailinglists |
| Target Milestone: | --- | Keywords: | Regression, Upgrades |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | webkit2-sharp-0-0.20.20170219gita59fd76.fc39 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-12-13 01:25:17 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: | |||
|
Description
Hin-Tak Leung
2023-12-03 08:51:20 UTC
Please remove the offending FTBFS patch, or correct it. It is just wrong changing the C glue code without correcting the C# code, or vice versa. I got hold of the patch itself from https://src.fedoraproject.org/rpms/webkit2-sharp.git - it is as I thought, a bit daft to change only the C glue code without correcting the C# P/Invoke code also... --- a/sources/Makefile.am 2023-08-12 21:24:16.266564059 +0200 +++ b/sources/Makefile.am 2023-08-12 21:25:33.461760068 +0200 @@ -52,6 +52,7 @@ --glue-includes=webkit2/webkit2.h, --gapidir=$(gapidir) \ --assembly-name=$(ASSEMBLY_NAME) && \ find $(srcdir)/generated/ -type f -name "*.cs" > $(GEN_SOURCES) + sed -i "s/parentInstance/parent/g" $(GLUEDIR)/generated.c $(SRC_FILES_XML): $(GEN_SOURCES) $(CUSTOM_SOURCES) echo "<SourceFiles>" > $(SRC_FILES_XML) besides 'sed -i "s/parentInstance/parent/g" $(GLUEDIR)/generated.c', you need to do exactly the same thing to some of the 'find $(srcdir)/generated/ -type f -name "*.cs"' file too. And preferably, with a longer string for exact match as in "s/very_long_very_long_very_long_parentInstance/very_long_very_long_very_long_parent/g", rather than just "s/parentInstance/parent/g" . Okay, I have looked at the generated C# code. Strictly speaking, you only need to change 1 line in $(GLUEDIR)/generated.c: return (guint)G_STRUCT_OFFSET (WebKitWebViewBase, parentInstance); But you ended up changing 3 - $ grep -n -R parent glue/generated.c 6:guint webkit2sharp_webkit2_webviewbase_get_parent_offset (void); 9:webkit2sharp_webkit2_webviewbase_get_parent_offset (void) 11: return (guint)G_STRUCT_OFFSET (WebKitWebViewBase, parent); And it is the fact that you have changed the other two to cause the P/Invoke signature to mis-match: $ grep -R -n parentInstance generated/WebKit2/ generated/WebKit2/WebViewBase.cs:22: extern static uint webkit2sharp_webkit2_webviewbase_get_parentInstance_offset (); generated/WebKit2/WebViewBase.cs:24: static uint parentInstance_offset = webkit2sharp_webkit2_webviewbase_get_parentInstance_offset (); generated/WebKit2/WebViewBase.cs:28: IntPtr* raw_ptr = (IntPtr*)(((byte*)Handle) + parentInstance_offset); If you change the function signature on the C-side (which you don't need to), you should change the P/Invoke signature on the C# side too, the "extern static" line at line 22 of the C# code. Changing all 7 (3 on the C side and 4 on the side) of *parentInstance* to *parent* might be simplest and more future proof, but strictly speaking you only need to change 1 line one the C side, line 11. webkit2-sharp broke because you change the other two line too. So, strictly speaking, the correct way to patch webkit2-sharp is this line:
sed -i "s/WebKitWebViewBase, parentInstance/WebKitWebViewBase, parent/g" $(GLUEDIR)/generated.c
So that it is specific to modifying exactly one line in generated.c, instead of 3.
If you want a simpler but strictly-speaking changing more than necessary, you need to do:
sed -i "s/parentInstance/parent/g" $(GLUEDIR)/generated.c $(srcdir)/generated/*/*.cs
instead.
I really would rather you do the first one.
That somebody was me. I am sorry, that I did not test the patch. That was daft, you are correct. I probably will have to orphan my packages soon, because I do not have the time to maintain them properly. I am not using Fedora or CentOS anymore myself, so there is not much point in maintaining packages anymore. Thank you for looking into this issue in detail. I have now applied your solution in rawhide and F39. https://src.fedoraproject.org/rpms/webkit2-sharp/commits/rawhide https://src.fedoraproject.org/rpms/webkit2-sharp/c/e67ef2133dc8bb4abb2a20895b2f221a867df4c5?branch=f39 I did not test it, because I don't know which csharp program is using webkit. Please confirm in Bodhi if this update resolves the problem. FEDORA-2023-f1eebd1caa has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f1eebd1caa FEDORA-2023-f1eebd1caa has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f1eebd1caa` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f1eebd1caa See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. I upgraded to https://bodhi.fedoraproject.org/updates/FEDORA-2023-f1eebd1caa and it now works. Thanks. I think I did have login to bodhi at some point in the past, but seems to have lost it... (it is not the same as redhat bugzilla, I think?). Anyway, you have the confirmation here that it works. I have done a bit more digging and created https://github.com/hbons/webkit2-sharp/pull/7 - I think the true problem here is that webkit people are being naughty to modified already published fields. Re-generating the api.raw file should result in strict additions and additional annotations like this: - <enum name="ProcessModel" cname="WebKitProcessModel" type="enum" gtype="webkit_process_model_get_type" version="2.4"> + <enum name="ProcessModel" cname="WebKitProcessModel" type="enum" gtype="webkit_process_model_get_type" version="2.4" deprecated="true" deprecated-version="2.40"> or this - <parameter closure="1" name="user_data" type="gpointer"/> + <parameter allow-none="1" closure="1" name="user_data" type="gpointer"/> According to the old api file, the field used to be called "parentInstance" and is now called "parent". The webkit2-sharp.metadata file (which is more what the personal preference of webkit2-sharp's author) to hide any c field "parent_instance" or any C# field 'Parent' (which is from the c field converted to camel case, i.e. a c field "parent"), but the old name has falling through the crack between these two. I am okay if you want to just stop at 0.20 ; if you want to do https://github.com/hbons/webkit2-sharp/pull/7 instead (as 0.21?), it is equivalent to 0.20 but also hiding the field altogether because of the metadata file. The "generated.c" with pull/7 is completely empty, and you don't even need to ship libwebkit2sharpglue-2.10.9.so any more. The csharp script I use (a variant of the oldest webkit-sharp example) is this: === #!/usr/bin/env -S csharp -lib:/usr/lib/mono/webkit2-sharp -lib:/usr/lib/mono/GtkSharp-3.0/ -r:gtk-sharp -r:webkit2-sharp -s ///* // Adapted to gtk3 and webkit2-sharp, and to run in scripting form with // Mono's Interactive C# Shell and Scripting REPL by // Hin-Tak Leung, 2015-2021. //*/ ///* // This was originally written by Andreia Gaita, perhaps around 2009? // // A version of this is still at http://shana.worldofcoding.com/en/browser.html, // the webpage itself dated back to at least 2012. //*/ using Gtk; using WebKit2; string url = "https://www.google.com"; if (Args.Length > 0) url = Args[0]; Application.Init (); Window window = new Window (url); window.SetDefaultSize(1200,600); window.Destroyed += delegate (object sender, EventArgs e) { Application.Quit (); }; ScrolledWindow scrollWindow = new ScrolledWindow (); WebView webView = new WebView (); webView.LoadUri (url); scrollWindow.Add (webView); window.Add (scrollWindow); window.ShowAll (); Application.Run (); === FEDORA-2023-f1eebd1caa has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report. |