unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
@ 2016-11-25 19:08 John Darrington
  2016-11-25 19:08 ` [PATCH 2/4] gnu: Add editres John Darrington
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: John Darrington @ 2016-11-25 19:08 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/system.scm (operating-system-etc-service): Add new environment variable:
XFILESEARCHPATH
---
 doc/guix.texi  | 30 ++++++++++++++++++++++++++++++
 gnu/system.scm | 25 +++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index e64c361..9d133bb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1209,6 +1209,36 @@ data in the right format.
 This is important because the locale data format used by different libc
 versions may be incompatible.
 
+@subsection X Window System
+@vindex XFILESEARCHPATH
+@vindex @code{Xt}
+@vindex X Toolkit Intrinsics
+@vindex @command{xterm}
+
+If you intend to use X Toolkit Intrinsics client applications such
+as @command{xterm} then you should define the @code{XFILESEARCHPATH}
+environment variable:
+
+@example
+$ export XFILESEARCHPATH="$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:
+  $HOME/.guix-profile/share/X11/%l/%T/%N%C%S:
+  $HOME/.guix-profile/share/X11/%T/%N%C%S:
+  $HOME/.guix-profile/share/X11/%L/%T/%N%S:
+  $HOME/.guix-profile/share/X11/%l/%T/%N%S:
+  $HOME/.guix-profile/share/X11/%T/%N%S:
+  $HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:
+  $HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:
+  $HOME/.guix-profile/lib/X11/%T/%N%C%S:
+  $HOME/.guix-profile/lib/X11/%L/%T/%N%S:
+  $HOME/.guix-profile/lib/X11/%l/%T/%N%S:
+  $HOME/.guix-profile/lib/X11/%T/%N%S"
+@end example
+
+@noindent
+This (rather long) definition provides the search path which the @code{Xt}
+library uses to search for resource files and other files needed for correct
+running of applications.
+
 @subsection X11 Fonts
 
 @cindex fonts
diff --git a/gnu/system.scm b/gnu/system.scm
index 4e57f97..729a1a0 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -419,6 +419,31 @@ export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/m
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
 export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
 export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
+export XFILESEARCHPATH=\"$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:\\
+$HOME/.guix-profile/share/X11/%l/%T/%N%C%S:\\
+$HOME/.guix-profile/share/X11/%T/%N%C%S:\\
+$HOME/.guix-profile/share/X11/%L/%T/%N%S:\\
+$HOME/.guix-profile/share/X11/%l/%T/%N%S:\\
+$HOME/.guix-profile/share/X11/%T/%N%S:\\
+$HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:\\
+$HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:\\
+$HOME/.guix-profile/lib/X11/%T/%N%C%S:\\
+$HOME/.guix-profile/lib/X11/%L/%T/%N%S:\\
+$HOME/.guix-profile/lib/X11/%l/%T/%N%S:\\
+$HOME/.guix-profile/lib/X11/%T/%N%S:\\
+/run/current-system/profile/share/X11/%L/%T/%N%C%S:\\
+/run/current-system/profile/share/X11/%l/%T/%N%C%S:\\
+/run/current-system/profile/share/X11/%T/%N%C%S:\\
+/run/current-system/profile/share/X11/%L/%T/%N%S:\\
+/run/current-system/profile/share/X11/%l/%T/%N%S:\\
+/run/current-system/profile/share/X11/%T/%N%S:\\
+/run/current-system/profile/lib/X11/%L/%T/%N%C%S:\\
+/run/current-system/profile/lib/X11/%l/%T/%N%C%S:\\
+/run/current-system/profile/lib/X11/%T/%N%C%S:\\
+/run/current-system/profile/lib/X11/%L/%T/%N%S:\\
+/run/current-system/profile/lib/X11/%l/%T/%N%S:\\
+/run/current-system/profile/lib/X11/%T/%N%S\"
+
 
 # Ignore the default value of 'PATH'.
 unset PATH
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] gnu: Add editres.
  2016-11-25 19:08 [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment John Darrington
@ 2016-11-25 19:08 ` John Darrington
  2016-11-27 21:22   ` Ludovic Courtès
  2016-11-25 19:08 ` [PATCH 3/4] gnu: Remove wrappers from xfd and xfontsel John Darrington
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: John Darrington @ 2016-11-25 19:08 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/xorg.scm (editres): New variable.
---
 gnu/packages/xorg.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 9f9549b..4e79d2d 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -335,6 +336,44 @@ provided.")
                                 "See 'dri3proto.h' in the distribution."))))
 
 
