-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updatechecker: Port to libsoup3 and small other fixes #1336
Conversation
I don't know enough about libsoup to sensibly review (and don't have the time to learn), but since Geany uses GIO why not |
It works... #include <gio/gio.h>
#include <stdio.h>
int main() {
GFile *file = g_file_new_for_uri("https://geany.org/service/version/");
GError *error = NULL;
GFileInputStream *stream = g_file_read(file, NULL, &error);
if (!error) {
printf("No error.\n");
guint8 *buffer = NULL;
gsize size = 0;
buffer = (guint8 *)g_malloc(32);
gboolean success = g_input_stream_read_all((GInputStream *)stream, buffer,
31, &size, NULL, &error);
if (success) {
buffer[size] = '\0';
printf("Data: %s\n", buffer);
} else {
printf("Error reading stream.\n");
}
} else {
printf("Error reading uri.\n");
}
return 0;
} $ gcc test.c -o test $(pkgconf --libs gio-2.0) $(pkgconf --cflags gio-2.0)
$ ./test
No error.
Data: 2.0.0 |
@xiota neat, and simple, although it has one theoretical bug (though unlikely in practice) [hint: what if 32 bytes were returned]. Just for general information, Geany used (a long time ago) to avoid GIO, which is probably why the plugin used libsoup directly. But now GIO is required by Geany so its available to the plugin. |
Edited code in previous comment to request 31 bytes from It was written to check whether |
Unfortunately the GIO docs don't say when PS I expect not everyone has your alias pkgconf == pkg-config 😉 |
Looks like it depends on
Maybe better to depend on
On my computer, |
Yeah, If an existing script fails because it depends on some edge case in Edit: by "script" I really mean the .pc files that various apps install |
I use whatever is provided by the package manager. Even on Debian, pkg-config is a dummy package that redirects to pkgconf. Fedora also does not appear to provide the original pkg-config. Their stance doesn't seem particularly "aggressive" in context because they call out "passive-aggressive people who try to argue with us". Seems they probably had some people who opened numerous issues reporting closely related problems that they were told multiple times are not bugs. It would be like... what if someone opened multiple issues for Geany complaining that it doesn't support various Qt6 features despite being told multiple times that they aren't bugs? Eventually, those complaints could be considered intentionally disruptive, and people who "insist" on continuing need to be cut off. |
Well, IIUC GVFS is part of GIO (not to be confused with GnomeVFS), so if its uninstalled its not surprising parts of GIO don't work. But that probably means reading URLs won't work on Windows, dunno about Macos, so back to the soup I guess 😜 |
It is separate from GIO. This is the project page: https://gitlab.gnome.org/GNOME/gvfs Debian packages, appear to be Looks like msys2 and brew do not have |
Well, I interpret the very first words in the readme "GVfs is a userspace virtual filesystem implementation for GIO" to mean its part of GIO. IIUC it provides the implementations for the abstract file/URL/dbus stream operations in GIO and thats why you get an error if its not installed and you try to read anything other than a local file. Never mind, its was worth a try, and thanks for writing that test program. |
Someone could run the test program on windows or mac to find out. I no longer have (easy) access to either. |
Yeah I guess using GIO directly for this kind of super simple GET would make sense Indeed. I also think that gvfs will indeed be part of all reasonable GIO installations, but I could be wrong. |
Note that writing an async version of the feature, while reasonably easy, is a little bit more work. |
See #1340 if wanted. |
Waiting for #1340 (comment) |
This PR won (IMO), so it's the one to review @frlan |
libsoup2 is phasing out, and using it in a plugin causes conflicts with other plugins using a newer version, including ones using a current webkit2gtk.
Also, properly abort pending requests when unloading the plugin, in the unlikely case they didn't all finish by that time.
Not only should this be in the German translation if need be, but I'd also just not use quotes after a colon.
15f0182
to
e1c9ac3
Compare
I rebased this on master now #1342 is merged, as it has CI infrastructure changes for building with libsoup3. Apart from that it's unchanged from the previous version. |
@frlan I think this should really land (or be rejected if need be) before 2.1 so we have libsoup3 support for every relevant plugin. |
I'll test the CI installers in the next days when time permits. |
Tested on Windows and works. |
@frlan IMO we need this for 2.1, see #1336 (comment). I'll merge this in a few days unless somebody complains. |
Port to libsoup3 (see #1295 (comment) @jbicha) plus a couple other fixes I just couldn't leave there after seeing them 🙂