Date: Thursday, February 2, 2023 @ 06:24:35
  Author: ainola
Revision: 1391900

Add patch for user xkb configs with cap_sys_nice

The new CAP_SYS_NICE capability granted to sway interferes with user xkb
configs. A patch has been introduced/merged [1] but has yet to see release.

[1] 
https://github.com/swaywm/sway/commit/2f2cdd60def006f6d3cbe318f9edd7d68fcb239a

Added:
  sway/trunk/sys_nice_user_xkb_configs.patch
Modified:
  sway/trunk/PKGBUILD

---------------------------------+
 PKGBUILD                        |   16 +++++++++++++---
 sys_nice_user_xkb_configs.patch |   27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-02-02 06:07:28 UTC (rev 1391899)
+++ PKGBUILD    2023-02-02 06:24:35 UTC (rev 1391900)
@@ -5,7 +5,7 @@
 pkgname=sway
 pkgver=1.8
 epoch=1
-pkgrel=4
+pkgrel=5
 pkgdesc='Tiling Wayland compositor and replacement for the i3 window manager'
 arch=(x86_64)
 url='https://swaywm.org/'
@@ -45,12 +45,13 @@
 )
 
source=("https://github.com/swaywm/sway/releases/download/$pkgver/sway-$pkgver.tar.gz";
         
"https://github.com/swaywm/sway/releases/download/$pkgver/sway-$pkgver.tar.gz.sig";
-        "50-systemd-user.conf")
+        "50-systemd-user.conf"
+        "sys_nice_user_xkb_configs.patch")
 install=sway.install
 
sha512sums=('0dce213939bb9b38becfac62a22cadf2dc4ed723a8fa06dcaaa3625491722e89dc92bf1734f010d0823513a45d91501c8ba6b4c71d2bf46a1e805938937bab7b'
             'SKIP'
             
'c2b7d808f4231f318e03789015624fd4cf32b81434b15406570b4e144c0defc54e216d881447e6fd9fc18d7da608cccb61c32e0e1fab2f1fe2750acf812d3137'
-            
'7fad859274490af73ab7c1389fbce6351b052e8694ffb20883cf6d1c173e9695316ee46f76de0df13c57fc1daf7f130b82054bdc5f794ac127e7b5f9444bf9c3')
+            
'156719e93d0213d1b54ce6e3a9b2dcc9246da5689dd2d3281546f9c042cbc69072f99b087e112fe777dcd786d2b9d1be1e1c9200feddffb5e2d16f8dfb27515d')
 validpgpkeys=('34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48'  # Simon Ser
               '9DDA3B9FA5D58DD5392C78E652CB6609B22DA89A') # Drew DeVault
 
@@ -57,6 +58,15 @@
 prepare() {
   cd "$pkgname-$pkgver"
 
+  # Enable user xkb configs with cap_sys_nice - otherwise user xkb configs will
+  # break.
+  #
+  # This patch was originally at
+  # 
https://github.com/swaywm/sway/commit/2f2cdd60def006f6d3cbe318f9edd7d68fcb239a.patch
+  # but failed to apply correctly to meson.build. We don't need that part of
+  # the patch so just drop it.
+  patch -p1 < ../sys_nice_user_xkb_configs.patch
+
   # Set the version information to 'Arch Linux' instead of 'makepkg'
   sed -i "s/branch \\\'@1@\\\'/Arch Linux/g" meson.build
 }

Added: sys_nice_user_xkb_configs.patch
===================================================================
--- sys_nice_user_xkb_configs.patch                             (rev 0)
+++ sys_nice_user_xkb_configs.patch     2023-02-02 06:24:35 UTC (rev 1391900)
@@ -0,0 +1,27 @@
+diff --git a/sway/config.c b/sway/config.c
+index 1f2bb68604..f5efa98a8e 100644
+--- a/sway/config.c
++++ b/sway/config.c
+@@ -37,7 +37,7 @@ struct sway_config *config = NULL;
+ 
+ static struct xkb_state *keysym_translation_state_create(
+               struct xkb_rule_names rules) {
+-      struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
++      struct xkb_context *context = 
xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV);
+       struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
+               context,
+               &rules,
+diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
+index 3f4a7289b9..45a588ecbf 100644
+--- a/sway/input/keyboard.c
++++ b/sway/input/keyboard.c
+@@ -754,7 +754,7 @@ static void handle_xkb_context_log(struct xkb_context 
*context,
+ 
+ struct xkb_keymap *sway_keyboard_compile_keymap(struct input_config *ic,
+               char **error) {
+-      struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
++      struct xkb_context *context = 
xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV);
+       if (!sway_assert(context, "cannot create XKB context")) {
+               return NULL;
+       }
+

Reply via email to