+(define-public editres
+  (package
+    (name "editres")
+    (version "1.0.6")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "mirror://xorg/individual/app/" name "-"
+               version
+               ".tar.bz2"))
+        (sha256
+         (base32
+          "1w2d5hb5pw9ii2jlf4yjlp899402zfwc8hdkpdr3i1fy1cjd2riv"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--with-appdefaultdir="
+                            %output "/lib/X11/app-defaults"))))
+    (inputs
+     `(("libxaw" ,libxaw)
+       ("libxmu" ,libxmu)
+       ("libxt" ,libxt)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (home-page "https://www.x.org/wiki/")
+    (synopsis "Tool to browse and edit X Toolkit resource specifications")
+    (description
+     "Editres is a tool that allows users and application developers to view
+the full widget hierarchy of any X Toolkit application that speaks the Editres
+protocol.  In addition, editres will help the user construct resource
+specifications, allow the user to apply the resource to the application and
+view the results dynamically.  Once the user is happy with a resource
+specification editres will append the resource string to the user's X
+Resources file.")
+    (license license:x11)))
+
+
 (define-public encodings
   (package
     (name "encodings")
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] gnu: Remove wrappers from xfd and xfontsel.
  2016-11-25 19:08 [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment John Darrington
  2016-11-25 19:08 ` [PATCH 2/4] gnu: Add editres John Darrington
@ 2016-11-25 19:08 ` John Darrington
  2016-11-25 19:08 ` [PATCH 4/4] gnu: Xfig: Set XAPPLOADDIR John Darrington
  2016-11-27 21:22 ` [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment Ludovic Courtès
  3 siblings, 0 replies; 13+ messages in thread
From: John Darrington @ 2016-11-25 19:08 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/xorg.scm (xfd, xfontsel) [arguments]: Remove wrappers.
  These are no longer necessary since we set XFILESEARCHPATH.
---
 gnu/packages/xorg.scm | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 4e79d2d..fb2f61e 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -3983,21 +3983,12 @@ protocol.")
      ;; By default, it tries to install XFontSel file in
      ;; "/gnu/store/<libxt>/share/X11/app-defaults": it defines this
      ;; directory from 'libxt' (using 'pkg-config').  To put this file
-     ;; inside output dir and to use it properly, we need to configure
-     ;; --with-appdefaultdir and to wrap 'xfontsel' binary.
+     ;; inside output dir we need to configure --with-appdefaultdir
      (let ((app-defaults-dir "/share/X11/app-defaults"))
        `(#:configure-flags
          (list (string-append "--with-appdefaultdir="
-                              %output ,app-defaults-dir))
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'install 'wrap-xfontsel
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (wrap-program (string-append out "/bin/xfontsel")
-                   `("XAPPLRESDIR" =
-                     (,(string-append out ,app-defaults-dir)))))))))))
-    (inputs
+                              %output ,app-defaults-dir)))))
+     (inputs
      `(("libx11" ,libx11)
        ("libxaw" ,libxaw)
        ("libxmu" ,libxmu)
@@ -4030,15 +4021,7 @@ Font Description (XLFD) full name for a font.")
      (let ((app-defaults-dir "/share/X11/app-defaults"))
        `(#:configure-flags
          (list (string-append "--with-appdefaultdir="
-                              %output ,app-defaults-dir))
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'install 'wrap-xfd
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (wrap-program (string-append out "/bin/xfd")
-                   `("XAPPLRESDIR" =
-                     (,(string-append out ,app-defaults-dir)))))))))))
+                              %output ,app-defaults-dir)))))
     (inputs
      `(("fontconfig" ,fontconfig)
        ("libx11" ,libx11)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] gnu: Xfig: Set XAPPLOADDIR.
  2016-11-25 19:08 [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment John Darrington
  2016-11-25 19:08 ` [PATCH 2/4] gnu: Add editres John Darrington
  2016-11-25 19:08 ` [PATCH 3/4] gnu: Remove wrappers from xfd and xfontsel John Darrington
@ 2016-11-25 19:08 ` John Darrington
  2016-11-27 21:22 ` [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment Ludovic Courtès
  3 siblings, 0 replies; 13+ messages in thread
From: John Darrington @ 2016-11-25 19:08 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/xfig.scm (xfig) [arguments]: Remove wrapper.  Set XAPPLOADDIR.
---
 gnu/packages/xfig.scm | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/xfig.scm b/gnu/packages/xfig.scm
index 6436e52..6ad22b1 100644
--- a/gnu/packages/xfig.scm
+++ b/gnu/packages/xfig.scm
@@ -85,7 +85,10 @@
               (string-append front out "/lib"))
              (("(XFIGDOCDIR = )[[:graph:]]*" _ front)
               (string-append front out "/share/doc"))
-             (("XCOMM USEINLINE") "USEINLINE"))
+             (("XCOMM USEINLINE") "USEINLINE")
+             (("XCOMM XAPPLOADDIR=")
+              (string-append "XAPPLOADDIR=" %output "lib")))
+
            ;; The -a argument is required in order to pick up the correct paths
            ;; to several X header files.
            (zero? (system* "xmkmf" "-a"))
@@ -119,14 +122,7 @@
                   (close-pipe in)
                   (close-port out)))
               (zero? (system* "make" "install.doc"))))
-          (alist-cons-after
-           'install 'wrap-xfig
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (wrap-program (string-append out "/bin/xfig")
-                             `("XAPPLRESDIR" suffix
-                               (,(string-append out "/etc/X11/app-defaults"))))))
-           %standard-phases))))))
+           %standard-phases)))))
     (home-page "http://xfig.org/")
     (synopsis "Interactive drawing tool")
     (description
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-25 19:08 [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment John Darrington
                   ` (2 preceding siblings ...)
  2016-11-25 19:08 ` [PATCH 4/4] gnu: Xfig: Set XAPPLOADDIR John Darrington
@ 2016-11-27 21:22 ` Ludovic Courtès
  2016-11-28 13:19   ` John Darrington
  3 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2016-11-27 21:22 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hello!

John Darrington <jmd@gnu.org> skribis:

> * gnu/system.scm (operating-system-etc-service): Add new environment variable:
> XFILESEARCHPATH
> ---
>  doc/guix.texi  | 30 ++++++++++++++++++++++++++++++
>  gnu/system.scm | 25 +++++++++++++++++++++++++
>  2 files changed, 55 insertions(+)

The guix.texi change is missing from the log.

> diff --git a/doc/guix.texi b/doc/guix.texi
> index e64c361..9d133bb 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -1209,6 +1209,36 @@ data in the right format.
>  This is important because the locale data format used by different libc
>  versions may be incompatible.
>  
> +@subsection X Window System
> +@vindex XFILESEARCHPATH
> +@vindex @code{Xt}
> +@vindex X Toolkit Intrinsics
> +@vindex @command{xterm}
> +
> +If you intend to use X Toolkit Intrinsics client applications such
> +as @command{xterm} then you should define the @code{XFILESEARCHPATH}
> +environment variable:
> +
> +@example
> +$ export XFILESEARCHPATH="$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:
> +  $HOME/.guix-profile/share/X11/%l/%T/%N%C%S:
> +  $HOME/.guix-profile/share/X11/%T/%N%C%S:
> +  $HOME/.guix-profile/share/X11/%L/%T/%N%S:
> +  $HOME/.guix-profile/share/X11/%l/%T/%N%S:
> +  $HOME/.guix-profile/share/X11/%T/%N%S:
> +  $HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:
> +  $HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:
> +  $HOME/.guix-profile/lib/X11/%T/%N%C%S:
> +  $HOME/.guix-profile/lib/X11/%L/%T/%N%S:
> +  $HOME/.guix-profile/lib/X11/%l/%T/%N%S:
> +  $HOME/.guix-profile/lib/X11/%T/%N%S"
> +@end example

Seriously?!  I mean, we can reasonably ask people to do that, can we?
Is there another way?

Naive approach to look for candidate variables:

--8<---------------cut here---------------start------------->8---
$ ltrace -e getenv xterm 2>&1 |grep '"X'|sort -u
libX11.so.6->getenv("XCOMPOSECACHE")             = nil
libX11.so.6->getenv("XCOMPOSEFILE")              = nil
libX11.so.6->getenv("XKB_DEBUG")                 = nil
libX11.so.6->getenv("XKB_DISABLE")               = nil
libX11.so.6->getenv("XKEYSYMDB")                 = nil
libX11.so.6->getenv("XLIBBUFFERSIZE")            = nil
libX11.so.6->getenv("XLIB_SKIP_ARGB_VISUALS")    = nil
libX11.so.6->getenv("XLOCALEDIR")                = nil
libX11.so.6->getenv("XMODIFIERS")                = nil
libXau.so.6->getenv("XAUTHORITY")                = "/home/ludo/.Xauthority"
libXt.so.6->getenv("XAPPLRESDIR")                = nil
libXt.so.6->getenv("XENVIRONMENT")               = nil
libXt.so.6->getenv("XFILESEARCHPATH")            = nil
libXt.so.6->getenv("XTAPPPEEKEVENT_SKIPTIMER")   = nil
libXt.so.6->getenv("XUSERFILESEARCHPATH")        = nil
--8<---------------cut here---------------end--------------->8---

Would one of these work better?  :-)

> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -419,6 +419,31 @@ export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/m
>  export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
>  export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
>  export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
> +export XFILESEARCHPATH=\"$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:\\
> +$HOME/.guix-profile/share/X11/%l/%T/%N%C%S:\\
> +$HOME/.guix-profile/share/X11/%T/%N%C%S:\\
> +$HOME/.guix-profile/share/X11/%L/%T/%N%S:\\
> +$HOME/.guix-profile/share/X11/%l/%T/%N%S:\\
> +$HOME/.guix-profile/share/X11/%T/%N%S:\\
> +$HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:\\
> +$HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:\\
> +$HOME/.guix-profile/lib/X11/%T/%N%C%S:\\
> +$HOME/.guix-profile/lib/X11/%L/%T/%N%S:\\
> +$HOME/.guix-profile/lib/X11/%l/%T/%N%S:\\
> +$HOME/.guix-profile/lib/X11/%T/%N%S:\\
> +/run/current-system/profile/share/X11/%L/%T/%N%C%S:\\
> +/run/current-system/profile/share/X11/%l/%T/%N%C%S:\\
> +/run/current-system/profile/share/X11/%T/%N%C%S:\\
> +/run/current-system/profile/share/X11/%L/%T/%N%S:\\
> +/run/current-system/profile/share/X11/%l/%T/%N%S:\\
> +/run/current-system/profile/share/X11/%T/%N%S:\\
> +/run/current-system/profile/lib/X11/%L/%T/%N%C%S:\\
> +/run/current-system/profile/lib/X11/%l/%T/%N%C%S:\\
> +/run/current-system/profile/lib/X11/%T/%N%C%S:\\
> +/run/current-system/profile/lib/X11/%L/%T/%N%S:\\
> +/run/current-system/profile/lib/X11/%l/%T/%N%S:\\
> +/run/current-system/profile/lib/X11/%T/%N%S\"

That’s unreasonable IMO.

Is this motivated by the broken ctrl-click in xterm?  That thing used to
work, I wonder what happened.

Thanks for investigating!

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] gnu: Add editres.
  2016-11-25 19:08 ` [PATCH 2/4] gnu: Add editres John Darrington
@ 2016-11-27 21:22   ` Ludovic Courtès
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2016-11-27 21:22 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/xorg.scm (editres): New variable.

