Bug 202880 - [WPE][GTK] Bubblewrap sandbox should not attempt to bind empty paths
Summary: [WPE][GTK] Bubblewrap sandbox should not attempt to bind empty paths
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
: 213925 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-12 02:14 PDT by Ryan Walklin
Modified: 2020-08-10 05:58 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.70 KB, patch)
2020-07-03 07:39 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Walklin 2019-10-12 02:14:04 PDT
The version of Epiphany packaged with Fedora 31 (3.34.1)/WebKitGTK is unable to load webpages. The URL bar will accept a URL but stall with the progress indicator showing ~10%. Nothing is rendered. No useful debug output in console other than

bwrap: Can't create file at /.flatpak-info: Read-only file system

The nightly version installed from flatpak at 

https://nightly.gnome.org/repo/appstream/org.gnome.Epiphany.Devel.flatpakref

works without issues.

Interestingly, keyboard shortcuts such as Ctrl-L also fail to work even when the window is focused, so I suspect this is a Wayland specific issue. I note that the same install works fine using a Wayland gnome-shell session, so seems Sway-specific. 

Happy to post a WAYLAND_DEBUG log if that's helpful.
Comment 1 Michael Catanzaro 2019-10-12 06:56:31 PDT
(In reply to Ryan Walklin from comment #0)
> bwrap: Can't create file at /.flatpak-info: Read-only file system
Comment 2 Ryan Walklin 2019-10-12 07:38:08 PDT
I've done a bit more experimenting. Opening Epiphany from the .desktop file in gnome-shell works fine under both Wayland and X sessions, however if I try to call epiphany from the command-line (as I'm doing with Sway using an fzf-based launcher) I can reproduce the same behaviour under gnome-shell, ie Epiphany launches but will not load pages.

Attempting to use the .desktop file from the command line using gtk-launch with both Sway and gnome-shell also fails. 

I note the error message contains a root path (/.flatpak-info), might this be an issue with the runtime directory not set properly when loading from the command line?
Comment 3 Patrick Griffis 2019-10-12 17:24:40 PDT
(In reply to Ryan Walklin from comment #2)
> I've done a bit more experimenting. Opening Epiphany from the .desktop file
> in gnome-shell works fine under both Wayland and X sessions, however if I
> try to call epiphany from the command-line (as I'm doing with Sway using an
> fzf-based launcher) I can reproduce the same behaviour under gnome-shell, ie
> Epiphany launches but will not load pages.
> 
> Attempting to use the .desktop file from the command line using gtk-launch
> with both Sway and gnome-shell also fails. 
> 
> I note the error message contains a root path (/.flatpak-info), might this
> be an issue with the runtime directory not set properly when loading from
> the command line?

`bwrap` would be creating the file in its own new tmpfs root. I can't imagine why it would fail.

Trying to reproduce locally on GNOME-Shell (Fedora 30) and I cannot. The source of `gtk-launch` is very simple also and doesn't seem to do anything crazy.
Comment 4 Michael Catanzaro 2020-07-03 07:35:30 PDT
*** Bug 213925 has been marked as a duplicate of this bug. ***
Comment 5 Michael Catanzaro 2020-07-03 07:35:50 PDT
If an empty path is set in LD_LIBRARY_PATH (e.g. /foo::/bar), we wind up passing --ro-bind-try   --ro-bind-try to bwrap, where the second --ro-bind-try is treated as the source path to mount, and the next flag we pass gets treated as the destination path. The web process crashes with this confusing error:

bwrap: Can't create file at /.flatpak-info: Read-only file system
Comment 6 Michael Catanzaro 2020-07-03 07:39:29 PDT
Created attachment 403458 [details]
Patch
Comment 7 EWS 2020-07-03 08:09:43 PDT
Committed r263899: <https://trac.webkit.org/changeset/263899>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403458 [details].
Comment 8 Michael Catanzaro 2020-07-03 11:11:14 PDT
(In reply to Michael Catanzaro from comment #5)
> If an empty path is set in LD_LIBRARY_PATH

Ryan, can you confirm if this was indeed your problem? I was able to reproduce this issue when running with LD_LIBRARY_PATH=::
Comment 9 Ryan Walklin 2020-07-04 21:31:21 PDT
(In reply to Michael Catanzaro from comment #8)
> Ryan, can you confirm if this was indeed your problem?

So it was, unsetting LD_LIBRARY_PATH allowed epiphany to load fine from the Fedora package. My .bashrc was setting LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH", so ended up with an empty path at the end.

Thanks for the fix!
Comment 10 Debarshi Ray 2020-08-10 05:58:45 PDT
Wow! Thanks for tracking it down, Michael.

I also had a trailing colon in my LD_LIBRARY_PATH and was hitting this same bug.