Subject: Re: bug#46532: plantuml in pure environment does not find X11

From: Maxime Devos <[email-masked]>
Date: Mon, 15 Feb 2021 16:11:53 +0100

On Mon, 2021-02-15 at 13:52 +0100, Dr. Arne Babenhauserheide wrote:
> Dear Guix hackers,
> 
> when installing plantuml in a pure environment, it throws an java.awt.AWTError: Can't connect to X11 window server using ':1' as the value of the DISPLAY variable.

Is the environment variable XAUTHORITY set?
Compare the value inside the environment and outside the environment.

Perhaps "XAUTHORITY" should be added to %precious-variables in
guix/scripts/environment.scm.  An untested patch is attached,
I'll test it now.

Greetings,
Maxime.
From 7eac4f5a427fb094865ece58c3509606264884b0 Mon Sep 17 00:00:00 2001
From: Maxime Devos <[email-masked]>
Date: Mon, 15 Feb 2021 16:07:37 +0100
Subject: [PATCH] scripts: preserve XAUTHORITY in pure environments

(XXX untested)

Fixes: <https://issues.guix.gnu.org/46532>

* guix/scripts/environment.scm
  (%precious-variables): add 'XAUTHORITY'
---
 guix/scripts/environment.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index f4d12f89bf..656294d29d 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -53,7 +53,7 @@
 
 ;; Protect some env vars from purification.  Borrowed from nix-shell.
 (define %precious-variables
-  '("HOME" "USER" "LOGNAME" "DISPLAY" "TERM" "TZ" "PAGER"))
+  '("HOME" "USER" "LOGNAME" "XAUTHORITY" "DISPLAY" "TERM" "TZ" "PAGER"))
 
 (define %default-shell
   (or (getenv "SHELL") "/bin/sh"))
-- 
2.30.0