LGTM!

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-27 21:22 ` [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment Ludovic Courtès
@ 2016-11-28 13:19   ` John Darrington
  2016-11-29 14:34     ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: John Darrington @ 2016-11-28 13:19 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 7262 bytes --]

    
    > * gnu/system.scm (operating-system-etc-service): Add new environment
    variable:
    
    The guix.texi change is missing from the log.

Thanks for noticing.
    
    > diff --git a/doc/guix.texi b/doc/guix.texi
    > index e64c361..9d133bb 100644
    > --- a/doc/guix.texi
    > +++ b/doc/guix.texi
    > @@ -1209,6 +1209,36 @@ data in the right format.
    >  This is important because the locale data format used by different libc
    >  versions may be incompatible.
    >  
    > address@hidden X Window System
    > address@hidden XFILESEARCHPATH
    > address@hidden @code{Xt}
    > address@hidden X Toolkit Intrinsics
    > address@hidden @command{xterm}
    > +
    > +If you intend to use X Toolkit Intrinsics client applications such
    > +as @command{xterm} then you should define the @code{XFILESEARCHPATH}
    > +environment variable:
    > +
    > address@hidden
    > +$ export XFILESEARCHPATH="$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:
    > +  $HOME/.guix-profile/share/X11/%l/%T/%N%C%S:
    > +  $HOME/.guix-profile/share/X11/%T/%N%C%S:
    > +  $HOME/.guix-profile/share/X11/%L/%T/%N%S:
    > +  $HOME/.guix-profile/share/X11/%l/%T/%N%S:
    > +  $HOME/.guix-profile/share/X11/%T/%N%S:
    > +  $HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:
    > +  $HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:
    > +  $HOME/.guix-profile/lib/X11/%T/%N%C%S:
    > +  $HOME/.guix-profile/lib/X11/%L/%T/%N%S:
    > +  $HOME/.guix-profile/lib/X11/%l/%T/%N%S:
    > +  $HOME/.guix-profile/lib/X11/%T/%N%S"
    > address@hidden example
    
    Seriously?!  I mean, we can reasonably ask people to do that, can we?
    Is there another way?

