gnu: xinit: Fix broken mcookie path in startx.

  • Done
  • quality assurance status badge
Details
2 participants
  • B. Wilson
  • Ludovic Courtès
Owner
unassigned
Submitted by
B. Wilson
Severity
normal

Debbugs page

B
B
B. Wilson wrote on 8 Mar 20:23 -0800
(address . guix-patches@gnu.org)
3TFGIH7KFRA8E.2O2IVAVY05SK6@example.com
The xinit upgrade to 1.4.3 introduced a large upstream changeset that ends up
breaking startx in a couple cases. This commit patches the upstream build to
1) let startx use mcookie, and 2) protect the injected mcookie path.
From daef339310d7fe902623187ea5df19fc797d00d4 Mon Sep 17 00:00:00 2001
From: "B. Wilson" <elaexuotee@wilsonb.com>
Date: Sun, 9 Mar 2025 13:12:55 +0900
Subject: [PATCH] gnu: xinit: Fix broken mcookie path in startx.

* gnu/packages/patches/xinit-startx-mcookie-path.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
* gnu/packages/xorg.scm (xinit)[source]: Add patch.
---
gnu/local.mk | 3 ++-
.../patches/xinit-startx-mcookie-path.patch | 23 +++++++++++++++++++
gnu/packages/xorg.scm | 14 +++++------
3 files changed, 32 insertions(+), 8 deletions(-)
create mode 100644 gnu/packages/patches/xinit-startx-mcookie-path.patch

Toggle diff (78 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 9082ed04bf..5f5e219e85 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2422,7 +2422,8 @@ dist_patch_DATA = \
%D%/packages/patches/xfig-Fix-double-free-when-requesting-MediaBox.patch \
%D%/packages/patches/xfig-Use-pkg-config-to-set-fontconfig-CFLAGS-and-LIBS.patch \
%D%/packages/patches/xfce4-settings-defaults.patch \
- %D%/packages/patches/xgboost-use-system-dmlc-core.patch \
+ %D%/packages/patches/xgboost-use-system-dmlc-core.patch \
+ %D%/packages/patches/xinit-startx-mcookie-path.patch \
%D%/packages/patches/xmonad-dynamic-linking.patch \
%D%/packages/patches/xplanet-1.3.1-cxx11-eof.patch \
%D%/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch \
diff --git a/gnu/packages/patches/xinit-startx-mcookie-path.patch b/gnu/packages/patches/xinit-startx-mcookie-path.patch
new file mode 100644
index 0000000000..050603433b
--- /dev/null
+++ b/gnu/packages/patches/xinit-startx-mcookie-path.patch
@@ -0,0 +1,23 @@
+This patch fixes two bugs in upstream mcookie detection: 1) If mcookie is not
+detected, we still need to set HAS_COOKIE_HANDLER and MK_COOKIE, and 2) the
+value for MK_COOKIE must be a string in order to disallow further preprocessor
+expansions.
+
+In particular for 2, if we fail to surround the path in quotes, our path
+contains the token "linux", which gcc further expands, creating an invalid
+path.
+
+--- a/configure.ac 2025-03-08 16:48:34.476791744 +0900
++++ b/configure.ac 2025-03-08 16:48:30.208791623 +0900
+@@ -157,8 +157,10 @@
+ fi
+ fi
+ if test "x$MCOOKIE" != x ; then
+- STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
++ STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="'"'"'$(MCOOKIE)'"'"'"'
+ AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
++else
++ STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE='
+ fi
+ AC_SUBST(STARTX_COOKIE_FLAGS)
+
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 15ee9edc79..db34a58f6e 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -42,6 +42,7 @@
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2025 宋文武 <iyzsong@envs.net>
+;;; Copyright © 2025 B. Wilson <elaexuotee@wilsonb.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -5898,14 +5899,13 @@ (define-public xinit
version ".tar.xz"))
(sha256
(base32
- "0npx32mi035xkz26gp7raps5xsq4v7rgayy1q794h4d3lqhryh46"))))
+ "0npx32mi035xkz26gp7raps5xsq4v7rgayy1q794h4d3lqhryh46"))
+ (patches
+ (search-patches "xinit-startx-mcookie-path.patch"))))
(build-system gnu-build-system)
- (inputs
- (list xorgproto libx11))
- (native-inputs
- (list pkg-config))
- (propagated-inputs
- (list xauth))
+ (inputs (list libx11 util-linux xorgproto))
+ (native-inputs (list pkg-config))
+ (propagated-inputs (list xauth))
(home-page "https://www.x.org/")
(synopsis "Commands to start the X Window server")
(description
--
2.48.1
L
L
Ludovic Courtès wrote on 19 Mar 03:32 -0700
(name . B. Wilson)(address . elaexuotee@wilsonb.com)(address . 76878-done@debbugs.gnu.org)
87r02tfgzz.fsf@gnu.org
Hi,

B. Wilson <elaexuotee@wilsonb.com> skribis:

Toggle quote (9 lines)
> From daef339310d7fe902623187ea5df19fc797d00d4 Mon Sep 17 00:00:00 2001
> From: "B. Wilson" <elaexuotee@wilsonb.com>
> Date: Sun, 9 Mar 2025 13:12:55 +0900
> Subject: [PATCH] gnu: xinit: Fix broken mcookie path in startx.
>
> * gnu/packages/patches/xinit-startx-mcookie-path.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register patch.
> * gnu/packages/xorg.scm (xinit)[source]: Add patch.

Applied. Thanks for diving in the configure machinery of this thing!
:-)

Ludo’.
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 76878@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 76878
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch