From f14631e46742cb461fd443088c1fc820c0762ace Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= <ablocorrea@hotmail.com>
Date: Tue, 24 Oct 2023 22:06:37 +0200
Subject: [PATCH] community/gnome-session: force bash login shell on workaround

See https://bugzilla.gnome.org/show_bug.cgi?id=736660 for context (you
can probably scroll to the end of the discussion)

In alpine, we compile bash as-is, without
"NON_INTERACTIVE_LOGIN_SHELLS", which is what makes it work in other
distros. Forcing the non-POSIX compliant variation when we know we're
bash should actually work.
---
 community/gnome-session/APKBUILD                |  7 +++++--
 .../gnome-session-bash-login.patch              | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 community/gnome-session/gnome-session-bash-login.patch

diff --git a/community/gnome-session/APKBUILD b/community/gnome-session/APKBUILD
index f8a6b08476b9..0a98a4024690 100644
--- a/community/gnome-session/APKBUILD
+++ b/community/gnome-session/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: team/gnome <ablocorrea@hotmail.com>
 pkgname=gnome-session
 pkgver=45.0
-pkgrel=0
+pkgrel=1
 pkgdesc="GNOME session manager"
 url="https://gitlab.gnome.org/GNOME/gnome-session"
 arch="all"
@@ -31,7 +31,9 @@ makedepends="
 replaces="gnome-shell"
 options="!check" #no tests
 subpackages="$pkgname-lang $pkgname-doc"
-source="https://download.gnome.org/sources/gnome-session/${pkgver%%.*}/gnome-session-$pkgver.tar.xz"
+source="https://download.gnome.org/sources/gnome-session/${pkgver%%.*}/gnome-session-$pkgver.tar.xz
+	gnome-session-bash-login.patch
+"
 
 build() {
 	abuild-meson \
@@ -53,4 +55,5 @@ package() {
 }
 sha512sums="
 3eb3b4b9fcab2ec35bb61bac6257b254f142167250bbc1eb71d46aed350372f8942601c9d5ca5856e8686b53b70321f914cb55f1639daecfe6c61d84cb6d8aba  gnome-session-45.0.tar.xz
+b606c906d2d1b8d34cff2c5a3653ef14c0897a49cecc74c604fddd7d95c4bb181f1027c2fc259d4e3df99278e5f66cd2cc088efbc5f9925d24eb73a7805b144b  gnome-session-bash-login.patch
 "
diff --git a/community/gnome-session/gnome-session-bash-login.patch b/community/gnome-session/gnome-session-bash-login.patch
new file mode 100644
index 000000000000..df2149f020d4
--- /dev/null
+++ b/community/gnome-session/gnome-session-bash-login.patch
@@ -0,0 +1,17 @@
+diff --git i/gnome-session/gnome-session.in w/gnome-session/gnome-session.in
+index ddd1a591..b6dd6cb8 100755
+--- i/gnome-session/gnome-session.in
++++ w/gnome-session/gnome-session.in
+@@ -7,7 +7,11 @@ if [ "x$XDG_SESSION_TYPE" = "xwayland" ] &&
+    ! (echo "$SHELL" | grep -q "false") &&
+    ! (echo "$SHELL" | grep -q "nologin"); then
+   if [ "$1" != '-l' ]; then
+-    exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"
++    if [ "x$SHELL" = "x/bin/bash" ]; then
++      exec bash -c "exec '$SHELL' -l -c '$0 -l $*'"
++    else
++      exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"
++    fi
+   else
+     shift
+   fi
-- 
GitLab