*shrug?* It's one more variable to set. Granted it's a long one.  But it's
not *us* that's asking them to do it.  We are merely passing along advice
from the Xt lib developers (see below).   If people want to use Xt then
that's what they're supposed to do.

We could do is to provide a script for the user to source or copy to her
.profile
    
    Naive approach to look for candidate variables:
    
    --8<---------------cut here---------------start------------->8---
    $ ltrace -e getenv xterm 2>&1 |grep '"X'|sort -u
    libX11.so.6->getenv("XCOMPOSECACHE")             = nil
    libX11.so.6->getenv("XCOMPOSEFILE")              = nil
    libX11.so.6->getenv("XKB_DEBUG")                 = nil
    libX11.so.6->getenv("XKB_DISABLE")               = nil
    libX11.so.6->getenv("XKEYSYMDB")                 = nil
    libX11.so.6->getenv("XLIBBUFFERSIZE")            = nil
    libX11.so.6->getenv("XLIB_SKIP_ARGB_VISUALS")    = nil
    libX11.so.6->getenv("XLOCALEDIR")                = nil
    libX11.so.6->getenv("XMODIFIERS")                = nil
    libXau.so.6->getenv("XAUTHORITY")                = "/home/ludo/.Xauthority"
    libXt.so.6->getenv("XAPPLRESDIR")                = nil
    libXt.so.6->getenv("XENVIRONMENT")               = nil
    libXt.so.6->getenv("XFILESEARCHPATH")            = nil
    libXt.so.6->getenv("XTAPPPEEKEVENT_SKIPTIMER")   = nil
    libXt.so.6->getenv("XUSERFILESEARCHPATH")        = nil
    --8<---------------cut here---------------end--------------->8---
    
    Would one of these work better?  :-)

No. See below.

    > +export XFILESEARCHPATH=\"$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:\\
    > +$HOME/.guix-profile/share/X11/%l/%T/%N%C%S:\\
    > +$HOME/.guix-profile/share/X11/%T/%N%C%S:\\
    > +$HOME/.guix-profile/share/X11/%L/%T/%N%S:\\
    > +$HOME/.guix-profile/share/X11/%l/%T/%N%S:\\
    > +$HOME/.guix-profile/share/X11/%T/%N%S:\\
    > +$HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:\\
    > +$HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:\\
    > +$HOME/.guix-profile/lib/X11/%T/%N%C%S:\\
    > +$HOME/.guix-profile/lib/X11/%L/%T/%N%S:\\
    > +$HOME/.guix-profile/lib/X11/%l/%T/%N%S:\\
    > +$HOME/.guix-profile/lib/X11/%T/%N%S:\\
    > +/run/current-system/profile/share/X11/%L/%T/%N%C%S:\\
    > +/run/current-system/profile/share/X11/%l/%T/%N%C%S:\\
    > +/run/current-system/profile/share/X11/%T/%N%C%S:\\
    > +/run/current-system/profile/share/X11/%L/%T/%N%S:\\
    > +/run/current-system/profile/share/X11/%l/%T/%N%S:\\
    > +/run/current-system/profile/share/X11/%T/%N%S:\\
    > +/run/current-system/profile/lib/X11/%L/%T/%N%C%S:\\
    > +/run/current-system/profile/lib/X11/%l/%T/%N%C%S:\\
    > +/run/current-system/profile/lib/X11/%T/%N%C%S:\\
    > +/run/current-system/profile/lib/X11/%L/%T/%N%S:\\
    > +/run/current-system/profile/lib/X11/%l/%T/%N%S:\\
    > +/run/current-system/profile/lib/X11/%T/%N%S\"
    
    That’s unreasonable IMO.

This is merely the default value that the Xt library sets, but I
have simply substituted "/usr" with "$HOME/.guix-profile" and
repeated it substituting "/run/current-system/profile".
It is a large string, but why is that a problem?

We can cut down on the size of this string iff we can somehow
guarantee that no package ever ships a file in any of those locations.

Some "solutions" (in my order of preference) are:

* The size of the above list can be halved, by dropping either the
.../lib/... or the .../share/... items - we just have to then make
sure that no package ships resource files in the one we drop.  Historically,
resource files were always in .../lib (as still are all official
sources from x.org) but recently third party packages have started
putting them in .../share.

* I *think* we could also get away with further reducing the set to 
    "$HOME/.guix-profile/lib/X11/%T/%N%S:
    /run/current-system/profile/lib/X11/%T/%N%S"
because, all the Xt dependent packages I've seen so far, put their
resource files there.  However, we cannot know what might get added
in the future.

* Hack the hard coded defaults in the libXt source to use the profile
settings instead of /usr

* Do what we had before:  Wrap *every* program which uses libXt in
a script setting XAPPLRESDIR - This is sure to annoy users because
it would override any XUSERFILESEARCHPATH they had set themselves.

    
    Is this motivated by the broken ctrl-click in xterm?  That thing used to
    work, I wonder what happened.

Xterm has never worked properly for me under GuixSD.  It "worked" under
Guix on Debian, presumably because it found the resource files from
the native installation.

Xterm not working was what prompted me to find out the cause.
But it will affect all and every package which provides X resource
files as a shipped file.

