RESOLVED FIXED 201945
[WPE][GTK] BubblewrapLauncher fails when prgname is long
https://bugs.webkit.org/show_bug.cgi?id=201945
Summary [WPE][GTK] BubblewrapLauncher fails when prgname is long
Michael Catanzaro
Reported 2019-09-18 14:49:51 PDT
Create an Epiphany web app with homepage https://gitlab.gnome.org/GNOME/gnome-calendar/-/boards and title "Calendário | GitLab Board". Launching the web app will fail with this error: bwrap: Can't find source path /run/user/1000/epiphany-calendário-|-gitlab-board-7a7ee47e494991831fefdce8763b44fba593ba63/dbus-proxy-G0AJ8Z: No such file or directory Problem is that two characters are truncated off the address of the socket that gets created. Actually, WebKit creates this socket properly first, using g_mkstemp(). Then xdg-dbus-proxy unlinks it in flatpak_proxy_start(), in flatpak-proxy.c, and recreates it by creating a GUnixSocketAddress and then calling g_socket_listener_add_address(). Problem occurs when creating the GUnixSocketAddress. It truncates the path down to UNIX_PATH_MAX characters, which is only 108 on Linux. E.g. this debug patch: diff --git a/gio/gunixsocketaddress.c b/gio/gunixsocketaddress.c index 27e195e47..f36ae3dad 100644 --- a/gio/gunixsocketaddress.c +++ b/gio/gunixsocketaddress.c @@ -104,6 +104,9 @@ g_unix_socket_address_set_property (GObject *object, str = g_value_get_string (value); if (str) { + if (strlen (str) >= UNIX_PATH_MAX) + g_warning ("Socket address %s will be truncated because its length %zd exceeds maximum length %lu", str, strlen (str), UNIX_PATH_MAX - 1); + g_strlcpy (address->priv->path, str, sizeof (address->priv->path)); address->priv->path_len = strlen (address->priv->path); Results in the warning: (process:140099): GLib-GIO-WARNING **: 16:47:45.169: Socket address /run/user/1000/epiphany-calendário-|-gitlab-board-7a7ee47e494991831fefdce8763b44fba593ba63/dbus-proxy-GND97Z will be truncated because its length 109 exceeds maximum length 107 So... yeah, not sure what to do here. We could truncate the prgname, or just not use the prgname at all in the path, since it's not really needed.
Attachments
Patch (1.94 KB, patch)
2019-09-19 05:43 PDT, Patrick Griffis
no flags
Michael Catanzaro
Comment 1 2019-09-19 05:37:13 PDT
*** Bug 201979 has been marked as a duplicate of this bug. ***
Patrick Griffis
Comment 2 2019-09-19 05:43:10 PDT
Michael Catanzaro
Comment 3 2019-09-23 06:18:12 PDT
Comment on attachment 379123 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379123&action=review > Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp:138 > - GUniquePtr<char> appRunDir(g_build_filename(g_get_user_runtime_dir(), g_get_prgname(), nullptr)); > + GUniquePtr<char> appRunDir(g_build_filename(g_get_user_runtime_dir(), BASE_DIRECTORY, nullptr)); Even better would be to print a warning with WTFLogAlways if strlen(appRunDir.get()) exceeds sizeof(((struct sockaddr_un*) nullptr)->sun_path) - 1. Assuming my math isn't off.
WebKit Commit Bot
Comment 4 2019-09-23 06:59:56 PDT
Comment on attachment 379123 [details] Patch Clearing flags on attachment: 379123 Committed r250231: <https://trac.webkit.org/changeset/250231>
WebKit Commit Bot
Comment 5 2019-09-23 06:59:57 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.