gnome3.gnome-session: prevent crash when launching wayland sessions

gnome-session inherits GDMS PATH, which is at the moment non-functional. In X11
this didn't matter as the `Xsession` wrapper would populate the environment
beforehand. Wayland sessions doesn't source `Xesssion` (duh), so we patch
`bin/gnome-session` to use absolute paths for `grep` and `bash`.

In addition `bin/gnome-session` is a simple wrapper around
`libexec/gnome-session-binary` mostly responsible for sourcing the users profile
before launching the binary. This made our wrapping of `bin/gnome-session`
ineffective on wayland as the profile would reset the environment. Simply wrap
`libexec/gnome-session-binary` instead.
This commit is contained in:
Tor Hedin Brønner 2018-08-04 15:17:32 +02:00
parent 9895ce24b4
commit d54bfa8f41
2 changed files with 24 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ fetchurl, stdenv, substituteAll, meson, ninja, pkgconfig, gnome3, glib, gtk, gsettings-desktop-schemas
, gnome-desktop, dbus, json-glib, libICE, xmlto, docbook_xsl, docbook_xml_dtd_412, python3
, libxslt, gettext, makeWrapper, systemd, xorg, epoxy }:
, libxslt, gettext, makeWrapper, systemd, xorg, epoxy, gnugrep, bash }:
stdenv.mkDerivation rec {
name = "gnome-session-${version}";
@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
src = ./fix-paths.patch;
gsettings = "${glib.bin}/bin/gsettings";
dbusLaunch = "${dbus.lib}/bin/dbus-launch";
grep = "${gnugrep}/bin/grep";
bash = "${bash}/bin/bash";
})
];
@ -37,8 +39,11 @@ stdenv.mkDerivation rec {
patchShebangs meson_post_install.py
'';
# `bin/gnome-session` will reset the environment when run in wayland, we
# therefor wrap `libexec/gnome-session-binary` instead which is the actual
# binary needing wrapping
preFixup = ''
wrapProgram "$out/bin/gnome-session" \
wrapProgram "$out/libexec/gnome-session-binary" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--suffix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
--suffix XDG_DATA_DIRS : "${gnome3.gnome-shell}/share"\

View File

@ -1,6 +1,22 @@
--- a/gnome-session/gnome-session.in
+++ b/gnome-session/gnome-session.in
@@ -13,7 +13,7 @@ if [ "x$XDG_SESSION_TYPE" = "xwayland" ] &&
@@ -3,11 +3,11 @@
if [ "x$XDG_SESSION_TYPE" = "xwayland" ] &&
[ "x$XDG_SESSION_CLASS" != "xgreeter" ] &&
[ -n "$SHELL" ] &&
- grep -q "$SHELL" /etc/shells &&
- ! (echo "$SHELL" | grep -q "false") &&
- ! (echo "$SHELL" | grep -q "nologin"); then
+ @grep@ -q "$SHELL" /etc/shells &&
+ ! (echo "$SHELL" | @grep@ -q "false") &&
+ ! (echo "$SHELL" | @grep@ -q "nologin"); then
if [ "$1" != '-l' ]; then
- exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"
+ exec @bash@ -c "exec -l '$SHELL' -c '$0 -l $*'"
else
shift
fi
@@ -13,7 +13,7 @@
fi
fi