Anyway my general opinion is, that I agree that the value of this variable
is rather long, but:
1. I don't see why that is a problem.
2. It is how the X Consortium intends and recommends it to be used.
3. A competent user will not be intimidated by it.
4. A naive user will never be aware of it anyway.


For background information, see:

* http://www.faqs.org/faqs/Xt-FAQ
* The man page for XtResolvePathname
* The file specs/CH11.xml in the libXt source.

J'

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-28 13:19   ` John Darrington
@ 2016-11-29 14:34     ` Ludovic Courtès
  2016-11-29 18:16       ` John Darrington
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2016-11-29 14:34 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

>     
>     > * gnu/system.scm (operating-system-etc-service): Add new environment
>     variable:
>     
>     The guix.texi change is missing from the log.
>
> Thanks for noticing.
>     
>     > diff --git a/doc/guix.texi b/doc/guix.texi
>     > index e64c361..9d133bb 100644
>     > --- a/doc/guix.texi
>     > +++ b/doc/guix.texi
>     > @@ -1209,6 +1209,36 @@ data in the right format.
>     >  This is important because the locale data format used by different libc
>     >  versions may be incompatible.
>     >  
>     > address@hidden X Window System
>     > address@hidden XFILESEARCHPATH
>     > address@hidden @code{Xt}
>     > address@hidden X Toolkit Intrinsics
>     > address@hidden @command{xterm}
>     > +
>     > +If you intend to use X Toolkit Intrinsics client applications such
>     > +as @command{xterm} then you should define the @code{XFILESEARCHPATH}
>     > +environment variable:
>     > +
>     > address@hidden
>     > +$ export XFILESEARCHPATH="$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:
>     > +  $HOME/.guix-profile/share/X11/%l/%T/%N%C%S:
>     > +  $HOME/.guix-profile/share/X11/%T/%N%C%S:
>     > +  $HOME/.guix-profile/share/X11/%L/%T/%N%S:
>     > +  $HOME/.guix-profile/share/X11/%l/%T/%N%S:
>     > +  $HOME/.guix-profile/share/X11/%T/%N%S:
>     > +  $HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:
>     > +  $HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:
>     > +  $HOME/.guix-profile/lib/X11/%T/%N%C%S:
>     > +  $HOME/.guix-profile/lib/X11/%L/%T/%N%S:
>     > +  $HOME/.guix-profile/lib/X11/%l/%T/%N%S:
>     > +  $HOME/.guix-profile/lib/X11/%T/%N%S"
>     > address@hidden example
>     
>     Seriously?!  I mean, we can reasonably ask people to do that, can we?
>     Is there another way?
>
> *shrug?* It's one more variable to set. Granted it's a long one.  But it's
> not *us* that's asking them to do it.  We are merely passing along advice
> from the Xt lib developers (see below).   If people want to use Xt then
> that's what they're supposed to do.

Fortunately people don’t “want” to use Xt nowadays.  ;-)

At any rate, I’m surprised this is so involved.

>     > +export XFILESEARCHPATH=\"$HOME/.guix-profile/share/X11/%L/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/share/X11/%l/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/share/X11/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/share/X11/%L/%T/%N%S:\\
>     > +$HOME/.guix-profile/share/X11/%l/%T/%N%S:\\
>     > +$HOME/.guix-profile/share/X11/%T/%N%S:\\
>     > +$HOME/.guix-profile/lib/X11/%L/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/lib/X11/%l/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/lib/X11/%T/%N%C%S:\\
>     > +$HOME/.guix-profile/lib/X11/%L/%T/%N%S:\\
>     > +$HOME/.guix-profile/lib/X11/%l/%T/%N%S:\\
>     > +$HOME/.guix-profile/lib/X11/%T/%N%S:\\
>     > +/run/current-system/profile/share/X11/%L/%T/%N%C%S:\\
>     > +/run/current-system/profile/share/X11/%l/%T/%N%C%S:\\
>     > +/run/current-system/profile/share/X11/%T/%N%C%S:\\
>     > +/run/current-system/profile/share/X11/%L/%T/%N%S:\\
>     > +/run/current-system/profile/share/X11/%l/%T/%N%S:\\
>     > +/run/current-system/profile/share/X11/%T/%N%S:\\
>     > +/run/current-system/profile/lib/X11/%L/%T/%N%C%S:\\
>     > +/run/current-system/profile/lib/X11/%l/%T/%N%C%S:\\
>     > +/run/current-system/profile/lib/X11/%T/%N%C%S:\\
>     > +/run/current-system/profile/lib/X11/%L/%T/%N%S:\\
>     > +/run/current-system/profile/lib/X11/%l/%T/%N%S:\\
>     > +/run/current-system/profile/lib/X11/%T/%N%S\"
>     
>     That’s unreasonable IMO.
>
> This is merely the default value that the Xt library sets, but I
> have simply substituted "/usr" with "$HOME/.guix-profile" and
> repeated it substituting "/run/current-system/profile".
> It is a large string, but why is that a problem?

It’s ugly, there’s duplication, and hackers will not dare to touch it.

> We can cut down on the size of this string iff we can somehow
> guarantee that no package ever ships a file in any of those locations.
>
> Some "solutions" (in my order of preference) are:
>
> * The size of the above list can be halved, by dropping either the
> .../lib/... or the .../share/... items - we just have to then make
> sure that no package ships resource files in the one we drop.  Historically,
> resource files were always in .../lib (as still are all official
> sources from x.org) but recently third party packages have started
> putting them in .../share.
>
> * I *think* we could also get away with further reducing the set to 
>     "$HOME/.guix-profile/lib/X11/%T/%N%S:
>     /run/current-system/profile/lib/X11/%T/%N%S"
> because, all the Xt dependent packages I've seen so far, put their
> resource files there.  However, we cannot know what might get added
> in the future.

Right, if we do both, that’s already much better.

> * Hack the hard coded defaults in the libXt source to use the profile
> settings instead of /usr

Maybe we should just do that, no?  It’d be a local change, it would
achieve the same effect, and it would provide a good default.

WDYT?

I suppose there’s trickiness due to the fact that it’s C and we have to
concatenate strings…

> * Do what we had before:  Wrap *every* program which uses libXt in
> a script setting XAPPLRESDIR - This is sure to annoy users because
> it would override any XUSERFILESEARCHPATH they had set themselves.

Doesn’t sound great.

>     Is this motivated by the broken ctrl-click in xterm?  That thing used to
>     work, I wonder what happened.
>
> Xterm has never worked properly for me under GuixSD.  It "worked" under
> Guix on Debian, presumably because it found the resource files from
> the native installation.
>
> Xterm not working was what prompted me to find out the cause.
> But it will affect all and every package which provides X resource
> files as a shipped file.
>
> Anyway my general opinion is, that I agree that the value of this variable
> is rather long, but:
> 1. I don't see why that is a problem.
> 2. It is how the X Consortium intends and recommends it to be used.
> 3. A competent user will not be intimidated by it.
> 4. A naive user will never be aware of it anyway.
>
>
> For background information, see:
>
> * http://www.faqs.org/faqs/Xt-FAQ
> * The man page for XtResolvePathname
> * The file specs/CH11.xml in the libXt source.

OK.  Thanks for the info and everything!

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-29 14:34     ` Ludovic Courtès
@ 2016-11-29 18:16       ` John Darrington
  2016-11-29 21:42         ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: John Darrington @ 2016-11-29 18:16 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2577 bytes --]

On Tue, Nov 29, 2016 at 03:34:11PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:

     > We can cut down on the size of this string iff we can somehow
     > guarantee that no package ever ships a file in any of those locations.
     >
     > Some "solutions" (in my order of preference) are:
     >
     > * The size of the above list can be halved, by dropping either the
     > .../lib/... or the .../share/... items - we just have to then make
     > sure that no package ships resource files in the one we drop.  Historically,
     > resource files were always in .../lib (as still are all official
     > sources from x.org) but recently third party packages have started
     > putting them in .../share.
     >
     > * I *think* we could also get away with further reducing the set to 
     >     "$HOME/.guix-profile/lib/X11/%T/%N%S:
     >     /run/current-system/profile/lib/X11/%T/%N%S"
     > because, all the Xt dependent packages I've seen so far, put their
     > resource files there.  However, we cannot know what might get added
     > in the future.
     
     Right, if we do both, that???s already much better.
     
     > * Hack the hard coded defaults in the libXt source to use the profile
     > settings instead of /usr
     
     Maybe we should just do that, no?  It???d be a local change, it would
     achieve the same effect, and it would provide a good default.
     
     WDYT?

It sounds unreliable to me.  What would we set it to?
$GUIX_PROFILE/...  $HOME/.guix-profile/... /run/current-system/profile/...
There's no guarantee that the current profile is any of those.

Something similar to the first solution seems prefereable to me.  Maybe:

 Set XFILESEARCHPATH to "$HOME/.guix-profile/lib/X11/%T/%N%S:/run/current-system/profile/lib/X11/%T/%N%S"
  (we can substitute "share" for "lib" if we want to keep the FHS people happy).

 Then we audit all users of libxt to make sure they put their resource files in lib/X11/app-defaults.
 Most packages have a --with-app-defaults configure option (which currently we are in many cases
 either not using or misusing).

 We could also consider adding a build stage to make sure that packages which depend on libXt put
 their resource files in the "right" place.

     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-29 18:16       ` John Darrington
@ 2016-11-29 21:42         ` Ludovic Courtès
  2016-11-30  5:36           ` John Darrington
  2016-12-02 16:25           ` [PATCH] gnu: Patch libxt's default search path John Darrington
  0 siblings, 2 replies; 13+ messages in thread
From: Ludovic Courtès @ 2016-11-29 21:42 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Tue, Nov 29, 2016 at 03:34:11PM +0100, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>
>      > We can cut down on the size of this string iff we can somehow
>      > guarantee that no package ever ships a file in any of those locations.
>      >
>      > Some "solutions" (in my order of preference) are:
>      >
>      > * The size of the above list can be halved, by dropping either the
>      > .../lib/... or the .../share/... items - we just have to then make
>      > sure that no package ships resource files in the one we drop.  Historically,
>      > resource files were always in .../lib (as still are all official
>      > sources from x.org) but recently third party packages have started
>      > putting them in .../share.
>      >
>      > * I *think* we could also get away with further reducing the set to 
>      >     "$HOME/.guix-profile/lib/X11/%T/%N%S:
>      >     /run/current-system/profile/lib/X11/%T/%N%S"
>      > because, all the Xt dependent packages I've seen so far, put their
>      > resource files there.  However, we cannot know what might get added
>      > in the future.
>      
>      Right, if we do both, that???s already much better.
>      
>      > * Hack the hard coded defaults in the libXt source to use the profile
>      > settings instead of /usr
>      
>      Maybe we should just do that, no?  It???d be a local change, it would
>      achieve the same effect, and it would provide a good default.
>      
>      WDYT?
>
> It sounds unreliable to me.  What would we set it to?
> $GUIX_PROFILE/...  $HOME/.guix-profile/... /run/current-system/profile/...
> There's no guarantee that the current profile is any of those.

Maybe, but that would have the same effect as setting the environment
variable to that value, wouldn’t it?

> Something similar to the first solution seems prefereable to me.  Maybe:
>
>  Set XFILESEARCHPATH to "$HOME/.guix-profile/lib/X11/%T/%N%S:/run/current-system/profile/lib/X11/%T/%N%S"
>   (we can substitute "share" for "lib" if we want to keep the FHS people happy).

How did you manage to shorten it that much?  It’s much less intimidating
now.  :-)

>  Then we audit all users of libxt to make sure they put their resource files in lib/X11/app-defaults.
>  Most packages have a --with-app-defaults configure option (which currently we are in many cases
>  either not using or misusing).
>
>  We could also consider adding a build stage to make sure that packages which depend on libXt put
>  their resource files in the "right" place.

Sounds reasonable.

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment.
  2016-11-29 21:42         ` Ludovic Courtès
@ 2016-11-30  5:36           ` John Darrington
  2016-12-02 16:25           ` [PATCH] gnu: Patch libxt's default search path John Darrington
  1 sibling, 0 replies; 13+ messages in thread
From: John Darrington @ 2016-11-30  5:36 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]

On Tue, Nov 29, 2016 at 10:42:49PM +0100, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     >      > * Hack the hard coded defaults in the libXt source to use the profile
     >      > settings instead of /usr
     >      
     >      Maybe we should just do that, no?  It???d be a local change, it would
     >      achieve the same effect, and it would provide a good default.
     >      
     >
     > It sounds unreliable to me.  What would we set it to?
     > $GUIX_PROFILE/...  $HOME/.guix-profile/... /run/current-system/profile/...
     > There's no guarantee that the current profile is any of those.
     
     Maybe, but that would have the same effect as setting the environment
     variable to that value, wouldn???t it?

Except that the environment variable solution is easier for users to override. 
     
     > Something similar to the first solution seems prefereable to me.  Maybe:
     >
     >  Set XFILESEARCHPATH to "$HOME/.guix-profile/lib/X11/%T/%N%S:/run/current-system/profile/lib/X11/%T/%N%S"
     >   (we can substitute "share" for "lib" if we want to keep the FHS people happy).
     
     How did you manage to shorten it that much?  

Simply by assuming that nobody ever installs resource files outside these locations.
If anybody ever does - then things will break.
     
     >  Then we audit all users of libxt to make sure they put their resource files in lib/X11/app-defaults.
     >  Most packages have a --with-app-defaults configure option (which currently we are in many cases
     >  either not using or misusing).
     >
     >  We could also consider adding a build stage to make sure that packages which depend on libXt put
     >  their resource files in the "right" place.
     
     Sounds reasonable.

All in all, it sounds like a lot of work in the short time - but it might be worth it.
I'll see what I can do (and if it has a chance of working).

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] gnu: Patch libxt's default search path.
  2016-11-29 21:42         ` Ludovic Courtès
  2016-11-30  5:36           ` John Darrington
@ 2016-12-02 16:25           ` John Darrington
  2016-12-04 21:19             ` Ludovic Courtès
  1 sibling, 1 reply; 13+ messages in thread
From: John Darrington @ 2016-12-02 16:25 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/packages/patches/libxt-guix-search-paths.patch: New file.
* gnu/packages/xorg.scm (libxt) [source]: Add patch.
---
 gnu/packages/patches/libxt-guix-search-paths.patch | 123 +++++++++++++++++++++
 gnu/packages/xorg.scm                              |   3 +-
 2 files changed, 125 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/libxt-guix-search-paths.patch

diff --git a/gnu/packages/patches/libxt-guix-search-paths.patch b/gnu/packages/patches/libxt-guix-search-paths.patch
new file mode 100644
index 0000000..dfeea8a
--- /dev/null
+++ b/gnu/packages/patches/libxt-guix-search-paths.patch
@@ -0,0 +1,123 @@
+--- libXt-1.1.5/src/Intrinsic.c	2015-05-01 07:36:20.000000000 +0200
++++ Intrinsic.c	2016-12-02 13:30:22.642776165 +0100
+@@ -1303,21 +1303,98 @@
+     } else (void) strcpy(*rest, string);
+ }
+ 
+-/*
+- * default path used if environment variable XFILESEARCHPATH
+- * is not defined.  Also substitued for %D.
+- * The exact value should be documented in the implementation
+- * notes for any Xt implementation.
++
++
++/* 
++   Return the default search path for the function
++   XtResolvePathname to use if XFILESEARCHPATH is 
++   not defined.
++
++   It returns the combination the set of values which are the 6 "stems" below,
++   prepended with "/run/current-system/profile", and $GUIX_PROFILE and 
++   "$HOME/.guix-profile"
+  */
+-static const char *implementation_default_path(void)
++static const char *guix_default_path(void)
+ {
+-#if defined(WIN32)
+-    static char xfilesearchpath[] = "";
+-
+-    return xfilesearchpath;
+-#else
+-    return XFILESEARCHPATHDEFAULT;
+-#endif
++  static const char *search_path_default_stem[6] = {
++    "/lib/X11/%L/%T/%N%C%S",
++    "/lib/X11/%l/%T/%N%C%S",
++    "/lib/X11/%T/%N%C%S",
++    "/lib/X11/%L/%T/%N%S",
++    "/lib/X11/%l/%T/%N%S",
++    "/lib/X11/%T/%N%S"
++  };
++
++#define SIZEOF_STEMS  (strlen (search_path_default_stem[0])	\
++		       + strlen (search_path_default_stem[1])	\
++		       + strlen (search_path_default_stem[2])	\
++		       + strlen (search_path_default_stem[3])	\
++		       + strlen (search_path_default_stem[4])	\
++		       + strlen (search_path_default_stem[5]))
++
++
++  int i;
++  const char *current_profile = "/run/current-system/profile";
++  char *home = getenv ("HOME");
++  char *guix_profile = getenv ("GUIX_PROFILE");
++
++  size_t bytesAllocd = SIZEOF_STEMS + 1; 
++
++  /* This function is evaluated multiple times and the calling
++     code assumes that it is idempotent. So we must not allow
++     (say) a changed environment variable to cause it to return
++     something different. */
++  static char *path = NULL;
++  if (path)
++    return path;
++
++  bytesAllocd += 6 * (1 + strlen (current_profile));
++
++  if (guix_profile != NULL)
++    {
++      bytesAllocd += SIZEOF_STEMS;
++      bytesAllocd += 6 * (1 + strlen (guix_profile));
++    }
++
++  if (home != NULL)
++    {
++      bytesAllocd += SIZEOF_STEMS;
++      bytesAllocd += 6 * (1 + strlen(home) + strlen ("/.guix-profile"));
++    }
++
++  path = XtMalloc(bytesAllocd);
++  if (path == NULL) _XtAllocError(NULL);
++
++  memset (path, 0, bytesAllocd);
++  
++  for (i = 0 ; i < 6 ; ++i)
++    {
++      strcat (path, current_profile);
++      strcat (path, search_path_default_stem[i]);
++      strcat (path, ":");
++    }
++
++  if (guix_profile != NULL)
++    for (i = 0 ; i < 6 ; ++i)
++      {
++	strcat (path, guix_profile);
++	strcat (path, search_path_default_stem[i]);
++	strcat (path, ":");
++      }
++
++  if (home != NULL)
++    for (i = 0 ; i < 6 ; ++i)
++      {
++	strcat (path, home);
++	strcat (path, "/.guix-profile");
++	strcat (path, search_path_default_stem[i]);
++	strcat (path, ":");
++      }
++
++  /* Remove final : */
++  path[strlen(path) - 1] = '\0';
++  
++  return path;
+ }
+ 
+ 
+@@ -1345,7 +1422,7 @@
+ {
+     XtPerDisplay pd;
+     static const char *defaultPath = NULL;
+-    const char *impl_default = implementation_default_path();
++    const char *impl_default = guix_default_path();
+     int idef_len = strlen(impl_default);
+     char *massagedPath;
+     int bytesAllocd, bytesLeft;
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 18271b5..71f3b2a 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -5302,7 +5302,8 @@ draggable titlebars and borders.")
                ".tar.bz2"))
         (sha256
           (base32
-            "06lz6i7rbrp19kgikpaz4c97fw7n31k2h2aiikczs482g2zbdvj6"))))
+           "06lz6i7rbrp19kgikpaz4c97fw7n31k2h2aiikczs482g2zbdvj6"))
+        (patches (search-patches "libxt-guix-search-paths.patch"))))
     (build-system gnu-build-system)
     (outputs '("out"
                "doc"))                            ;2 MiB of man pages + XML
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] gnu: Patch libxt's default search path.
  2016-12-02 16:25           ` [PATCH] gnu: Patch libxt's default search path John Darrington
@ 2016-12-04 21:19             ` Ludovic Courtès
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2016-12-04 21:19 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> * gnu/packages/patches/libxt-guix-search-paths.patch: New file.
> * gnu/packages/xorg.scm (libxt) [source]: Add patch.
> ---
>  gnu/packages/patches/libxt-guix-search-paths.patch | 123 +++++++++++++++++++++
>  gnu/packages/xorg.scm                              |   3 +-
>  2 files changed, 125 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/libxt-guix-search-paths.patch
>
> diff --git a/gnu/packages/patches/libxt-guix-search-paths.patch b/gnu/packages/patches/libxt-guix-search-paths.patch
> new file mode 100644
> index 0000000..dfeea8a
> --- /dev/null
> +++ b/gnu/packages/patches/libxt-guix-search-paths.patch
> @@ -0,0 +1,123 @@

Please add a comment here explaining what it does and why we chose this
approach.

> + {
> +-#if defined(WIN32)
> +-    static char xfilesearchpath[] = "";
> +-
> +-    return xfilesearchpath;
> +-#else
> +-    return XFILESEARCHPATHDEFAULT;
> +-#endif
> ++  static const char *search_path_default_stem[6] = {

static const char *const *search_path_default_stem[]

> ++    "/lib/X11/%L/%T/%N%C%S",
> ++    "/lib/X11/%l/%T/%N%C%S",
> ++    "/lib/X11/%T/%N%C%S",
> ++    "/lib/X11/%L/%T/%N%S",
> ++    "/lib/X11/%l/%T/%N%S",
> ++    "/lib/X11/%T/%N%S"
> ++  };
> ++
> ++#define SIZEOF_STEMS  (strlen (search_path_default_stem[0])	\
> ++		       + strlen (search_path_default_stem[1])	\
> ++		       + strlen (search_path_default_stem[2])	\
> ++		       + strlen (search_path_default_stem[3])	\
> ++		       + strlen (search_path_default_stem[4])	\
> ++		       + strlen (search_path_default_stem[5]))
> ++
> ++
> ++  int i;
> ++  const char *current_profile = "/run/current-system/profile";
> ++  char *home = getenv ("HOME");
> ++  char *guix_profile = getenv ("GUIX_PROFILE");

GUIX_PROFILE is not meant to be systematically defined, but maybe that’s
good enough.

Could you build, say, xterm against this, check whether this fixes the
ctrl-click issue for instance, and also run it in Valgrind to make sure?

If that works, ok for core-updates or the next ‘staging’ since ‘staging’
is now frozen.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-12-04 21:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 19:08 [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment John Darrington
2016-11-25 19:08 ` [PATCH 2/4] gnu: Add editres John Darrington
2016-11-27 21:22   ` Ludovic Courtès
2016-11-25 19:08 ` [PATCH 3/4] gnu: Remove wrappers from xfd and xfontsel John Darrington
2016-11-25 19:08 ` [PATCH 4/4] gnu: Xfig: Set XAPPLOADDIR John Darrington
2016-11-27 21:22 ` [PATCH 1/4] gnu: Add XFILESEARCH path to profiles' environment Ludovic Courtès
2016-11-28 13:19   ` John Darrington
2016-11-29 14:34     ` Ludovic Courtès
2016-11-29 18:16       ` John Darrington
2016-11-29 21:42         ` Ludovic Courtès
2016-11-30  5:36           ` John Darrington
2016-12-02 16:25           ` [PATCH] gnu: Patch libxt's default search path John Darrington
2016-12-04 21:19             ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).