GNU bug report logs - #75688
Replace wrapper scripts with search path value files in search-paths.d

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: iyzsong@HIDDEN; Keywords: patch; dated Mon, 20 Jan 2025 12:02:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Changed bug title to 'Replace wrapper scripts with search path value files in search-paths.d' from 'GUIX_ify harmful environment variables and replace wrapper scripts with search path value files' Request was from 宋文武 <iyzsong@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 13:18:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 08:18:21 2025
Received: from localhost ([127.0.0.1]:59927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcP0O-0002NM-4l
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:21 -0500
Received: from mail.envs.net ([5.199.136.28]:52490)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcP0F-0002Me-Nh
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:13 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id D7B5338A3E6D;
 Mon, 27 Jan 2025 13:18:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737983890; bh=O+ThQ9+miYrsemYH2OfZGMrx0nUEjWKuB9zyO/EhGj8=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=qjWU7a7eYC7iUkD35Uxnml9dsLlqT+LdwyBk/CCbyc89J+tIs5yTRaT+UYQzydaCS
 wxderqpiH4lYY1h/zw5I+nBwVAJQGFS/F5Pnb6Ejk9ZIkybeteM0tV+GwmtVd4JChK
 0smEVnT3OQ0m1Sj/BopcLbluSvrTUl7LYjWpAXeYQPPqjC89URMkcEUHggtZ9KJ0Lh
 8B3+3kJyyyHO6+OZSz1Xo0FzTn6E9evfJ34LyNORVtVJFM2kfdjANFHqJsP6MnAlOP
 d0ZkrHRJn2QfmrqV76PHdwKuxm2QgqUXONx173Hlm5XAjK7Wt2ADDUM5QFzP61LG1p
 WDDWh/IJPeAe9kb5gTghjiqsyK4VWmcbOZtONNUnr0ysqfMB8Y09FdTE+wJhDNi3U8
 zjv7rMC30AkvHSZqXUjw4NxaAqSjgiB21hzKlELE0+/EAfjD4eNaPfC519F89pA7hF
 LvmcjY7VKFw16ZpSk1geE0/r9Xyvm50we3OO43JgO1bQ3sgVJtq4lNqzx30X/47AwR
 zBzBhDX5/hb5g+JIlE2v/V7QfWtEERIi+g/FrjjKnDw7RuRv7v7SBk2FdYUQ3S76WZ
 dL9PXTyvgGFIaivI68aTd+I1jvl0tRyK/f8rOsMizrKvxnJet7iUxdCQNzbXSjoUju
 aUK448Xsqeh5kd1NM1wUAlOw=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id u6efFIVEjPTx; Mon, 27 Jan 2025 13:18:07 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 13:18:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 095c186e;
 Mon, 27 Jan 2025 13:21:34 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v3 4/4] build: glib-or-gtk-build-system: Replace wrapper
 scripts with 'search-paths.d'.
Date: Mon, 27 Jan 2025 21:21:23 +0800
Message-ID: <06a62fdc2853a732baf3f6396d38293f38c11860.1737983975.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
References: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* guix/build/glib-or-gtk-build-system.scm (write-search-path-file): New procedure.
(gtk-module-directories): Add version to arguments.
(gsettings-schema-directories): New procedure.
(data-directories): Don't check for "/glib-2.0/schemas".
(conf-directories): New procedure.
(wrap-all-programs): Rewrite in terms of 'write-search-path-file'.

Change-Id: I1c9e8d491b96e298d1568a5e29b04c762c26e4d1
---
 guix/build/glib-or-gtk-build-system.scm | 166 ++++++++++++++----------
 1 file changed, 95 insertions(+), 71 deletions(-)

diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm
index 67a52ddad3..335a856575 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Mark H Weaver <mhw@HIDDEN>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
+;;; Copyright © 2025 宋文武 <iyzsong@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +40,13 @@ (define-module (guix build glib-or-gtk-build-system)
 ;;
 ;; Code:
 
+(define* (write-search-path-file output variable value)
+  "Write VALUE to @file{etc/search-paths.d/VARIABLE} under OUTPUT."
+  (let ((search-paths.d (string-append output "/etc/search-paths.d")))
+    (mkdir-p search-paths.d)
+    (with-output-to-file (string-append search-paths.d "/" variable)
+      (lambda () (display value)))))
+
 (define (subdirectory-exists? parent sub-directory)
   (directory-exists? (string-append parent sub-directory)))
 
@@ -47,32 +55,12 @@ (define (directory-included? directory directories-list)
   (fold (lambda (s p) (or (string-ci=? s directory) p))
         #f directories-list))
 
-;; We do not include $HOME/.guix-profile/gtk-v.0 (v=2 or 3) because we do not
-;; want to mix gtk+-2 and gtk+-3 modules.  See
-;; https://developer.gnome.org/gtk3/stable/gtk-running.html
-(define (gtk-module-directories inputs)
-  "Check for the existence of \"libdir/gtk-v.0\" in INPUTS.  Return a list
+;; We load GTK modules via the GUIX_GTK2_PATH, GUIX_GTK3_PATH and GUIX_GTK4_PATH
+;; search paths.
+(define (gtk-module-directories inputs version)
+  "Check for the existence of \"libdir/gtk-VERSION\" in INPUTS.  Return a list
 with all found directories."
-  (let* ((version
-          (cond
-           ((string-match "gtk-4"
-                          (or (assoc-ref inputs "gtk")
-                              (assoc-ref inputs "source")
-                              ""))
-            "4.0")
-           ((string-match "gtk\\+-3"
-                          (or (assoc-ref inputs "gtk+")
-                              (assoc-ref inputs "source")
-                              ""))
-            "3.0")
-           ((string-match "gtk\\+-2"
-                          (or (assoc-ref inputs "gtk+")
-                              (assoc-ref inputs "source")
-                              ""))
-            "2.0")
-           (else
-            "4.0"))) ; We default to version 4.0.
-         (gtk-module
+  (let ((gtk-module
           (lambda (input prev)
             (let* ((in (match input
                          ((_ . dir) dir)
@@ -85,27 +73,22 @@ (define (gtk-module-directories inputs)
                   prev)))))
     (fold gtk-module '() inputs)))
 
-;; See
+;; XDG data files include themes, sounds, icons, etc. See:
 ;; http://www.freedesktop.org/wiki/DesktopThemeSpec
 ;; http://freedesktop.org/wiki/Specifications/sound-theme-spec
 ;; http://freedesktop.org/wiki/Specifications/icon-theme-spec
 ;;
-;; Currently desktop themes are not well supported and do not honor
-;; XDG_DATA_DIRS.  One example is evince which only looks for desktop themes
-;; in $HOME/.themes (for backward compatibility) and in XDG_DATA_HOME (which
-;; defaults to $HOME/.local/share).  One way to handle these applications
-;; appears to be by making $HOME/.themes a symlink to
-;; $HOME/.guix-profile/share/themes.
+;; We load them via XDG_DATA_DIRS (from profile, has higher priority) and
+;; GUIX_XDG_DATA_DIRS (application specified) search paths.
 (define (data-directories inputs)
-  "Check for the existence of \"$datadir/glib-2.0/schemas\" or XDG themes data
-in INPUTS.  Return a list with all found directories."
+  "Check for the existence of XDG data files in INPUTS.  Return a list with all found
+directories."
   (define (data-directory input previous)
     (let* ((in (match input
                  ((_ . dir) dir)
                  (_ "")))
            (datadir (string-append in "/share")))
-      (if (and (or (subdirectory-exists? datadir "/glib-2.0/schemas")
-                   (subdirectory-exists? datadir "/sounds")
+      (if (and (or (subdirectory-exists? datadir "/sounds")
                    (subdirectory-exists? datadir "/themes")
                    (subdirectory-exists? datadir "/cursors")
                    (subdirectory-exists? datadir "/wallpapers")
@@ -117,15 +100,45 @@ (define (data-directories inputs)
 
   (fold data-directory '() inputs))
 
+;;; XDG configuration files are expected to be installed in etc/xdg directory.
+;;; We load them via XDG_CONFIG_DIRS (from profile, has higher priority) and
+;;; GUIX_XDG_CONFIG_DIRS (application specified) search paths.
+(define (conf-directories inputs)
+  "Check for the existence of XDG configuration files in INPUTS.  Return a list with
+all found directories."
+  (define (conf-directory input previous)
+    (let* ((in (match input
+                 ((_ . dir) dir)
+                 (_ "")))
+           (conf-dir (string-append in "/etc/xdg")))
+      (if (and (directory-exists? conf-dir)
+               (not (directory-included? conf-dir previous)))
+          (cons conf-dir previous)
+          previous)))
+
+  (fold conf-directory '() inputs))
+
+;;; GIO GSettings schemas are expected to be installed in $datadir/glib-2.0/schemas
+;;; directory.  We load them via the GUIX_GSETTINGS_SCHEMA_DIR search path.
+(define (gsettings-schema-directories inputs)
+  "Check for the existence of \"$datadir/glib-2.0/schemas\" in INPUTS.
+Return a list with all found directories."
+  (define (gsettings-schema-directory input previous)
+    (let* ((in (match input
+                 ((_ . dir) dir)
+                 (_ "")))
+           (schema-dir (string-append in "/share/glib-2.0/schemas")))
+      (if (and (directory-exists? schema-dir)
+               (not (directory-included? schema-dir previous)))
+          (cons schema-dir previous)
+          previous)))
+
+  (fold gsettings-schema-directory '() inputs))
+
 ;; All GIO modules are expected to be installed in GLib's $libdir/gio/modules
 ;; directory.  That directory has to include a file called giomodule.cache
-;; listing all available modules.  GIO can be made aware of modules in other
-;; directories with the help of the environment variable GIO_EXTRA_MODULES.
-;; The official GIO documentation states that this environment variable should
-;; only be used for testing and not in a production environment.  However, it
-;; appears that there is no other way of specifying multiple modules
-;; directories (NIXOS also does use this variable). See
-;; https://developer.gnome.org/gio/stable/running-gio-apps.html
+;; listing all available modules.  We load them via the GUIX_GIO_EXTRA_MODULES
+;; search path.
 (define (gio-module-directories inputs)
   "Check for the existence of \"$libdir/gio/modules\" in the INPUTS and
 returns a list with all found directories."
@@ -141,50 +154,61 @@ (define (gio-module-directories inputs)
 
   (fold gio-module-directory '() inputs))
 
+
+;;; XXX: Only works for ELF executables and python3 scripts.
 (define* (wrap-all-programs #:key inputs outputs
                             (glib-or-gtk-wrap-excluded-outputs '())
                             #:allow-other-keys)
   "Implement phase \"glib-or-gtk-wrap\": look for GSettings schemas and
-gtk+-v.0 libraries and create wrappers with suitably set environment variables
+GTK libraries and create @file{etc/search-paths.d} with suitably set of files
 if found.
 
 Wrapping is not applied to outputs whose name is listed in
 GLIB-OR-GTK-WRAP-EXCLUDED-OUTPUTS.  This is useful when an output is known not
 to contain any GLib or GTK+ binaries, and where wrapping would gratuitously
-add a dependency of that output on GLib and GTK+."
-  ;; Do not require bash to be present in the package inputs
-  ;; even when there is nothing to wrap.
-  ;; Also, calculate (sh) only once to prevent some I/O.
-  (define %sh (delay (search-input-file inputs "bin/bash")))
-  (define (sh) (force %sh))
+add a dependency of that output on GLib and GTK."
   (define handle-output
     (match-lambda
       ((output . directory)
        (unless (member output glib-or-gtk-wrap-excluded-outputs)
-         (let* ((bindir       (string-append directory "/bin"))
-                (libexecdir   (string-append directory "/libexec"))
-                (bin-list     (filter (negate wrapped-program?)
-                                      (append (find-files bindir ".*")
-                                          (find-files libexecdir ".*"))))
-                (datadirs     (data-directories
+         (let* ((datadirs     (data-directories
                                (alist-cons output directory inputs)))
-                (gtk-mod-dirs (gtk-module-directories
+                (confdirs     (conf-directories
                                (alist-cons output directory inputs)))
-                (gio-mod-dirs (gio-module-directories
+                (schemadirs   (gsettings-schema-directories
                                (alist-cons output directory inputs)))
-                (env-vars `(,@(if (not (null? datadirs))
-                                  (list `("XDG_DATA_DIRS" ":" prefix ,datadirs))
-                                  '())
-                            ,@(if (not (null? gtk-mod-dirs))
-                                  (list `("GTK_PATH" ":" prefix ,gtk-mod-dirs))
-                                  '())
-                            ,@(if (not (null? gio-mod-dirs))
-                                  (list `("GIO_EXTRA_MODULES" ":"
-                                          prefix ,gio-mod-dirs))
-                                  '()))))
-           (for-each (lambda (program)
-                       (apply wrap-program program #:sh (sh) env-vars))
-                     bin-list))))))
+                (gtk2-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "2.0"))
+                (gtk3-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "3.0"))
+                (gtk4-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "4.0"))
+                (gio-mod-dirs (gio-module-directories
+                               (alist-cons output directory inputs))))
+           (when (not (null? datadirs))
+             (write-search-path-file directory "GUIX_XDG_DATA_DIRS"
+                                     (string-join datadirs ":")))
+           (when (not (null? confdirs))
+             (write-search-path-file directory "GUIX_XDG_CONFIG_DIRS"
+                                     (string-join confdirs ":")))
+           (when (not (null? schemadirs))
+             (write-search-path-file directory "GUIX_GSETTINGS_SCHEMA_DIR"
+                                     (string-join schemadirs ":")))
+           (when (not (null? gtk2-mod-dirs))
+             (write-search-path-file directory "GUIX_GTK2_PATH"
+                                     (string-join gtk2-mod-dirs ":")))
+           (when (not (null? gtk3-mod-dirs))
+             (write-search-path-file directory "GUIX_GTK3_PATH"
+                                     (string-join gtk3-mod-dirs ":")))
+           (when (not (null? gtk4-mod-dirs))
+             (write-search-path-file directory "GUIX_GTK4_PATH"
+                                     (string-join gtk4-mod-dirs ":")))
+           (when (not (null? gio-mod-dirs))
+             (write-search-path-file directory "GUIX_GIO_EXTRA_MODULES"
+                                     (string-join gio-mod-dirs ":"))))))))
 
   (for-each handle-output outputs))
 
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 13:18:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 08:18:16 2025
Received: from localhost ([127.0.0.1]:59925 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcP0J-0002N4-7V
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:15 -0500
Received: from mail.envs.net ([5.199.136.28]:52480)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcP0E-0002Mc-Qg
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:11 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id E877338A3DBF;
 Mon, 27 Jan 2025 13:18:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737983889; bh=zWu41/CBIoo2ICxmGaAKoDqJ5EwUYXH6Z0OSbiCeVzY=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=mTr/tvoPCuk6YnoASk6pwbHEvqatDScjDtAa4ISjH1eUuMmEPd46TQVCWWqHNx7JY
 E8nUjz7/yJK9NVYNjPY42iOZpoxqJHPn0Mjx44XF3BVjsDwh72/2YCrKQlnFg4f6Wq
 FcmJuSSga1OUc602zL5+N6FJaeOmuZOBOs434UwfaQmgxbl/LganlMOBBmJdDW9FiT
 i9KGbSsel+T7E7oUty1ORsCIi8kpLahktRtWDk2YRsceutSTlRnWK3XYzxv72H7T0Z
 FF0zcEsGKkwJgkitUxxQ9m8af60GIxKUXVzfXTOO7zU/FFJsPy23/IdZsQxkDeoEG3
 bQ3BJLF4EcCP+GN3YMrD7BDWaTZFLtgWouaCY2vKBmWmXUFwERIrvA26qpnMwzP8MP
 gf8uPuGYOuraMfPZl6xhL7TAVgBuL6g72LgV1z1XZyQVVxcavOWFoPCYYSxCxl6QDJ
 q06BDi3sS6jLXv8Lfp/IOjKqf4krq08/zrrfmTLGF34KClAb2YEQdSP5yIk45Ak4qY
 lj6GxT+PlydzYcVt3HwKfmBluyor7d9PLxgml6LGRK/qGxQhUY1KwiNt9WOEFFt54W
 loYfgTeew9akRpNtOwqDTR++E/85nJc7PhM1RxipX8xaaNjGGRdgwhC8EGqNQiRH81
 r0PrQ0NG64wGAyYiHsPTKc2g=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id B5V5E7U3uvOA; Mon, 27 Jan 2025 13:18:06 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 13:18:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id b482d01f;
 Mon, 27 Jan 2025 13:21:34 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v3 3/4] gnu: gtk: Add search-paths.d support for GUIX_GTK{2, 3,
 4}_PATH.
Date: Mon, 27 Jan 2025 21:21:22 +0800
Message-ID: <08a25b1c35ccc1fa3869bc1cdf3b6e8f883de4d6.1737983975.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
References: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch,
gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch,
gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch: Rewrite in terms
of 'g_build_guix_search_path_dirs'.

Change-Id: Ib0748c39e56fd598f30f40b9ac3bb0f012f14c31
---
 .../patches/gtk2-respect-GUIX_GTK2_PATH.patch | 64 ++++++-------------
 .../patches/gtk3-respect-GUIX_GTK3_PATH.patch | 55 ++++++----------
 .../patches/gtk4-respect-GUIX_GTK4_PATH.patch | 62 +++++-------------
 3 files changed, 54 insertions(+), 127 deletions(-)

diff --git a/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch b/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
index 93a8ddc242..fb6c7809f9 100644
--- a/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
+++ b/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
@@ -1,46 +1,20 @@
-This patch makes GTK+ look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK2_PATH".  This can be used
-instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
-other major versions of GTK+.
+diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
+index 50729b61a5..2d4c2c2a85 100644
+--- a/gtk/gtkmodules.c
++++ b/gtk/gtkmodules.c
+@@ -96,5 +96,15 @@ get_module_path (void)
+   result = pango_split_file_list (module_path);
+   g_free (module_path);
 
---- a/gtk/gtkmodules.c	2014-09-29 22:02:17.000000000 +0200
-+++ b/gtk/gtkmodules.c	2015-12-02 18:41:53.306396938 +0100
-@@ -55,6 +55,7 @@
- get_module_path (void)
- {
-   const gchar *module_path_env;
-+  const gchar *module_guix_gtk2_path_env;
-   const gchar *exe_prefix;
-   const gchar *home_dir;
-   gchar *home_gtk_dir = NULL;
-@@ -70,6 +71,7 @@
-     home_gtk_dir = g_build_filename (home_dir, ".gtk-2.0", NULL);
- 
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk2_path_env = g_getenv ("GUIX_GTK2_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
- 
-   if (exe_prefix)
-@@ -77,9 +79,21 @@
-   else
-     default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", NULL);
- 
--  if (module_path_env && home_gtk_dir)
-+  if (module_guix_gtk2_path_env && module_path_env && home_gtk_dir)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, module_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env && home_gtk_dir)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, module_path_env, default_dir, NULL);
-+  else if (module_path_env && home_gtk_dir)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, default_dir, NULL);
-   else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
++  /* GUIX: Load additional modules from GUIX_GTK2_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK2_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
diff --git a/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch b/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
index 66fd2fd1c4..28e232a812 100644
--- a/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
+++ b/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
@@ -1,38 +1,21 @@
-This patch makes GTK+ look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK3_PATH".  This can be used
-instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
-other major versions of GTK+.
-
---- a/gtk/gtkmodules.c	2015-09-20 20:09:05.060590217 +0200
-+++ b/gtk/gtkmodules.c	2015-09-20 20:10:33.423124833 +0200
-@@ -52,6 +52,7 @@
- get_module_path (void)
- {
-   const gchar *module_path_env;
-+  const gchar *module_guix_gtk3_path_env;
-   const gchar *exe_prefix;
-   gchar *module_path;
-   gchar *default_dir;
-@@ -61,6 +62,7 @@
-     return result;
+diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
+index f93101c272..b57e1da802 100644
+--- a/gtk/gtkmodules.c
++++ b/gtk/gtkmodules.c
+@@ -81,6 +81,16 @@ get_module_path (void)
+   result = gtk_split_file_list (module_path);
+   g_free (module_path);
  
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk3_path_env = g_getenv ("GUIX_GTK3_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
++  /* GUIX: Load additional modules from GUIX_GTK3_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK3_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
  
-   if (exe_prefix)
-@@ -68,7 +70,13 @@
-   else
-     default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL);
- 
--  if (module_path_env)
-+  if (module_guix_gtk3_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk3_path_env, module_path_env, default_dir, NULL);
-+  else if (module_guix_gtk3_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk3_path_env, default_dir, NULL);
-+  else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
-   else
diff --git a/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
index 4a60023bf7..56c202ecf4 100644
--- a/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
+++ b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
@@ -1,51 +1,21 @@
-From 889294a93fc6464c2c2919bc47f6fd85ec823363 Mon Sep 17 00:00:00 2001
-From: Raghav Gururajan <rg@HIDDEN>
-Date: Tue, 18 May 2021 19:57:00 -0400
-Subject: [PATCH] [PATCH]: Honor GUIX_GTK4_PATH.
-
-This patch makes GTK look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK4_PATH". This can be used
-instead of "GTK_PATH" to make GTK find modules that are incompatible with
-other major versions of GTK.
----
- gtk/gtkmodules.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
 diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
-index aace5dcbc9..193b6a02e9 100644
+index 51b0916624..0cd6ee7e30 100644
 --- a/gtk/gtkmodules.c
 +++ b/gtk/gtkmodules.c
-@@ -105,6 +105,7 @@ static char **
- get_module_path (void)
- {
-   const char *module_path_env;
-+  const gchar *module_guix_gtk4_path_env;
-   const char *exe_prefix;
-   char *module_path;
-   char *default_dir;
-@@ -114,6 +115,7 @@ get_module_path (void)
-     return result;
+@@ -132,6 +132,16 @@ get_module_path (void)
+   result = split_file_list (module_path);
+   g_free (module_path);
  
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk4_path_env = g_getenv ("GUIX_GTK4_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
++  /* GUIX: Load additional modules from GUIX_GTK4_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK4_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
  
-   if (exe_prefix)
-@@ -121,7 +123,13 @@ get_module_path (void)
-   else
-     default_dir = g_build_filename (_gtk_get_libdir (), "gtk-4.0", NULL);
- 
--  if (module_path_env)
-+  if (module_guix_gtk4_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk4_path_env, module_path_env, default_dir, NULL);
-+  else if (module_guix_gtk4_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk4_path_env, default_dir, NULL);
-+  else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
-   else
--- 
-2.31.1
-
-- 
2.47.1





Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 13:18:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 08:18:15 2025
Received: from localhost ([127.0.0.1]:59923 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcP0I-0002Mx-Pc
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:15 -0500
Received: from mail.envs.net ([5.199.136.28]:52478)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcP0B-0002MR-U1
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:08 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 0E69938A2C3E;
 Mon, 27 Jan 2025 13:18:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737983887; bh=/KaaSOUKFB75BirDp0KvHjFv/N+Owkslf9p/0YF3b6o=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=UV6lc+f5NMMUWyLEewpRoKvH9frRmuCHQpIZrogNzC+3rEBtjFNuxtn6xYe8C24pk
 bn620gJ2UKeHKmaeW9XqGvh1t815AkftpvmolHOfm0ZNGbgPuF9L20qzZSHfDTFKcn
 7jWgiKqQb1Te1Pr40F+v4LzOYogTHf3nGimwRoZQlhypar1qU6ANKeyHElstkG0uE1
 OzNcCg7PseArnEZcmO8jg4LpwxmJw/OEK7e/J7+NMEtGfBhmRUAkEfroRlhLIJ3m6B
 ycf0mvcC5lcSEO1wWTRWiJ3IbUL1Oyl+NWCSf8RaeYxf7fOBbGRUJ3EoRfjLbD9fkp
 mu7JDWJTPbsuJJPx7bCBXnXkF2nCcQ+aaLd1sn2ozfiNFeuVemRAhhRqZbYDexkpwn
 va9JKj+Xg5OdLr8wwnTbStb4U481qr7hO3pdSv/cEodJCoeVI1zS5Tj0ON0qq43+zH
 XJqBHULJAF4TuDoBDiOy4enOJRKLsy925DTnzcIf6KR/PmZoIlWLW12WRnp5wOusb5
 2w7yJriiT/aOHcXxNBN/hEsUqKxFYf6ucEm0ciX3D/z2ZHoZuLEFf/Sr3UQkrsn1UM
 l+PePE/YShUSdrFy89wo7kN47hdzwmAhtfhnvX/BueZYmD5m6hATW5mwgrwomjohr+
 Tede3l9S/OElHuPi+j8S5PNQ=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id lw6k0LLY4GB6; Mon, 27 Jan 2025 13:18:03 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 13:18:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id d692a47c;
 Mon, 27 Jan 2025 13:21:33 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v3 2/4] gnu: python: Set GUIX_INTERPRETER_PATH and
 GUIX_MAIN_SCRIPT_PATH.
Date: Mon, 27 Jan 2025 21:21:21 +0800
Message-ID: <74079e8d389a7c278bdbbecac5075c4170446edf.1737983975.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
References: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Lars-Dominik Braun <lars@HIDDEN>, Marius Bakke <marius@HIDDEN>,
 Munyoki Kilyungi <me@HIDDEN>,
 Sharlatan Hellseher <sharlatanus@HIDDEN>,
 Tanguy Le Carrour <tanguy@HIDDEN>, jgart <jgart@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

This is used by 'g_build_guix_search_path_dirs' in our patched GLIB.

* gnu/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/python.scm (python-3.10)[source]<patches>: Add it.

Change-Id: I4588cbd087a783da1ad8c94fccda7ebf5e9f39ad
---
 gnu/local.mk                                  |  1 +
 .../python-3-set-GUIX_INTERPRETER_PATH.patch  | 28 +++++++++++++++++++
 gnu/packages/python.scm                       |  3 +-
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7ae66dd57d..ba355dabf8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2085,6 +2085,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-3-arm-alignment.patch		\
   %D%/packages/patches/python-3-deterministic-build-info.patch	\
   %D%/packages/patches/python-3-search-paths.patch		\
+  %D%/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch	\
   %D%/packages/patches/python-3-fix-tests.patch			\
   %D%/packages/patches/python-3-hurd-configure.patch		\
   %D%/packages/patches/python-angr-check-exec-deps.patch	\
diff --git a/gnu/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch b/gnu/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch
new file mode 100644
index 0000000000..2f173c68c8
--- /dev/null
+++ b/gnu/packages/patches/python-3-set-GUIX_INTERPRETER_PATH.patch
@@ -0,0 +1,28 @@
+The 'g_build_guix_search_path_dirs' function in our patched GLIB requires
+2 environment variables (GUIX_INTERPRETER_PATH and GUIX_MAIN_SCRIPT_PATH) to
+check if the current executable is a script launched by an interpreter, and
+find the script path if it is.
+---
+diff --git a/Modules/main.c b/Modules/main.c
+index 5bb1de2..83ada3d 100644
+--- a/Modules/main.c
++++ b/Modules/main.c
+@@ -636,6 +636,18 @@ pymain_run_python(int *exitcode)
+            prepended to sys.path.
+
+            Otherwise, main_importer_path is left unchanged. */
++
++        /* Set environment variables to support 'search-paths.d'. */
++        char *exe_path = realpath("/proc/self/exe", NULL);
++        PyObject *filename = PyUnicode_FromWideChar(config->run_filename, -1);
++        const char *main_script_path = PyUnicode_AsUTF8(filename);
++        if (exe_path != NULL && main_script_path != NULL) {
++            setenv("GUIX_INTERPRETER_PATH", exe_path, 1);
++            setenv("GUIX_MAIN_SCRIPT_PATH", main_script_path, 1);
++        }
++        free(exe_path);
++        Py_DECREF(filename);
++
+         if (pymain_get_importer(config->run_filename, &main_importer_path,
+                                 exitcode)) {
+             return;
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c5f98c3a46..7701d111c4 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -463,7 +463,8 @@ (define-public python-3.10
                         "python-3-fix-tests.patch"
                         "python-3-hurd-configure.patch"
                         "python-3-reproducible-build.patch"
-                        "python-3-search-paths.patch"))
+                        "python-3-search-paths.patch"
+                        "python-3-set-GUIX_INTERPRETER_PATH.patch"))
               (sha256
                (base32
                 "0j6wvh2ad5jjq5n7sjmj1k66mh6lipabavchc3rb4vsinwaq9vbf"))
-- 
2.47.1





Information forwarded to lars@HIDDEN, marius@HIDDEN, me@HIDDEN, sharlatanus@HIDDEN, tanguy@HIDDEN, jgart@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 13:18:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 08:18:14 2025
Received: from localhost ([127.0.0.1]:59921 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcP0I-0002Mu-1C
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:14 -0500
Received: from mail.envs.net ([5.199.136.28]:51064)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcP07-0002MG-QJ
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 08:18:05 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 4ABB538A3DBF;
 Mon, 27 Jan 2025 13:18:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737983882; bh=yokAar2H3c9cPLWaNK8YphafksKNhrv4hiwLY1Wy7F0=;
 h=From:To:Cc:Subject:Date:From;
 b=iUAD7Q2wZdw7aD7nrUDNeg1LQ0OalSEBoO8mtkfbDGPonL7KZL/fr2FwK/TN8W1MJ
 ew+nuX6ri7Te1BH/CNl/DEyrG33tgLO1OpwOiTTCy0EJPEVgTt0KzGZurXszmIUm1U
 v2ymzgH4jpnerKyjybyv6X7zeRVuCJWKhzFGctHcoN99aPkhbsuP/MsHupljtUQvn8
 I/0gt125JXE7gix/6A0EOwKfrGsHqmyv6/dd3cgiL6KyInoa1qq7Ajf/bt+F+kx5M9
 Dv/AHjXlQ/yLxyUZExsKne4/DOgUfilTefJdHYQVGOQRwd6DH8w7UiuSiaCg1Ky+AT
 R93UM3yWp4/FatS00zD3TzpCbpG7lCZ3d0vshScOmj98WJ7lzd7k3x5WQza12RQrT0
 Aa7qZX5Tr6IB3wKkNBH3usesO0hkFIDyzr0pA336NTE0GyAaDc/KK7fB8xQIUqFNRx
 UnISSN9EoKNjX+lgvODWArnx5q3pNDRUBA1ZSMeS9NW5LHqcGpcXsE0lbYESX2/gNz
 aZVr0l7e0UCoJfZdYJo1hY8MttQazoDIvNrm5UqjnP8hqPN/+8KC2JDFUWIx5wsLxp
 pn2vwcQ/SIlRYksVtSv9zWe/dI/Hn+8yaBLPMAgfow/PIr58nOs/YGU4Uj3oJXPeWX
 fyJ1qVyeCX9d1oZSJxymgQOs=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id PBqqLHXG40tn; Mon, 27 Jan 2025 13:17:58 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 13:17:58 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id e247316f;
 Mon, 27 Jan 2025 13:21:33 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v3 1/4] gnu: glib: Support load search paths from
 etc/search-paths.d files.
Date: Mon, 27 Jan 2025 21:21:20 +0800
Message-ID: <1df5c051d9d5e61894a49761415f69f7503451d0.1737983975.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

Add a new function "g_build_guix_search_path_dirs" to GLIB, which in addition
to environment variables, reads search path values from the etc/search-paths.d
directory of the current executable.  This can be used to replace wrapper
scripts.

Use it for GUIX_GSETTINGS_SCHEMA_DIR, GUIX_GIO_EXTRA_MODULES,
GUIX_XDG_DATA_DIRS and GUIX_XDG_CONFIG_DIRS.

* gnu/packages/patches/glib-guix-search-paths.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/glib.scm (glib)[source]: Add patch.
[native-search-paths]: Add GUIX_GSETTINGS_SCHEMA_DIR.  Replace
GIO_EXTRA_MODULES with GUIX_GIO_EXTRA_MODULES.

Change-Id: I1d6d113fc38b20ebd4dce195f6d9c58ce85967e4
---
 gnu/local.mk                                  |   1 +
 gnu/packages/glib.scm                         |   9 +-
 .../patches/glib-guix-search-paths.patch      | 162 ++++++++++++++++++
 3 files changed, 170 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/glib-guix-search-paths.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6961b8816c..7ae66dd57d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1438,6 +1438,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/git-filter-repo-generate-doc.patch	\
   %D%/packages/patches/gklib-suitesparse.patch			\
   %D%/packages/patches/glib-appinfo-watch.patch			\
+  %D%/packages/patches/glib-guix-search-paths.patch		\
   %D%/packages/patches/glib-skip-failing-test.patch		\
   %D%/packages/patches/glibc-2.33-riscv64-miscompilation.patch	\
   %D%/packages/patches/glibc-2.39-git-updates.patch	\
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index e04eedb7ba..0704ba2c53 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -258,7 +258,8 @@ (define glib
         (base32 "0c3vagxl77wma85qinbj974jvw96n5bvch2m7hqcwxq8fa5spsj4"))
        (patches
         (search-patches "glib-appinfo-watch.patch"
-                        "glib-skip-failing-test.patch"))
+                        "glib-skip-failing-test.patch"
+                        "glib-guix-search-paths.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -516,9 +517,13 @@ (define glib
       (search-path-specification
        (variable "XDG_DATA_DIRS")
        (files '("share")))
+      ;; To load gsettings schemas from GTK, etc.
+      (search-path-specification
+       (variable "GUIX_GSETTINGS_SCHEMA_DIR")
+       (files '("share/glib-2.0/schemas")))
       ;; To load extra gio modules from glib-networking, etc.
       (search-path-specification
-       (variable "GIO_EXTRA_MODULES")
+       (variable "GUIX_GIO_EXTRA_MODULES")
        (files '("lib/gio/modules")))))
     (search-paths native-search-paths)
     (synopsis "Low-level core library for GNOME projects")
diff --git a/gnu/packages/patches/glib-guix-search-paths.patch b/gnu/packages/patches/glib-guix-search-paths.patch
new file mode 100644
index 0000000000..565c045a55
--- /dev/null
+++ b/gnu/packages/patches/glib-guix-search-paths.patch
@@ -0,0 +1,162 @@
+diff --git a/gio/giomodule.c b/gio/giomodule.c
+index 76c2028..7afa8ef 100644
+--- a/gio/giomodule.c
++++ b/gio/giomodule.c
+@@ -1330,6 +1330,13 @@ _g_io_modules_ensure_loaded (void)
+       g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
+       g_free (module_dir);
+ 
++      /* Load modules from GUIX_GIO_EXTRA_MODULES. */
++      gchar **guix_giomodule_dirs = g_build_guix_search_path_dirs ("GUIX_GIO_EXTRA_MODULES");
++      for (int i = 0; guix_giomodule_dirs[i] != NULL; i++) {
++        g_io_modules_scan_all_in_directory_with_scope (guix_giomodule_dirs[i], scope);
++      }
++      g_strfreev (guix_giomodule_dirs);
++
+       g_io_module_scope_free (scope);
+ 
+       /* Initialize types from built-in "modules" */
+diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
+index e8ccc8c..6ac0f32 100644
+--- a/gio/gsettingsschema.c
++++ b/gio/gsettingsschema.c
+@@ -354,6 +354,13 @@ initialise_schema_sources (void)
+       while (i--)
+         try_prepend_data_dir (dirs[i]);
+ 
++      /* Load schemas from GUIX_GSETTINGS_SCHEMA_DIR. */
++      char **guix_schema_dirs = g_build_guix_search_path_dirs ("GUIX_GSETTINGS_SCHEMA_DIR");
++      i = g_strv_length(guix_schema_dirs);
++      while (i--)
++        try_prepend_dir (guix_schema_dirs[i]);
++      g_strfreev (guix_schema_dirs);
++
+       try_prepend_data_dir (g_get_user_data_dir ());
+ 
+       /* Disallow loading extra schemas if running as setuid, as that could
+diff --git a/glib/gutils.c b/glib/gutils.c
+index 8628a56..0f71890 100644
+--- a/glib/gutils.c
++++ b/glib/gutils.c
+@@ -2708,6 +2708,16 @@ g_build_system_data_dirs (void)
+     data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+ #endif
+ 
++  /* Use data files from GUIX_XDG_DATA_DIRS. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) data_dir_vector);
++  g_strfreev (data_dir_vector);
++  data_dir_vector = g_build_guix_search_path_dirs ("GUIX_XDG_DATA_DIRS");
++  g_strv_builder_addv (builder, (const gchar **) data_dir_vector);
++  g_strfreev (data_dir_vector);
++  data_dir_vector = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return g_steal_pointer (&data_dir_vector);
+ }
+ 
+@@ -2800,6 +2810,16 @@ g_build_system_config_dirs (void)
+   conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+ #endif
+ 
++  /* Use config files from GUIX_XDG_CONFIG_DIRS. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) conf_dir_vector);
++  g_strfreev (conf_dir_vector);
++  conf_dir_vector = g_build_guix_search_path_dirs ("GUIX_XDG_CONFIG_DIRS");
++  g_strv_builder_addv (builder, (const gchar **) conf_dir_vector);
++  g_strfreev (conf_dir_vector);
++  conf_dir_vector = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return g_steal_pointer (&conf_dir_vector);
+ }
+ 
+@@ -2849,6 +2869,73 @@ g_get_system_config_dirs (void)
+   return system_config_dirs;
+ }
+ 
++gchar **
++g_build_guix_search_path_dirs (const gchar *variable)
++{
++  gchar **dirs = NULL;
++  char *value = NULL;
++  GStrvBuilder *builder = g_strv_builder_new ();
++
++  /* First add paths from the etc/search-paths.d, which can be used to replace wrapper script. */
++  gchar *out_path = NULL;
++  gchar *search_paths_d = NULL;
++  gchar *exe_path = g_file_read_link ("/proc/self/exe", NULL);
++
++  /* For scripts, we use GUIX_MAIN_SCRIPT_PATH to find its location. */
++  if (g_strcmp0 (exe_path, g_getenv ("GUIX_INTERPRETER_PATH")) == 0) {
++    g_free (exe_path);
++    exe_path = g_getenv ("GUIX_MAIN_SCRIPT_PATH");
++  }
++
++  /* We install executables under "bin" or "libexec", can also be a subdirectory of "libexec". */
++  if (exe_path && (g_str_match_string("/bin/", exe_path, FALSE) ||
++                   g_str_match_string("/libexec/", exe_path, FALSE))) {
++    /* Find output directory, which is the parent directory of "bin" or "libexec". */
++    out_path = g_path_get_dirname (exe_path);
++    while (g_str_match_string("/bin/", out_path, FALSE) ||
++           g_str_match_string("/libexec/", out_path, FALSE)) {
++      gchar *dir_path = out_path;
++      out_path = g_path_get_dirname (dir_path);
++      g_free (dir_path);
++    }
++
++    /* Now add paths from etc/search-paths.d/VARIABLE file. */
++    search_paths_d = g_build_filename (out_path, "etc", "search-paths.d", NULL);
++    if (g_file_test (search_paths_d, G_FILE_TEST_EXISTS)) {
++      gchar *var_path = g_build_filename (search_paths_d, variable, NULL);
++      if (g_file_get_contents (var_path, &value, NULL, NULL)) {
++        dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
++        g_strv_builder_addv (builder, (const gchar **) dirs);
++        g_strfreev (dirs);
++        g_free (value);
++      }
++      g_free (var_path);
++    }
++  }
++
++  free (exe_path);
++  g_free (out_path);
++  g_free (search_paths_d);
++
++  /* Then add paths from the environment variable. */
++  gboolean is_setuid = GLIB_PRIVATE_CALL (g_check_setuid) ();
++  if (is_setuid) /* we don't want to access arbitrary files when running as setuid. */
++    value = NULL;
++  else
++    value = g_strdup (g_getenv (variable));
++
++  if (value && value[0]) {
++      dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
++      g_strv_builder_addv (builder, (const gchar **) dirs);
++      g_strfreev (dirs);
++  }
++  g_free (value);
++
++  dirs = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++  return dirs;
++}
++
+ /**
+  * g_nullify_pointer:
+  * @nullify_location: (not nullable): the memory address of the pointer.
+diff --git a/glib/gutils.h b/glib/gutils.h
+index efc6914..710cf27 100644
+--- a/glib/gutils.h
++++ b/glib/gutils.h
+@@ -36,6 +36,9 @@
+ 
+ G_BEGIN_DECLS
+ 
++GLIB_AVAILABLE_IN_ALL
++gchar **g_build_guix_search_path_dirs (const gchar *variable);
++
+ GLIB_AVAILABLE_IN_ALL
+ const gchar *         g_get_user_name        (void);
+ GLIB_AVAILABLE_IN_ALL

base-commit: 77603927fba0edc2c4d9de122aa132b968a051e5
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 05:13:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 00:13:51 2025
Received: from localhost ([127.0.0.1]:58870 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcHRX-0000Ft-Cx
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 00:13:51 -0500
Received: from mail.envs.net ([5.199.136.28]:33604)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcHRU-0000Fd-9z
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 00:13:49 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id AE6C438A2C0E;
 Mon, 27 Jan 2025 05:13:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737954826; bh=Yl5AMycvLAwMTml6l7Jltt4fjY8NVppCOtVEdZO47sA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=NMB7uvV8ag6Sx8P7zQx8FOzj68EZlUDekeQmctJr/+MxV6iTNWDxLGAOkAwzNgA9e
 otp2MrHQySdLLZjWva+4QqEMiK9bu9RaHdk/u4DwIgotnvPBtRU2DhBUqZGb5d4Gkp
 4dYXfvO5sbuKwycpWsfR4BgLLR28ODEOnStCZGvFT1WmTefdKohkiRuHp0hkzF7twC
 XKcSsFN0za9+DYlZR1DN19Ftw6+vfXy5DthVMKB1mPPjqnYbks6cGzy/5G6WJTwEDQ
 Hjg9hYZB1WfohK2NKJ/mFEPLVE38vriY4xxlRF8CDU134kyEWbG3gBz1Wv2F24XVKX
 XL4jJ17hMmelWhSC0dBa3aCca53+oI+ZGcC1hdHQRAYMs4iyEjAd4Orqq5jgRFhdKw
 i6MqY3mQ6Z5gR3mApEEyA8axw2DuL6duP9qy7hHh5NGXnv54TfJ42/lrdPVXRcENse
 n5L36OAf7vApQQj478y4yDCm40Z7Jjc1ZyK+yl80RPop5hw1DhMo7KuGYwSaeIWT/1
 ZmsWrI6S8gKNOLVfd/UbJTyzpyqfMmJFyN+yhgNGMPzSHai4fkLqDCUNOfIns68DLs
 l3n5Q1N7qN05SGggU+aeC0bmDFvu5ncfe5mGHMKEPU9wJ4o0Nq6LkmOxsita8klmEY
 06e4IFBuocYK1x9jyxoEP3Hg=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 9fAE5p5yRwpx; Mon, 27 Jan 2025 05:13:39 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 05:13:39 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id db200d7f;
 Mon, 27 Jan 2025 05:17:14 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <877c6h55dy.fsf_-_@HIDDEN> (Maxim Cournoyer's message of "Mon, 
 27 Jan 2025 11:59:05 +0900")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
 <877c6h55dy.fsf_-_@HIDDEN>
Date: Mon, 27 Jan 2025 13:17:14 +0800
Message-ID: <87ed0o6dk5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

>> +++ b/gnu/packages/patches/glib-guix-search-paths.patch
>> @@ -0,0 +1,158 @@
>
> I think it'd be nice to forward a subset of this patch that implements
> just the loading environment variable from a file, as that mechanism
> seems like it could be generally useful (and upstreaming it would lower
> the maintenance burden for us).

Okay, I could try.


>> ++  gchar *exe_path = g_file_read_link ("/proc/self/exe", NULL);

While, I just find that this "/proc/self/exe" alone only works for ELF
executables, for interpreted scripts, we also need patch interpreters to
set 2 environment variables, eg: GUIX_INTERPRETER_PATH and GUIX_MAIN_SCRIPT_PATH.

And use GUIX_MAIN_SCRIPT_PATH when "/proc/self/exe" match
GUIX_INTERPRETER_PATH...

I'll send updated patches later.


>> ++  gchar *out_path = NULL;
>> ++  gchar *search_paths_d = NULL;
>> ++
>> ++  /* We install executables under "bin" or "libexec", can also be a subdirectory of "libexec". */
>> ++  if (exe_path && (g_str_match_string("/bin/", exe_path, FALSE) ||
>> ++                   g_str_match_string("/libexec/", exe_path, FALSE))) {
>
> Perhaps these 'bin' and 'libexec' hard-coded names should come from the
> build system of gdk-pixbuf, in case a distro uses different names across
> its package collection (to make it more general).

Okay, I could do this when upstream.

>> ++    /* Find output directory, which is the parent directory of "bin" or "libexec". */
>> ++    out_path = g_path_get_dirname (exe_path);
>> ++    while (g_str_match_string("/bin/", out_path, FALSE) ||
>> ++           g_str_match_string("/libexec/", out_path, FALSE)) {
>> ++      gchar *dir_path = out_path;
>
> Is the intent above to *copy* out_path into dir_path?  Currently that's
> not done; we just point another pointer to it.
>
>> ++      out_path = g_path_get_dirname (dir_path);
>
> If g_path_get_dirname mutates dir_path, than dir_path should be a string
> copy.  Otherwise if it doesn't get mutated by the call, we should be
> able to use just:
>
> out_path = g_path_get_dirname (out_path);
>
>> ++      g_free (dir_path);

That 'dir_path' is only maded to be freed here, since
'g_path_get_dirname' allocate a new array instead of modify existed one,
so we need free the old out_path once we get a new one.


> [...]
>
> Apart from my above comments, this looks good to me.  I think I'd stress
> once more the value of upstreaming as much of this to ease maintenance
> in the future.
>
> Thanks for this novel idea/implementation!

Sure, with additional interpreter patches which I haven't sent, to be
honest I feel this more hacky than novel, hope upstream or other folks
can give better ideas...

Thank you!




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 05:07:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 00:07:04 2025
Received: from localhost ([127.0.0.1]:58838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcHKx-0008On-LG
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 00:07:03 -0500
Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:61554)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tcHKu-0008OA-OF
 for 75688 <at> debbugs.gnu.org; Mon, 27 Jan 2025 00:07:01 -0500
Received: by mail-pl1-x634.google.com with SMTP id
 d9443c01a7336-2166022c5caso60292775ad.2
 for <75688 <at> debbugs.gnu.org>; Sun, 26 Jan 2025 21:07:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737954415; x=1738559215; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=KoyOy+nKhB5JJGeV3/AyF4NQg47A49IbGMshYRjDQ+0=;
 b=NEig9QXIvCCSS8GH8/zMudjC0NJbECntJCOJI9NGG4ZmL2H4hAGuTfMbzqK5IKEtCJ
 fEBNcY6CdYEDpJ5bQVc5u1ub4WvMu50v8/dqRA/RIT7fvpc6MVqh7LzfuFjbI0jXdg6n
 +84Yp/ZGFKUc9kJUdG5mBG/YZvj4G6+8oATNeC1Xab26/FcZ7EE3m9IkrPx9moOh89c8
 TAEZIoruEmLQ0h35tAh8FDxl43LJePA8Xiy8BnRMpxv70gfjMmnbTriNxo7HIIuC0vXo
 ltr0nQOJwGXaQOSSZOR8mzapn11XoxuAWQSmQowa7Lqog3xNrDmMQSrSdK/Z9KrZiY13
 nJhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737954415; x=1738559215;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=KoyOy+nKhB5JJGeV3/AyF4NQg47A49IbGMshYRjDQ+0=;
 b=v8feouRZW1ljdBP4XDNp1KqSMWVCfaaqp0AHQ4VMDfT0/bdDb0LcSCrneNpvsHpn/3
 ESDSqHpJYtWF1pKP2mjp73bMW6tXMgV91ZtjRbaSfGFZfZaumHv0aDFRZNSd9PYEiR1g
 24NCXm3L7KcrKLVxZa+hAJmE5suyFJXPrFGl9/gjh25oVWLOfRkKaNjBYmIOoCjYvjt1
 MWsZYouifiFlPoZX/1qmgGAwTuGHU1uslK3TRqRokGNmV6T1NWx8mFVbXnF5aD+SvvQZ
 TyvfGZpkgv5mrTtBOOphgsilLcwg0V7RgwGJD2eUUK9gDiN8ywy3m5E72iQ8qg53Ddsb
 pW1A==
X-Gm-Message-State: AOJu0YycPDADUoI9zBmEaDw5vbCu9LEN2XNHu+Z5phCza27Wy555iI1h
 P+oO/9ob6MVhfxt7kO8bRt7/w+9dg5IQN5/tL/f9+p0GBi6Y1qvo
X-Gm-Gg: ASbGnctCUHj4B9x0AV9WP1x/BXeDWlf68Lzxc50Jg21V2x/PNazlC++Fb55ra9d9Yg6
 HfMrCpZKDMauZiQ6pZ+aSvHKgE2LUtqDlK6XLifYa0eBTWSBIfvkDi33Rj4Y7NhPzZcsgjl1uaV
 zSXCI4UPdEwyV94XOONl1w6eA+qJAJic3pT0s1Om1CSSOC3BI7h3Ot3cPtpv6e615tGB3H2o9Mu
 PL1MqlYH3DgopDCQnHJFIXMQoqxh387lPiuyfMT4DVMN8W988qPqjquM7BiCM76a8/7k57/7t03
 ng==
X-Google-Smtp-Source: AGHT+IHFEVCbhxHRIOd7ZkIIK2U+Icd5Zz5NuM6g2PD1YZHVzWVUddGcFgHcj0IYuKXfLWvqn/lPhw==
X-Received: by 2002:a17:902:f54d:b0:218:a43c:571e with SMTP id
 d9443c01a7336-21c3555ce67mr623395005ad.28.1737954413893; 
 Sun, 26 Jan 2025 21:06:53 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-ac48fa81bf3sm5492457a12.24.2025.01.26.21.06.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Jan 2025 21:06:53 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <87frla81yt.fsf@HIDDEN> (=?utf-8?B?IuWui+aWh+atpiIncw==?=
 message of "Thu, 23 Jan 2025 14:43:22 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87sepcs3z9.fsf@HIDDEN> <87frla81yt.fsf@HIDDEN>
Date: Mon, 27 Jan 2025 14:06:41 +0900
Message-ID: <87tt9k4zha.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

=E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> writes:

[...]

> The patches require mass rebuilds due to glib-or-gtk-build-system ->
> meson/cmake/rust, etc.  I haven't test them, but show be fine for review
> now, if it seems fine, I could work on qt.

OK.  It looks promising from what I've read thus far :-).

> Also nix have the same issue, http://github.com/nixos/nixpkgs/issues/60260
> Maybe we could share the maintaince of patches with them somehow.

That's a good idea.

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 04:21:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 23:21:00 2025
Received: from localhost ([127.0.0.1]:58723 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcGcO-0006Ai-CN
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2025 23:21:00 -0500
Received: from mail.envs.net ([5.199.136.28]:49900)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tcGcL-0006AW-Iz
 for 75688 <at> debbugs.gnu.org; Sun, 26 Jan 2025 23:20:58 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 4C6A138A2C0E;
 Mon, 27 Jan 2025 04:20:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737951655; bh=w/j6Ek6OF3nwHa+7CbyDut/5PDf+Z8nBR1DlQ3wN45s=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=UiaFfl2wlilpADDbRZqDCeliZ5IVA2Sqx1prmFSxCLyDpfP9kPlCLse1elQj7RRnD
 NLr6ZsT+dcsg8MaC6HLDLeRK60jNFgD49b+knnl6H8Bo1dd2+WZHeo35qXkwpTiOME
 ByBHGtmYsfs0NFM3iYrnrW1pTOgvIJk3QzIXTNSx3lKKIrYssjof6i+HZj4kK4GRVw
 fwX3yMKtwdlcKGuwbcXtr8tgINlDBp1jra97/06atG0WdURsT4t9tbHvF9PJ/i4XXt
 2hlQQwkEOZ4WCZJcNo5VnlOwelrdmKnRHd3fpBBUC1E5ML/kqdbEAAwSTmjnOPa7Us
 rmjQUoon6tN5I56TUkc8IeJH5VRNPFn8QLRz2KoSXw+KlSfe77R29hDkdKbhyCefwX
 o3sFpknkbe8iG2nEsUN/HveYaBlWIeQyXU3xbvWdKI+7jyfRMIlWxucX9frXfcu5Ig
 4ssHb0NGja8VuLWtPsOUflzxkB+e7w6u/hR/34uBFEvxiXaOO6I5oV8DLtg0NHSccW
 fvbXXY85DMOfEL7H0OUrWuVa3OD2hUiAjhLpWFe2e8pUjZsHTOFLx4p0YwpQ5+OII5
 6LlT9l+Ok+nOr7CMrPWpVoUUVvz8l0fk0sLaN668MCa7O+5ZCQSHlXdayS9Yy1gK6X
 /uPNn29g4jTjkBG8dyjaK81M=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id yseBOP5S1eHh; Mon, 27 Jan 2025 04:20:48 +0000 (UTC)
Received: from localhost (unknown [112.44.100.200])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 27 Jan 2025 04:20:47 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id e8a3dde6;
 Mon, 27 Jan 2025 04:24:24 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <8734h55567.fsf_-_@HIDDEN> (Maxim Cournoyer's message of "Mon, 
 27 Jan 2025 12:03:44 +0900")
References: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
 <96be080084ef425fb5d5a8ab920d30667dc68c99.1737613671.git.iyzsong@HIDDEN>
 <8734h55567.fsf_-_@HIDDEN>
Date: Mon, 27 Jan 2025 12:24:24 +0800
Message-ID: <87sep46g07.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

>> * gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch:
>
> nitpick: I'd name this patch
> gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch (s/respect/honor/).
>
> [...]
>
> nitpick: "Load loaders" reads a bit loaded ;-).  I'd write "Load modules
> [...]" instead.
>
>> ++	gchar **guix_module_files = g_build_guix_search_path_dirs ("GUIX_GDK_PIXBUF_MODULE_FILES");
>> ++	for (int i = 0; guix_module_files[i] != NULL; i++)
>
> nitpick: I read a long time ago that ++i achieves the same and is more
> efficient, though I forgot the reasons.  Probably doesn't matter here,
> but could be neater (here and elsewhere).

Since it's not a big/hot loop, it doesn't matter here, and existed code use
"i++", so I'd leave it.

>
> Otherwise, for this commit alone,
>
> Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>
>
> (You'll want to give this series plenty of time for others to chime in).

I had update gdk-pixbuf patch for https://issues.guix.gnu.org/75795

The "search-paths.d" part of this series surely need more work, I'll
work on that later.

Thank you!




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 03:04:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 22:04:06 2025
Received: from localhost ([127.0.0.1]:58593 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcFPx-0002Qq-FD
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2025 22:04:05 -0500
Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:43261)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tcFPu-0002QK-SA
 for 75688 <at> debbugs.gnu.org; Sun, 26 Jan 2025 22:04:03 -0500
Received: by mail-pj1-x102a.google.com with SMTP id
 98e67ed59e1d1-2ee50ffcf14so7706495a91.0
 for <75688 <at> debbugs.gnu.org>; Sun, 26 Jan 2025 19:04:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737947037; x=1738551837; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ni6cO/3KsNK/x+55061zKxBYkaabR9Dw86RKqUEOXFE=;
 b=baTblD1DgBf9Yg/Q9AEH3pz1Ms0NvwApdIPm4mISa1VqFqwNtRnqZSr1nQmxuuivLB
 mI06dGSuEdhpp1QYoEq0cD9vOXRBdiuSQePBe0bq2qfypJT1AmG4pggldBXZTudcTbmv
 QBy9Kx8++wtKOqfjHUqzd8gbFMHKYOnwRES1xc7OdFcWDAnLfFfD5iCQr4mD07rZJsbp
 Vr1gHlySwP5qEdweOGk+tlOG4GudRzoHTAxVQbkEzpCmF3F6JHUoLJne6/0UEcQNO6vk
 KwSJ+bX8i1ltAzhr/9LGEI6qar6m/bZWcKZIfPxOGKCE+PbOTPG7/tdjy1KaowyijhgB
 7acw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737947037; x=1738551837;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=ni6cO/3KsNK/x+55061zKxBYkaabR9Dw86RKqUEOXFE=;
 b=mo02EnUURmMxyAoi33F6F0Nd8QZM46SlX1xd5GOcyILwkJIGDQwK87kSu9yqGlNBmK
 8dP1sm2Q9/xv+8dAmERuLeFTmAB/6FtR4Sv4hNjWTpSV8k1KRZpNvK/Gqc0E731+yeDj
 mMSAF40+MlxT9Cq1TgXWGrVp2qutv95maCB0QN5VeToe01r72yRP/0qtfGwBqse7sYzm
 TjZiv9XTEYvB2VR2ChNPXD73DotKWzpKEMtIX8wgpnM/68Mfbe0Cz6KwSsHmijsvRko9
 yGaAFfMbsTJXbdU53C7hiwiCqoth5GGWH0kzCaP2iQU2eqTCkKEFBcc7kP7K1G+IJK/c
 zziw==
X-Gm-Message-State: AOJu0Yw3iQUD7UFn8//7G2RMBdJEPvc5wqGFBQzdOT93xx9/aM5lMXqG
 EFwZ8val0MPBtwdt6jk/An0n2bBrrLmjAa83Setr+y3DMEgaNNWuNrqVCjWqX6g=
X-Gm-Gg: ASbGncvXwWqn5Qa2CAPk0ad1VigTPj9XJQxlS0dfzrajcSOLpp7QGQedXE/EkrExF4h
 PV2AomuZJ9Ndmj2HNTPKhm2c8bxJAXDKWdfGU4SNq9zOWxWub0/gaUCIlmQgUXsRUQkD7pEp/EK
 OwKZXeWbe0nFEqLRR9eDqy2PQwaAOa+xk9hrwCqhdKEbps8X4TpNcpxKs+aa92C+Hoj8RZF4BWb
 yC8iD4H48MhwQrGJjpx2GGBq4dtUI5poOsbrmxXIM2iYyWAs8N5/8U/24ClM4M1gucmMo3kLc6A
 jw==
X-Google-Smtp-Source: AGHT+IHAPWq3CkTqb884aR/d8VurAELseRrmUvGdaB6/fMdCjUy6G/vrPGDzHX6uScNRdxLBnDQVgg==
X-Received: by 2002:a05:6a00:66e7:b0:725:f1e9:5334 with SMTP id
 d2e1a72fcca58-72f8b3c78c9mr20113730b3a.8.1737947036813; 
 Sun, 26 Jan 2025 19:03:56 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-72f8a69eb5esm5979397b3a.20.2025.01.26.19.03.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Jan 2025 19:03:56 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: iyzsong@HIDDEN
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <96be080084ef425fb5d5a8ab920d30667dc68c99.1737613671.git.iyzsong@HIDDEN>
 (iyzsong@HIDDEN's message of "Thu, 23 Jan 2025 14:28:56 +0800")
References: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
 <96be080084ef425fb5d5a8ab920d30667dc68c99.1737613671.git.iyzsong@HIDDEN>
Date: Mon, 27 Jan 2025 12:03:44 +0900
Message-ID: <8734h55567.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

iyzsong@HIDDEN writes:

> From: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
>
> This fixes <https://issues.guix.gnu.org/75523>.
>
> * gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.pa=
tch:

nitpick: I'd name this patch
gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch (s/respect/honor/).

[...]

> +              (patches
> +               (search-patches
> +                "gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch")=
)))
>      (build-system meson-build-system)
>      (outputs '("out" "debug"))
>      (arguments
> @@ -777,9 +780,8 @@ (define-public gdk-pixbuf
>       ;; This file is produced by the gdk-pixbuf-loaders-cache-file
>       ;; profile hook.
>       (list (search-path-specification
> -            (variable "GDK_PIXBUF_MODULE_FILE")
> +            (variable "GUIX_GDK_PIXBUF_MODULE_FILES")
>              (files (list %gdk-pixbuf-loaders-cache-file))
> -            (separator #f)              ;single valued
>              (file-type 'regular))))
>      (synopsis "Image loading library")
>      (description "GdkPixbuf is a library that loads image data in various
> diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODU=
LE_FILES.patch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MO=
DULE_FILES.patch
> new file mode 100644
> index 0000000000..eb22761403
> --- /dev/null
> +++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILE=
S.patch
> @@ -0,0 +1,18 @@
> +diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
> +index e1df590..ba24cf6 100644
> +--- a/gdk-pixbuf/gdk-pixbuf-io.c
> ++++ b/gdk-pixbuf/gdk-pixbuf-io.c
> +@@ -670,6 +670,13 @@ gdk_pixbuf_io_init (void)
> + 	gboolean ret;
> +=20
> + 	gdk_pixbuf_io_init_builtin ();
> ++
> ++	/* Load loaders from GUIX_GDK_PIXBUF_MODULE_FILES. */

nitpick: "Load loaders" reads a bit loaded ;-).  I'd write "Load modules
[...]" instead.

> ++	gchar **guix_module_files =3D g_build_guix_search_path_dirs ("GUIX_GDK=
_PIXBUF_MODULE_FILES");
> ++	for (int i =3D 0; guix_module_files[i] !=3D NULL; i++)

nitpick: I read a long time ago that ++i achieves the same and is more
efficient, though I forgot the reasons.  Probably doesn't matter here,
but could be neater (here and elsewhere).

Otherwise, for this commit alone,

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

(You'll want to give this series plenty of time for others to chime in).

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 02:59:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 21:59:25 2025
Received: from localhost ([127.0.0.1]:58584 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcFLR-0002A0-2X
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2025 21:59:25 -0500
Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:45232)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tcFLP-00029i-45
 for 75688 <at> debbugs.gnu.org; Sun, 26 Jan 2025 21:59:23 -0500
Received: by mail-pj1-x1032.google.com with SMTP id
 98e67ed59e1d1-2efd81c7ca4so5149127a91.2
 for <75688 <at> debbugs.gnu.org>; Sun, 26 Jan 2025 18:59:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737946757; x=1738551557; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=QkH7iDuTTIXksPZJPtrpUHbXTXwCb9opq8LdeirMDUI=;
 b=V331iRm0xxhubtQ0wDaMUzJsdlAFW3SnZ17F4pXQuG+O21T9uvPRiTx6I9fE31kdgE
 ghDSqsoiAY8oWtN5dF82DPxLDUs1gSkPMZZKMWTAaBgxkkmkogxIUmB9QLmcnGcXp8g+
 S2aX2Okqgu4+uD49tAzBE86wRrBtzd4BOu3/0N4qIfNza6kogyZA4MkDl0HDEXYsZNGv
 dwnG9oaMmtQYOgYZTO/pbMqyptSO7Yb3S5bGOvb5fyRXRa8rBeTrgfFNjBmqmWWEphNA
 h090aOATd5ljcJf+LPDp7EXV5vpPQIXWmwQ94fCo/6G38Ucqd5e4b+z9IQYa21HwNf+n
 j2mA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737946757; x=1738551557;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=QkH7iDuTTIXksPZJPtrpUHbXTXwCb9opq8LdeirMDUI=;
 b=UbNKtEvq9dEtN8dONpyFI2EsWVcIIUqnIsZmgYJW9jCN2UHqToGzEuI7K8f9DGeBn1
 L37A2/+8fwta4+JyxcPP9FUtMG1cQ0qjIFMECwLJwiGS08OLG7//GySppNTbAGF5Bfru
 RNF4vNwfGoC4IqLc+epwFF+lNU02HSWG8sLpWcoblavMEgWQ3T9NrXCpZOGwsB/FDtlg
 oaRrml3VxmeaBV5diUPJV62Ws3X4zS3Jl1kXZCuZ1SgwVNDnCCqsjoNaGvrv/Ak5wns2
 Duucd907lOj2f+LJiUn8KPEfLyvBUSM6a8r1reiQn4cmKj9XhfcTDpxDvu2Z5WnaJJM4
 6qGw==
X-Gm-Message-State: AOJu0YyBgER7+UKlmOnkXQY7fVpBeeoft4Gc4AXcbfQe2qH4fYMIhoeB
 EXuICnChBWaSkF/nK/MdW43Y+VmAFAQhypUQwhJstQrnpbn/BsnV
X-Gm-Gg: ASbGnctFknPs5x6JVEZDaxvLXATwT5/Sj8Q9W6TY4gTtBDNBsOxzUzXr5zBDEbHuGYE
 SP71D7HCgKTZv7wgMR6UJB2DYvnVm0Q/j4kEme8St9ruRiokHQ1JG5ipL6T8LAE7CRqvshyLook
 Z9RpumHStdlOV5Xd47nGFnYnzijkHPGoXo7TqP35p53etVgjY5KOZ9FbOUcmxrcGzqlIsDlK/8V
 yxnuouYmv3NXKNKljo2vtS/KlXKJmcn9QKckDtYP7h1EGxE6N2HidpqlxM4YQslTngFcfMDvvyb
 Hw==
X-Google-Smtp-Source: AGHT+IFxz/xSHDhLozo0VHSJ3L7e5v7gFXRPnTDrVIgK+WjcHpWS6JztuMzwmsCLJJUw3McNXNVM4g==
X-Received: by 2002:a17:90b:534c:b0:2f6:dcc9:38e0 with SMTP id
 98e67ed59e1d1-2f782b01f69mr67902032a91.0.1737946756871; 
 Sun, 26 Jan 2025 18:59:16 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2f7ffa56fbbsm5945603a91.16.2025.01.26.18.59.14
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Jan 2025 18:59:16 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: iyzsong@HIDDEN
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
 (iyzsong@HIDDEN's message of "Thu, 23 Jan 2025 14:28:55 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
Date: Mon, 27 Jan 2025 11:59:05 +0900
Message-ID: <877c6h55dy.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

iyzsong@HIDDEN writes:

> From: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
>
> Add a new function "g_build_guix_search_path_dirs" to GLIB, which in addi=
tion
> to environment variable, read search path values from etc/search-paths.d

Some typo/grammar nitpicks:

environment variableS, readS search path values from THE
etc/search-paths.d ...

> directory of the current executable.  This can be used to replace wrapper
> scripts.
>
> Use it for GUIX_GSETTINGS_SCHEMA_DIR, GUIX_GIO_EXTRA_MODULES,
> GUIX_XDG_DATA_DIRS and GUIX_XDG_CONFIG_DIRS.
>
> * gnu/packages/patches/glib-guix-search-paths.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/glib.scm (glib)[source]: Add patch.
> [native-search-paths]: Add GUIX_GSETTINGS_SCHEMA_DIR, Replace

nitpick: I'd use a '.  ' instead of ', ' above (two sentences).

[...]

> +++ b/gnu/packages/patches/glib-guix-search-paths.patch
> @@ -0,0 +1,158 @@

I think it'd be nice to forward a subset of this patch that implements
just the loading environment variable from a file, as that mechanism
seems like it could be generally useful (and upstreaming it would lower
the maintenance burden for us).

> +diff --git a/gio/giomodule.c b/gio/giomodule.c
> +index 76c2028..49b02bb 100644
> +--- a/gio/giomodule.c
> ++++ b/gio/giomodule.c
> +@@ -1330,6 +1330,13 @@ _g_io_modules_ensure_loaded (void)
> +       g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
> +       g_free (module_dir);
> +
> ++      /* GUIX: Load gio modules from GUIX_GIO_EXTRA_MODULES */

Let's not add credence to the Reddit's GUIX misspelling ;-).  I'd drop
'GUIX: ' from the beginning of your comment, as it's already clear from
the variable name.  Please add a period to make it a complete sentence.

[...]

> +diff --git a/glib/gutils.c b/glib/gutils.c
> +index 8628a56..bc21efc 100644

[...]

> ++gchar **
> ++g_build_guix_search_path_dirs (const gchar *variable)

> ++{
> ++  gchar **dirs =3D NULL;
> ++  char *value =3D NULL;
> ++  GStrvBuilder *builder =3D g_strv_builder_new ();
> ++
> ++#if defined(__linux__) || defined(__gnu_hurd__)
> ++  /* First add paths from the etc/search-paths.d, which can be used to =
replace wrapper script. */

I'd ensure all lines wrapped around the 80 characters mark (here and
everywhere else).

> ++  gchar *exe_path =3D g_file_read_link ("/proc/self/exe", NULL);
> ++  gchar *out_path =3D NULL;
> ++  gchar *search_paths_d =3D NULL;
> ++
> ++  /* We install executables under "bin" or "libexec", can also be a sub=
directory of "libexec". */
> ++  if (exe_path && (g_str_match_string("/bin/", exe_path, FALSE) ||
> ++                   g_str_match_string("/libexec/", exe_path, FALSE))) {

Perhaps these 'bin' and 'libexec' hard-coded names should come from the
build system of gdk-pixbuf, in case a distro uses different names across
its package collection (to make it more general).

> ++    /* Find output directory, which is the parent directory of "bin" or=
 "libexec". */
> ++    out_path =3D g_path_get_dirname (exe_path);
> ++    while (g_str_match_string("/bin/", out_path, FALSE) ||
> ++           g_str_match_string("/libexec/", out_path, FALSE)) {
> ++      gchar *dir_path =3D out_path;

Is the intent above to *copy* out_path into dir_path?  Currently that's
not done; we just point another pointer to it.

> ++      out_path =3D g_path_get_dirname (dir_path);

If g_path_get_dirname mutates dir_path, than dir_path should be a string
copy.  Otherwise if it doesn't get mutated by the call, we should be
able to use just:

out_path =3D g_path_get_dirname (out_path);

> ++      g_free (dir_path);
> ++    }
> ++
> ++    /* Now add paths from etc/search-paths.d/VARIABLE file. */
> ++    search_paths_d =3D g_build_filename (out_path, "etc", "search-paths=
.d", NULL);
> ++    if (g_file_test (search_paths_d, G_FILE_TEST_EXISTS)) {
> ++      gchar *var_path =3D g_build_filename (search_paths_d, variable, N=
ULL);
> ++      if (g_file_get_contents (var_path, &value, NULL, NULL)) {
> ++        dirs =3D g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
> ++        g_strv_builder_addv (builder, (const gchar **) dirs);
> ++        g_strfreev (dirs);
> ++        g_free (value);
> ++      }
> ++      g_free (var_path);
> ++    }
> ++  }
> ++
> ++  g_free (exe_path);
> ++  g_free (out_path);
> ++  g_free (search_paths_d);
> ++#endif
> ++
> ++  /* Then add paths from the environment variable. */
> ++  gboolean is_setuid =3D GLIB_PRIVATE_CALL (g_check_setuid) ();
> ++  if (is_setuid) /* we don't want to access arbitrary files when runnin=
g as setuid. */
> ++    value =3D NULL;
> ++  else
> ++    value =3D g_strdup (g_getenv (variable));
> ++
> ++  if (value && value[0]) {
> ++      dirs =3D g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
> ++      g_strv_builder_addv (builder, (const gchar **) dirs);
> ++      g_strfreev (dirs);
> ++  }
> ++  g_free (value);
> ++
> ++  dirs =3D g_strv_builder_end (builder);
> ++  g_strv_builder_unref (builder);
> ++  return dirs;
> ++}

Apart from my above comments, this looks good to me.  I think I'd stress
once more the value of upstreaming as much of this to ease maintenance
in the future.

Thanks for this novel idea/implementation!

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 27 Jan 2025 01:28:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 20:28:15 2025
Received: from localhost ([127.0.0.1]:58484 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcDvC-0006Et-L4
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2025 20:28:14 -0500
Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:44263)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tcDvA-0006Ed-Ue
 for 75688 <at> debbugs.gnu.org; Sun, 26 Jan 2025 20:28:13 -0500
Received: by mail-pj1-x102a.google.com with SMTP id
 98e67ed59e1d1-2f44353649aso5132296a91.0
 for <75688 <at> debbugs.gnu.org>; Sun, 26 Jan 2025 17:28:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737941287; x=1738546087; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=DAI5OgXNpdFzIkgHiyfT2SuSE4B8dFdEjTo8I4KAY5E=;
 b=JKzMzp7crviWKCXeCbTpNyODxkqnCHSgfvKLCulr7ucGsUFKxdyx2s/GAbWGvZRWR4
 zN7xgWDhX4XqWP5F1K9XNbEjhvZVqQUE5AZshEMr7/BMiwyfGU6eSswCBIwPaNus3kRf
 7Pr54FPOrddMtLQO7JEuxYGgabwBsH0BclHJ2RtgFzJ1jeXseJGgDuuK4gSvtajfNBIx
 bFBHdvkNjnXhyKUhLiT2rTUQcllTJ0ie93MbsFnMOdkbMyJI6fKgSVvEJ43YXT3vaSJ0
 2lx1m6a7lXpBwj4QConCTImdjHspdDN/XWMEzHNidEpfMAc8ZuCbTs9vNbAR9v5hdNyo
 YLcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737941287; x=1738546087;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=DAI5OgXNpdFzIkgHiyfT2SuSE4B8dFdEjTo8I4KAY5E=;
 b=SsZxrMHLA8YvEf49afDeGOF+89sdgjmyHanfbOQLE8msiyefXevAer5AbxQR1ITPOZ
 RnHZUvRe80ChdSSj3MHGDC9HMeql9UZyOVuviy4/+EhyPBjI577xK0rvbq750K6vqA96
 rhxy+AyQlxEB7mYTbnHXa6uti/8NA1u5Oc7h9j2qijLQFB2rDMDsoyhD7fTzsw4PExkG
 +/IsUWqZ/mf0t6Op3JgiiqrY0C/4KcNmMdSd3UDMC61y8YttfFevgRW/Olqvjy5Elul0
 7D5XYu4vtvRBh1D2oHCjf3kqvIuZFcPi4jFivx0qey1M6+1300shfxxAGPPQMjXos+4K
 QCYA==
X-Forwarded-Encrypted: i=1;
 AJvYcCXxvUSp+0M+LeBNilYPKXO5s+/L9i9P2e1loaAuG4087yVhJ+vpYQpFyGU0dFWF7LE1BDNIOA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwQ+mRO8s1W9RFIErBrGFnvbXByFy8LQvYnBnlVbYDWbHfJOpSg
 PqrSgiyk9z9g8ZG7E7rn4ASBIL02+sGM/kR9ybgAJDk+rXIHjFQm
X-Gm-Gg: ASbGncvLmOuVUNY9SpD4pj+atqftbk4Z+WFBR8B/EmRrA3RA8uxmI1dcfAw95+elcxz
 mCUE69FVRbckHY5iQrmEFX3USFMa/58myB+R7J96g6G12P857rQDe2SZuf9UnVRYt2Fu/OjArcF
 ZPSgJeqDfpWyATZuZBfi870IWmO2wkkDzmoxLXTLBA4BvWKcwMWNqL9IFk6RPPHBHaT7SEdLb+u
 M72CqZWxjHWJOpmds+xL3OCyWPuDwBFasAOZKhPc9NOni4i/EVTn6CARasFLP6zCm2W8zrHUe94
 vg==
X-Google-Smtp-Source: AGHT+IEaP42sK+ylVP8hPe/CgecYNrSm9tBsgo/UWVo10oUyoBBu/5BUdQKw2i2tv66fbUoq1n7Sfg==
X-Received: by 2002:a17:90b:534c:b0:2f6:dcc9:38e0 with SMTP id
 98e67ed59e1d1-2f782b01f69mr67553376a91.0.1737941286704; 
 Sun, 26 Jan 2025 17:28:06 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2f7ffa6a725sm6508349a91.21.2025.01.26.17.28.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 26 Jan 2025 17:28:06 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: bug#75688: GUIX_ify harmful environment variables and replace
 wrapper scripts with search path value files
In-Reply-To: <941dd634e317a301457a6803cc5389cebf869802.camel@HIDDEN>
 (Liliana Marie Prikler's message of "Thu, 23 Jan 2025 19:08:54 +0100")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
 <87o700p6xl.fsf@HIDDEN> <87tt9rr776.fsf@HIDDEN>
 <87r04vyyjv.fsf@HIDDEN>
 <941dd634e317a301457a6803cc5389cebf869802.camel@HIDDEN>
Date: Mon, 27 Jan 2025 10:27:54 +0900
Message-ID: <87ed0p59lx.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Liliana Marie Prikler <liliana.prikler@HIDDEN> writes:

> Am Mittwoch, dem 22.01.2025 um 17:42 +0800 schrieb =E5=AE=8B=E6=96=87=E6=
=AD=A6:
>> > You'd still have some glue code reading .VARIABLE and
>> > then doing a bunch of setenv before launching the actual program,
>> > no?  That glue code is currently the shell or Guile script used to
>> > wrap the binaries.
>>=20
>> The point for those .VARIABLE files is without wrapper scripts
>> there're no setenv call anymore, ensure that getenv only get profiles
>> paths, in another words: reading from file and apply the values
>> replaced setenv then getenv and apply the values.
> I think this is too big a change to be sneakily added onto a
> replacement for an upstream environment variable with a GUIX_-prefixed
> one.  I think this should be discussed more broadly, using a Guix
> Consensus Document for example.

I was thinking about the GCD too, it's a bit more work, but this
solution appears novel and impacting enough to want to ensure all Guix
participants are aware of it and discuss any shortcoming it might have
in its current form.

> As for adding GUIX_GDK_PIXBUF_MODULE_FILES, I think this could safely
> be done on gnome-team.
>
> What do y'all think?

I've posted some comments on the issue for the later.

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 24 Jan 2025 02:47:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 21:47:56 2025
Received: from localhost ([127.0.0.1]:43027 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tb9jg-0003QW-49
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 21:47:56 -0500
Received: from mail.envs.net ([5.199.136.28]:49942)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tb9jb-0003QL-PU
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 21:47:53 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 9EBA838A2BDE;
 Fri, 24 Jan 2025 02:47:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737686869; bh=sCWSCBm19BEB+miNorrkSsMmi3RDhfpE6LdhU9xS2rI=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=aNK+BzcL4jXXgMnW+Xp62POF9tZ3T6sbSwMrtIGhT/Ncg6/Nyck8pe/rM3Lh1VZj5
 mGx+KKg2PJ3TYY/g+ST8JQVHv0c3sglr/jAMeRNEfLqDMKBo3nJQyUYH+jvqTHXsQo
 impk8IH8fF5O0F4Ykfii8yBGsAiNiQcscR8w6VTNlmzh8hNYCcaluyJCb/Hqma0PCg
 wFdA2/kRIGv4i2RkP1GlEvzQvGEJ0ZQtcSNFuB8wHnhJUhX8Wx8pkcqM/tMWq2yI/K
 mrQ2lObMtqpGelRUd0aX59kTL8VQ1aCuP48CtMkSRrbZuTDUjyhDxgb4P0mZZXxT4K
 Yz6dSffeU7SBtiCL9pG/6Y0PCbie+PjUeBkYgLPme/u8BLQsVE3BujEd48S2O9C2xu
 aHoOy/2rQb/bhsd1PYkoZPexlyInbDV6J1VWIM+h0pzNYnJq/PvIhusfkYdLfC7LpJ
 lsC3ElsqITaXbRvheWoBiNQvcQb5u8VTT79+aOwYvkQyXLuWjgLcfs+d/DIIiMogj/
 d8Lsm3wUlBgYud7FpwO7slOWI+bms/p9X/R265/iDGbtMED74VBnIH58MTpvYkr/cs
 SY7LSDMPswVdqIzsJ6gO+9/H2TrKgnE0bgiCQ38pA9YwVkiaWJh1l8n99nwX4IIVPE
 +xV+byjQrW/DCKGm0/wrybEc=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id T9B_s0BC1iuJ; Fri, 24 Jan 2025 02:47:42 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Fri, 24 Jan 2025 02:47:42 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id f119b864;
 Fri, 24 Jan 2025 02:51:12 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <941dd634e317a301457a6803cc5389cebf869802.camel@HIDDEN>
 (Liliana Marie Prikler's message of "Thu, 23 Jan 2025 19:08:54 +0100")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
 <87o700p6xl.fsf@HIDDEN> <87tt9rr776.fsf@HIDDEN>
 <87r04vyyjv.fsf@HIDDEN>
 <941dd634e317a301457a6803cc5389cebf869802.camel@HIDDEN>
Date: Fri, 24 Jan 2025 10:51:12 +0800
Message-ID: <87r04s6i1r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Liliana Marie Prikler <liliana.prikler@HIDDEN> writes:

> Am Mittwoch, dem 22.01.2025 um 17:42 +0800 schrieb =E5=AE=8B=E6=96=87=E6=
=AD=A6:
>> > You'd still have some glue code reading .VARIABLE and
>> > then doing a bunch of setenv before launching the actual program,
>> > no?  That glue code is currently the shell or Guile script used to
>> > wrap the binaries.
>>=20
>> The point for those .VARIABLE files is without wrapper scripts
>> there're no setenv call anymore, ensure that getenv only get profiles
>> paths, in another words: reading from file and apply the values
>> replaced setenv then getenv and apply the values.
> I think this is too big a change to be sneakily added onto a
> replacement for an upstream environment variable with a GUIX_-prefixed
> one.  I think this should be discussed more broadly, using a Guix
> Consensus Document for example.

Okay, I'll try a GCD later.


> As for adding GUIX_GDK_PIXBUF_MODULE_FILES, I think this could safely
> be done on gnome-team.
>
> What do y'all think?

Sure, I'll send a patch for that later.

Thanks.




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 18:08:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 13:08:54 2025
Received: from localhost ([127.0.0.1]:42281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tb1dO-0004SL-4T
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 13:08:54 -0500
Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:50182)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <liliana.prikler@HIDDEN>)
 id 1tb1dM-0004S7-Gb
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 13:08:53 -0500
Received: by mail-wm1-x343.google.com with SMTP id
 5b1f17b1804b1-43690d4605dso8698585e9.0
 for <75688 <at> debbugs.gnu.org>; Thu, 23 Jan 2025 10:08:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737655726; x=1738260526; darn=debbugs.gnu.org;
 h=mime-version:user-agent:content-transfer-encoding:references
 :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject
 :date:message-id:reply-to;
 bh=DrXN46W4TjLkexRl0Pd7lI+KF8JX4ZAnmhBLvt64QbE=;
 b=jLGyl2T7CVfxUholr9MrmzaI2WpFHjPvXpuf/s3iWmsG2CP0FiUFrfKKbM7hYGvx5p
 4Y4qc6Rc1ska4Grtcb4QjcwoOxL/zNNbF5u5fMKrHVB2AOhX9wIdNrWt3//rcXJbf/+8
 viNdQvcW55hmy6+47Ew6Ox+jrMJ5aXy32iQwItXsUcjLGqnd3DznikU8MsnDrl7eqffW
 VA7R9J8l/Pxovg8LUFHr7SCmDY2DWprl6LVtprkjUHQf8GI7MQESdN7zZxylvVHoyvvi
 hfvrLJP31bofS1aOTY+b9UdY7x6HxEN/GDWBxL39zg+NTzbePZcn/rImCpQVQ2LL7ZBx
 CDYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737655726; x=1738260526;
 h=mime-version:user-agent:content-transfer-encoding:references
 :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=DrXN46W4TjLkexRl0Pd7lI+KF8JX4ZAnmhBLvt64QbE=;
 b=RpsaI10B3xjvObxWtMb61kxIlyWWbIBvbErt/hMXDRupSBy8WOZ0NKb96dKMMfLq28
 RzxMB/Ax7NG/x+B6GIPnFwyk0fVGnvHK7vco8xURW50fq3AiGuBOCNzTxkIp4Jo5aFLK
 Oi6iwL9dh3JebhluL+qfB0Q5EpqIiZ8wlQkS61bpz1kxj5V6SBrIwwgWCQEi0e+7FrW/
 9HA/Daw6LKiS5wI1ykiQ57UgKds6sz23MkJYf+Y4LUdE/U2BoGt7yoagQMyBX6XAm+mC
 PusQjGYaRzxTBxXRzOJcPUfmFilunqvovJDdUrqa0kRK7QTVzWth9VUrK7a6um7/jIIK
 RvCg==
X-Gm-Message-State: AOJu0Yz9zxb83a8eI8ermvzbhzIxsEMsUxZbBFQt65VEvE+S57R3Xi7L
 LyEt6Ott52i+tCMhb4IvsTSr7QmH3WTHP0QmUmHIoeb4OUpzHwosTk3kHZg7
X-Gm-Gg: ASbGncvdrSgV7Nf9/oQWFYW6n5lMkEiU7df2yqFOMJcXzLOWfoirwjWpjrUWylXP0Hc
 fmqHmO+0rSB9nD8dR6YMJ2fiJX8alKvZD+HleSJv+nsEGST6PZN0BrMe3damStH2JFr9vEJtFiP
 N2ktjRLcpvuiZoVdd3Gj/mpp+CbLuUEFgEUDN4JpyWA8XHz1SknJhZWGx8nhM4QS1bb2qNmqgOX
 Rw8JkHaYqVPJDmi3MrwpQk8dRaA9tap9Oi7/aVIToR1E0lo9f0Menx5jxCaq7vwqfcGUGIf6LId
 gcrOxmxvFKh9TFmmS5kIY4D/R2gdyHzFN+Bk6JAISLmlTZkJZqSuutpBQFdbg2LjYo0=
X-Google-Smtp-Source: AGHT+IFsGC4VjVrOe89Hz7+Wfs3aB4wpME/ul8+CeKXndeSYE7xn3uUo0nls29xrObTnr3DTNNUVkg==
X-Received: by 2002:a5d:47c4:0:b0:38c:1281:260d with SMTP id
 ffacd0b85a97d-38c12813249mr15148665f8f.31.1737655726058; 
 Thu, 23 Jan 2025 10:08:46 -0800 (PST)
Received: from lumine.fritz.box (85-127-114-32.dsl.dynamic.surfer.at.
 [85.127.114.32]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38c2a1bb040sm332803f8f.67.2025.01.23.10.08.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2025 10:08:45 -0800 (PST)
Message-ID: <941dd634e317a301457a6803cc5389cebf869802.camel@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>, Maxim
 Cournoyer <maxim.cournoyer@HIDDEN>
Date: Thu, 23 Jan 2025 19:08:54 +0100
In-Reply-To: <87r04vyyjv.fsf@HIDDEN>
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
 <87o700p6xl.fsf@HIDDEN> <87tt9rr776.fsf@HIDDEN>
 <87r04vyyjv.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.48.4 
MIME-Version: 1.0
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org,
 =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Am Mittwoch, dem 22.01.2025 um 17:42 +0800 schrieb =E5=AE=8B=E6=96=87=E6=AD=
=A6:
> > You'd still have some glue code reading .VARIABLE and
> > then doing a bunch of setenv before launching the actual program,
> > no?  That glue code is currently the shell or Guile script used to
> > wrap the binaries.
>=20
> The point for those .VARIABLE files is without wrapper scripts
> there're no setenv call anymore, ensure that getenv only get profiles
> paths, in another words: reading from file and apply the values
> replaced setenv then getenv and apply the values.
I think this is too big a change to be sneakily added onto a
replacement for an upstream environment variable with a GUIX_-prefixed
one.  I think this should be discussed more broadly, using a Guix
Consensus Document for example.

As for adding GUIX_GDK_PIXBUF_MODULE_FILES, I think this could safely
be done on gnome-team.

What do y'all think?




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 06:40:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 01:40:00 2025
Received: from localhost ([127.0.0.1]:38777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taqsi-0008Bv-Fx
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:40:00 -0500
Received: from mail.envs.net ([5.199.136.28]:50332)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taqsf-0008Bm-Tr
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:39:58 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 5B47638A2C5A;
 Thu, 23 Jan 2025 06:39:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737614396; bh=baq5j5LMUOfGwNlV+oEyT6ZbB3GpMSHvmlUZcGucNDg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=f1YFthJvyI/CNZ7dWQWUdkQZTIMD7dbOYRa7ZgG8BftrKit6goHhJ8NcHvU1YrYUn
 s3JZ0xEXjEf1M+UsVgFNaOLuwv/EctK53RrzA1ZYkWsvn087SGlBPNlPbILwqxK7nG
 vvV7bKbHIVabBxKCkNmYJz3liJgcIaps6/TXqoYNd62nhiY0W1L/Mqb/3WEExI6CQ8
 ooGsmP/Cl3xBOfcuJVnisRtlhFM0VEUxuRTldfM+vAaS51LYTbK3wQ8n/bIvTJUmpy
 xrxq1YvSe2heKZVWGyhhnmFAKaGc4NfYOROpm7ufJDXkPrMbtFNXJqZ7XEpG9nUZL3
 gaXKTOmG0E7IWhS4jauuKWMNoW7OoX8A1dUZqDJfgtakBKjU4uaNexpgNRTCHNHiGH
 3DBvBChlafuivYnEDlxwBudyQM8XIv56KijCtAP6LZSUendMtPxfyzuhrTlvhIqwZy
 YjXsK4xHfW+CFR0Vr2Y5ae7dpczjXsZn9GRQw3WPdB00hiNcPL4rNpqSDCMXiObZn/
 3086+QNx3FYSkc/o04oPWQ/UzCjBMWHR48wPt7gP7qJPB0TLD3FfiV1pgSaxm8EB40
 XwRpxJEK/M9IaU5C0+q5gEjQ0imkcuMRd3LKqeYgZKlMZrnpiCvmlkWzPA//EvXZo/
 sXI7lKbhYNAivQ9rDin8fLYE=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id DlhqRMHd6E5E; Thu, 23 Jan 2025 06:39:49 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Thu, 23 Jan 2025 06:39:49 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 7e9740c3;
 Thu, 23 Jan 2025 06:43:22 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87sepcs3z9.fsf@HIDDEN> (Maxim Cournoyer's message of "Tue, 21
 Jan 2025 22:15:06 +0900")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87sepcs3z9.fsf@HIDDEN>
Date: Thu, 23 Jan 2025 14:43:22 +0800
Message-ID: <87frla81yt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

> It's too early for me to say if it could really work, but I'll repeat
> that a priori I'm not too fond of GUIX_LIBRARY_PATH (just the name would
> clash with a GCC env var too) and custom logic that'd need to be
> maintained in the software (we'd need to patch the software to have
> GUIX_* variables anyway but the resulting patch would be trivial); I
> think I'd rather have multiple, explicit environment variables computed
> by search paths.

v2 patches sent to use multiple variables, replace the use of wrapper
scripts in glib-or-gtk-build-system with 'search-paths.d' files.
Patches for glib, gdk-pixbuf and gtk(s) while not trivial, seems
reasonable to me..


> Just to make sure, GUIX_* variables would be honored *on top* of their
> non GUIX_ prefixed (stock) variants, right?  E.g. we wouldn't want GCC
> to stop honoring LIBRARY_PATH even if we add GUIX_LIBRARY_PATH, as that
> would confuse users.

Yes, and non prefixed ones have higher priority than GUIX_ ones, to
allow overrides.

The patches require mass rebuilds due to glib-or-gtk-build-system ->
meson/cmake/rust, etc.  I haven't test them, but show be fine for review
now, if it seems fine, I could work on qt.

Also nix have the same issue, http://github.com/nixos/nixpkgs/issues/60260
Maybe we could share the maintaince of patches with them somehow.

Thanks.




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 06:26:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 01:26:10 2025
Received: from localhost ([127.0.0.1]:38743 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taqfJ-0007U9-4m
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:26:10 -0500
Received: from mail.envs.net ([5.199.136.28]:52166)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taqfA-0007T8-Qi
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:26:02 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id E7F5B38A3E53;
 Thu, 23 Jan 2025 06:25:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737613559; bh=G7erAM1Py70vcrHfbE6aWiu2zVmRxzrQ+W5yk2hhb3A=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=FQULegF7dfeM9S21gazYBo5JPZoO+ODJg2IrdyMTQF9LB0sTScuIo3a168XlDe74V
 SOpmxlgiQ/79nLndmVd4tpZngRtCypCczPHLr8X5Tn0WxYDB+BSkyrKxpW4NiWAA4T
 IP51cnM2NtupktYdtMvGg7T5jvBqnJrCIXAC5JmIDSFcMMITkpvIADl4sGHjPjvDbK
 uTfuVabAN0fgWAW/SRbEoHsAKfYO4O1aB0Rh57XazZYp3O2Dsrm6Ub2qS3ic1ls9BI
 +l0n7di0DtWCHEVV7aX6ZXEo6w5itKQZ3MVniF9mPp4NwmTbUAnV4tYZYfUDoinhYe
 ut+b9xYIbCSh72JD2bEvw9McfnSRU++VT1ousFtWSPhmV8Q7LPdnDcsctpZ9pwOabM
 Mc4J+UUKmHATii0bFA/HY7AhVpQInI9/ZyfsQhVFJ+VOTEbE73TcsfNNRLJTyA+p9a
 6wgcgOdjJbDtBGoMbAnRsO2QKZuSmItzK3Frz5KbsqFUy+ZaHPy9qXMLETe8d/l9uy
 dEWPm3umB70L3XNObPZQxUFdKj3xh7f7hIINEDhS/pXpl3Y9CGldqJpVUa5PjR9ixB
 O0Fm/siqf4WnIM136WMsq4uRJu5DMH0OZtI4CDEsIIhm61sH2wa4wa4X9qlzugTv79
 g4tVKjtbr3RPLGDI/iqwHTsA=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id UESCZvR8rFHt; Thu, 23 Jan 2025 06:25:56 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Thu, 23 Jan 2025 06:25:55 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 55cbef31;
 Thu, 23 Jan 2025 06:29:11 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v2 4/4] build: glib-or-gtk-build-system: Replace wrapper
 scripts with 'search-paths.d'.
Date: Thu, 23 Jan 2025 14:28:58 +0800
Message-ID: <96b1c701576df682137650386544821196e2152d.1737613671.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
References: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* guix/build/glib-or-gtk-build-system.scm (write-search-path-file): New procedure.
(gtk-module-directories): Add version to arguments.
(gsettings-schema-directories): New procedure.
(data-directories): Don't check for "/glib-2.0/schemas".
(conf-directories): New procedure.
(wrap-all-programs): Rewrite in terms of 'write-search-path-file'.

Change-Id: I1c9e8d491b96e298d1568a5e29b04c762c26e4d1
---
 guix/build/glib-or-gtk-build-system.scm | 165 ++++++++++++++----------
 1 file changed, 94 insertions(+), 71 deletions(-)

diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm
index 67a52ddad3..a04c1b0616 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Mark H Weaver <mhw@HIDDEN>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
+;;; Copyright © 2025 宋文武 <iyzsong@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +40,13 @@ (define-module (guix build glib-or-gtk-build-system)
 ;;
 ;; Code:
 
+(define* (write-search-path-file output variable value)
+  "Write VALUE to @file{etc/search-paths.d/VARIABLE} under OUTPUT."
+  (let ((search-paths.d (string-append output "/etc/search-paths.d")))
+    (mkdir-p search-paths.d)
+    (with-output-to-file (string-append search-paths.d "/" variable)
+      (lambda () (display variable)))))
+
 (define (subdirectory-exists? parent sub-directory)
   (directory-exists? (string-append parent sub-directory)))
 
@@ -47,32 +55,12 @@ (define (directory-included? directory directories-list)
   (fold (lambda (s p) (or (string-ci=? s directory) p))
         #f directories-list))
 
-;; We do not include $HOME/.guix-profile/gtk-v.0 (v=2 or 3) because we do not
-;; want to mix gtk+-2 and gtk+-3 modules.  See
-;; https://developer.gnome.org/gtk3/stable/gtk-running.html
-(define (gtk-module-directories inputs)
-  "Check for the existence of \"libdir/gtk-v.0\" in INPUTS.  Return a list
+;; We load GTK modules via the GUIX_GTK2_PATH, GUIX_GTK3_PATH and GUIX_GTK4_PATH
+;; search paths.
+(define (gtk-module-directories inputs version)
+  "Check for the existence of \"libdir/gtk-VERSION\" in INPUTS.  Return a list
 with all found directories."
-  (let* ((version
-          (cond
-           ((string-match "gtk-4"
-                          (or (assoc-ref inputs "gtk")
-                              (assoc-ref inputs "source")
-                              ""))
-            "4.0")
-           ((string-match "gtk\\+-3"
-                          (or (assoc-ref inputs "gtk+")
-                              (assoc-ref inputs "source")
-                              ""))
-            "3.0")
-           ((string-match "gtk\\+-2"
-                          (or (assoc-ref inputs "gtk+")
-                              (assoc-ref inputs "source")
-                              ""))
-            "2.0")
-           (else
-            "4.0"))) ; We default to version 4.0.
-         (gtk-module
+  (let ((gtk-module
           (lambda (input prev)
             (let* ((in (match input
                          ((_ . dir) dir)
@@ -85,27 +73,22 @@ (define (gtk-module-directories inputs)
                   prev)))))
     (fold gtk-module '() inputs)))
 
-;; See
+;; XDG data files include themes, sounds, icons, etc. See:
 ;; http://www.freedesktop.org/wiki/DesktopThemeSpec
 ;; http://freedesktop.org/wiki/Specifications/sound-theme-spec
 ;; http://freedesktop.org/wiki/Specifications/icon-theme-spec
 ;;
-;; Currently desktop themes are not well supported and do not honor
-;; XDG_DATA_DIRS.  One example is evince which only looks for desktop themes
-;; in $HOME/.themes (for backward compatibility) and in XDG_DATA_HOME (which
-;; defaults to $HOME/.local/share).  One way to handle these applications
-;; appears to be by making $HOME/.themes a symlink to
-;; $HOME/.guix-profile/share/themes.
+;; We load them via XDG_DATA_DIRS (from profile, has higher priority) and
+;; GUIX_XDG_DATA_DIRS (application specified) search paths.
 (define (data-directories inputs)
-  "Check for the existence of \"$datadir/glib-2.0/schemas\" or XDG themes data
-in INPUTS.  Return a list with all found directories."
+  "Check for the existence of XDG data files in INPUTS.  Return a list with all found
+directories."
   (define (data-directory input previous)
     (let* ((in (match input
                  ((_ . dir) dir)
                  (_ "")))
            (datadir (string-append in "/share")))
-      (if (and (or (subdirectory-exists? datadir "/glib-2.0/schemas")
-                   (subdirectory-exists? datadir "/sounds")
+      (if (and (or (subdirectory-exists? datadir "/sounds")
                    (subdirectory-exists? datadir "/themes")
                    (subdirectory-exists? datadir "/cursors")
                    (subdirectory-exists? datadir "/wallpapers")
@@ -117,15 +100,45 @@ (define (data-directories inputs)
 
   (fold data-directory '() inputs))
 
+;;; XDG configuration files are expected to be installed in etc/xdg directory.
+;;; We load them via XDG_CONFIG_DIRS (from profile, has higher priority) and
+;;; GUIX_XDG_CONFIG_DIRS (application specified) search paths.
+(define (conf-directories inputs)
+  "Check for the existence of XDG configuration files in INPUTS.  Return a list with
+all found directories."
+  (define (conf-directory input previous)
+    (let* ((in (match input
+                 ((_ . dir) dir)
+                 (_ "")))
+           (conf-dir (string-append in "etc/xdg")))
+      (if (and (directory-exists? conf-dir)
+               (not (directory-included? conf-dir previous)))
+          (cons conf-dir previous)
+          previous)))
+
+  (fold conf-directory '() inputs))
+
+;;; GIO GSettings schemas are expected to be installed in $datadir/glib-2.0/schemas
+;;; directory.  We load them via the GUIX_GSETTINGS_SCHEMA_DIR search path.
+(define (gsettings-schema-directories inputs)
+  "Check for the existence of \"$datadir/glib-2.0/schemas\" in INPUTS.
+Return a list with all found directories."
+  (define (gsettings-schema-directory input previous)
+    (let* ((in (match input
+                 ((_ . dir) dir)
+                 (_ "")))
+           (schema-dir (string-append in "/share/glib-2.0/schemas")))
+      (if (and (directory-exists? schema-dir)
+               (not (directory-included? schema-dir previous)))
+          (cons schema-dir previous)
+          previous)))
+
+  (fold gsettings-schema-directory '() inputs))
+
 ;; All GIO modules are expected to be installed in GLib's $libdir/gio/modules
 ;; directory.  That directory has to include a file called giomodule.cache
-;; listing all available modules.  GIO can be made aware of modules in other
-;; directories with the help of the environment variable GIO_EXTRA_MODULES.
-;; The official GIO documentation states that this environment variable should
-;; only be used for testing and not in a production environment.  However, it
-;; appears that there is no other way of specifying multiple modules
-;; directories (NIXOS also does use this variable). See
-;; https://developer.gnome.org/gio/stable/running-gio-apps.html
+;; listing all available modules.  We load them via the GUIX_GIO_EXTRA_MODULES
+;; search path.
 (define (gio-module-directories inputs)
   "Check for the existence of \"$libdir/gio/modules\" in the INPUTS and
 returns a list with all found directories."
@@ -141,50 +154,60 @@ (define (gio-module-directories inputs)
 
   (fold gio-module-directory '() inputs))
 
+
 (define* (wrap-all-programs #:key inputs outputs
                             (glib-or-gtk-wrap-excluded-outputs '())
                             #:allow-other-keys)
   "Implement phase \"glib-or-gtk-wrap\": look for GSettings schemas and
-gtk+-v.0 libraries and create wrappers with suitably set environment variables
+GTK libraries and create etc/search-paths.d with suitably set of files
 if found.
 
 Wrapping is not applied to outputs whose name is listed in
 GLIB-OR-GTK-WRAP-EXCLUDED-OUTPUTS.  This is useful when an output is known not
 to contain any GLib or GTK+ binaries, and where wrapping would gratuitously
-add a dependency of that output on GLib and GTK+."
-  ;; Do not require bash to be present in the package inputs
-  ;; even when there is nothing to wrap.
-  ;; Also, calculate (sh) only once to prevent some I/O.
-  (define %sh (delay (search-input-file inputs "bin/bash")))
-  (define (sh) (force %sh))
+add a dependency of that output on GLib and GTK."
   (define handle-output
     (match-lambda
       ((output . directory)
        (unless (member output glib-or-gtk-wrap-excluded-outputs)
-         (let* ((bindir       (string-append directory "/bin"))
-                (libexecdir   (string-append directory "/libexec"))
-                (bin-list     (filter (negate wrapped-program?)
-                                      (append (find-files bindir ".*")
-                                          (find-files libexecdir ".*"))))
-                (datadirs     (data-directories
+         (let* ((datadirs     (data-directories
                                (alist-cons output directory inputs)))
-                (gtk-mod-dirs (gtk-module-directories
+                (confdirs     (conf-directories
                                (alist-cons output directory inputs)))
-                (gio-mod-dirs (gio-module-directories
+                (schemadirs   (gsettings-schema-directories
                                (alist-cons output directory inputs)))
-                (env-vars `(,@(if (not (null? datadirs))
-                                  (list `("XDG_DATA_DIRS" ":" prefix ,datadirs))
-                                  '())
-                            ,@(if (not (null? gtk-mod-dirs))
-                                  (list `("GTK_PATH" ":" prefix ,gtk-mod-dirs))
-                                  '())
-                            ,@(if (not (null? gio-mod-dirs))
-                                  (list `("GIO_EXTRA_MODULES" ":"
-                                          prefix ,gio-mod-dirs))
-                                  '()))))
-           (for-each (lambda (program)
-                       (apply wrap-program program #:sh (sh) env-vars))
-                     bin-list))))))
+                (gtk2-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "2.0"))
+                (gtk3-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "3.0"))
+                (gtk4-mod-dirs (gtk-module-directories
+                                (alist-cons output directory inputs)
+                                "4.0"))
+                (gio-mod-dirs (gio-module-directories
+                               (alist-cons output directory inputs))))
+           (when (not (null? datadirs))
+             (write-search-path-file output "GUIX_XDG_DATA_DIRS"
+                                     (string-join datadirs ":")))
+           (when (not (null? confdirs))
+             (write-search-path-file output "GUIX_XDG_CONFIG_DIRS"
+                                     (string-join confdirs ":")))
+           (when (not (null? schemadirs))
+             (write-search-path-file output "GUIX_GSETTINGS_SCHEMA_DIR"
+                                     (string-join schemadirs ":")))
+           (when (not (null? gtk2-mod-dirs))
+             (write-search-path-file output "GUIX_GTK2_PATH"
+                                     (string-join gtk2-mod-dirs ":")))
+           (when (not (null? gtk3-mod-dirs))
+             (write-search-path-file output "GUIX_GTK3_PATH"
+                                     (string-join gtk3-mod-dirs ":")))
+           (when (not (null? gtk4-mod-dirs))
+             (write-search-path-file output "GUIX_GTK4_PATH"
+                                     (string-join gtk4-mod-dirs ":")))
+           (when (not (null? gio-mod-dirs))
+             (write-search-path-file output "GUIX_GIO_EXTRA_MODULES"
+                                     (string-join gio-mod-dirs ":"))))))))
 
   (for-each handle-output outputs))
 
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 06:26:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 01:26:09 2025
Received: from localhost ([127.0.0.1]:38741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taqfI-0007U6-EK
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:26:09 -0500
Received: from mail.envs.net ([5.199.136.28]:52152)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taqf7-0007Sq-KK
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:26:02 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id B792338A3E52;
 Thu, 23 Jan 2025 06:25:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737613556; bh=zWu41/CBIoo2ICxmGaAKoDqJ5EwUYXH6Z0OSbiCeVzY=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=QkRg2WXTCtRQ3jqLorYxZ3Yms/bCeCkLL2bzTVHuzWMg54JSdF+ykkMzB0Zos2xBP
 FIB4LrKs+S3PGdDovvGErJDkY0UZiOu586zdPtgZ0Kw45SSRz1kEjMkKwx+hz3WxKm
 JntaYxs0a6xdkQ+gPljmNg71xyEdGs3G6tWIe/LStLXO08cHvqfSbl9D8KNtdOJKu+
 apCSWIB5BR1/ZTOY8f4/lsZiKWyIBM+1me235vnYCRaCxB8RwmdAkMwh9WII/Js1Rn
 cWEo6hMz20cfMDyOEU+zz7aMM/6cenkej5IBnFcFopkJhwrFllKcOHG4z0GGkw8pR6
 soA+liZK/PZYxord0zfMYM9o/Ve+KVGnztHgwWpNTB1RcLu6oTi+0MV6GcdXVaGw2T
 QmY1lLPSzMPkAuVtSPPFCgyUaf019mLTL5+UwVa965U74mMW7fW8/dUq2gEtJcy5e0
 C5O6wGh62sVf9++zHNK8UKsF4C/pKp3ssdsE5iY/YQXaG0gLiLWitosToBVZB/nhjV
 ENNwEjpr5N9eAvptBrscY82O7cfDIOMY5Ftfcz6gioRQARmDrGWc/itbrx0meV8pgS
 17wFPb4H5y6EOuN/S11VmlUy0fmzb4LADoUrQiAaPOZTT3JtoQblGdJm8KxNCoE0Xq
 6+93skZgMQgUeuofIKIDXXE4=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id bMHQe3MqYrj5; Thu, 23 Jan 2025 06:25:53 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Thu, 23 Jan 2025 06:25:52 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 19ba942d;
 Thu, 23 Jan 2025 06:29:11 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v2 3/4] gnu: gtk: Add search-paths.d support for GUIX_GTK{2, 3,
 4}_PATH.
Date: Thu, 23 Jan 2025 14:28:57 +0800
Message-ID: <a22dda0eb30660d90f25a3ec0862d9332b9ab542.1737613671.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
References: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch,
gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch,
gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch: Rewrite in terms
of 'g_build_guix_search_path_dirs'.

Change-Id: Ib0748c39e56fd598f30f40b9ac3bb0f012f14c31
---
 .../patches/gtk2-respect-GUIX_GTK2_PATH.patch | 64 ++++++-------------
 .../patches/gtk3-respect-GUIX_GTK3_PATH.patch | 55 ++++++----------
 .../patches/gtk4-respect-GUIX_GTK4_PATH.patch | 62 +++++-------------
 3 files changed, 54 insertions(+), 127 deletions(-)

diff --git a/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch b/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
index 93a8ddc242..fb6c7809f9 100644
--- a/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
+++ b/gnu/packages/patches/gtk2-respect-GUIX_GTK2_PATH.patch
@@ -1,46 +1,20 @@
-This patch makes GTK+ look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK2_PATH".  This can be used
-instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
-other major versions of GTK+.
+diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
+index 50729b61a5..2d4c2c2a85 100644
+--- a/gtk/gtkmodules.c
++++ b/gtk/gtkmodules.c
+@@ -96,5 +96,15 @@ get_module_path (void)
+   result = pango_split_file_list (module_path);
+   g_free (module_path);
 
---- a/gtk/gtkmodules.c	2014-09-29 22:02:17.000000000 +0200
-+++ b/gtk/gtkmodules.c	2015-12-02 18:41:53.306396938 +0100
-@@ -55,6 +55,7 @@
- get_module_path (void)
- {
-   const gchar *module_path_env;
-+  const gchar *module_guix_gtk2_path_env;
-   const gchar *exe_prefix;
-   const gchar *home_dir;
-   gchar *home_gtk_dir = NULL;
-@@ -70,6 +71,7 @@
-     home_gtk_dir = g_build_filename (home_dir, ".gtk-2.0", NULL);
- 
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk2_path_env = g_getenv ("GUIX_GTK2_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
- 
-   if (exe_prefix)
-@@ -77,9 +79,21 @@
-   else
-     default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", NULL);
- 
--  if (module_path_env && home_gtk_dir)
-+  if (module_guix_gtk2_path_env && module_path_env && home_gtk_dir)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, module_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env && home_gtk_dir)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, module_path_env, default_dir, NULL);
-+  else if (module_path_env && home_gtk_dir)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, home_gtk_dir, default_dir, NULL);
-+  else if (module_guix_gtk2_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk2_path_env, default_dir, NULL);
-   else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
++  /* GUIX: Load additional modules from GUIX_GTK2_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK2_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
diff --git a/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch b/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
index 66fd2fd1c4..28e232a812 100644
--- a/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
+++ b/gnu/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch
@@ -1,38 +1,21 @@
-This patch makes GTK+ look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK3_PATH".  This can be used
-instead of "GTK_PATH" to make GTK+ find modules that are incompatible with
-other major versions of GTK+.
-
---- a/gtk/gtkmodules.c	2015-09-20 20:09:05.060590217 +0200
-+++ b/gtk/gtkmodules.c	2015-09-20 20:10:33.423124833 +0200
-@@ -52,6 +52,7 @@
- get_module_path (void)
- {
-   const gchar *module_path_env;
-+  const gchar *module_guix_gtk3_path_env;
-   const gchar *exe_prefix;
-   gchar *module_path;
-   gchar *default_dir;
-@@ -61,6 +62,7 @@
-     return result;
+diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
+index f93101c272..b57e1da802 100644
+--- a/gtk/gtkmodules.c
++++ b/gtk/gtkmodules.c
+@@ -81,6 +81,16 @@ get_module_path (void)
+   result = gtk_split_file_list (module_path);
+   g_free (module_path);
  
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk3_path_env = g_getenv ("GUIX_GTK3_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
++  /* GUIX: Load additional modules from GUIX_GTK3_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK3_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
  
-   if (exe_prefix)
-@@ -68,7 +70,13 @@
-   else
-     default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL);
- 
--  if (module_path_env)
-+  if (module_guix_gtk3_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk3_path_env, module_path_env, default_dir, NULL);
-+  else if (module_guix_gtk3_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk3_path_env, default_dir, NULL);
-+  else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
-   else
diff --git a/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
index 4a60023bf7..56c202ecf4 100644
--- a/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
+++ b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
@@ -1,51 +1,21 @@
-From 889294a93fc6464c2c2919bc47f6fd85ec823363 Mon Sep 17 00:00:00 2001
-From: Raghav Gururajan <rg@HIDDEN>
-Date: Tue, 18 May 2021 19:57:00 -0400
-Subject: [PATCH] [PATCH]: Honor GUIX_GTK4_PATH.
-
-This patch makes GTK look for additional modules in a list of directories
-specified by the environment variable "GUIX_GTK4_PATH". This can be used
-instead of "GTK_PATH" to make GTK find modules that are incompatible with
-other major versions of GTK.
----
- gtk/gtkmodules.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
 diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
-index aace5dcbc9..193b6a02e9 100644
+index 51b0916624..0cd6ee7e30 100644
 --- a/gtk/gtkmodules.c
 +++ b/gtk/gtkmodules.c
-@@ -105,6 +105,7 @@ static char **
- get_module_path (void)
- {
-   const char *module_path_env;
-+  const gchar *module_guix_gtk4_path_env;
-   const char *exe_prefix;
-   char *module_path;
-   char *default_dir;
-@@ -114,6 +115,7 @@ get_module_path (void)
-     return result;
+@@ -132,6 +132,16 @@ get_module_path (void)
+   result = split_file_list (module_path);
+   g_free (module_path);
  
-   module_path_env = g_getenv ("GTK_PATH");
-+  module_guix_gtk4_path_env = g_getenv ("GUIX_GTK4_PATH");
-   exe_prefix = g_getenv ("GTK_EXE_PREFIX");
++  /* GUIX: Load additional modules from GUIX_GTK4_PATH. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_build_guix_search_path_dirs ("GUIX_GTK4_PATH");
++  g_strv_builder_addv (builder, (const gchar **) result);
++  g_strfreev (result);
++  result = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return result;
+ }
  
-   if (exe_prefix)
-@@ -121,7 +123,13 @@ get_module_path (void)
-   else
-     default_dir = g_build_filename (_gtk_get_libdir (), "gtk-4.0", NULL);
- 
--  if (module_path_env)
-+  if (module_guix_gtk4_path_env && module_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk4_path_env, module_path_env, default_dir, NULL);
-+  else if (module_guix_gtk4_path_env)
-+    module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
-+				module_guix_gtk4_path_env, default_dir, NULL);
-+  else if (module_path_env)
-     module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
- 				module_path_env, default_dir, NULL);
-   else
--- 
-2.31.1
-
-- 
2.47.1





Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 06:26:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 01:26:04 2025
Received: from localhost ([127.0.0.1]:38739 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taqfD-0007Tm-SY
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:26:04 -0500
Received: from mail.envs.net ([5.199.136.28]:52144)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taqf5-0007Si-I0
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:25:57 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id A687E38A3E50;
 Thu, 23 Jan 2025 06:25:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737613554; bh=iW6DWUNIyYz7AiD8GJkZPx1WZkQvMslIC/UCNYZE1Ng=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=SdzJcvTNsYcU+vNQWblC8o9II4EAkgdy7hIEtKO62tDn0lsJQY9V8oyH/yEy08jz3
 qFak4vzU6Os+gA48kiFqBGYPGpihZz/zBJ0h2Jw3/5ZXfojuQOkeEasszWv2suxjQK
 9AmAm5+1+dYEidn8ZQr5ftQJI5yx5UP0T98HiXYRqihkV+SX/HQ3glcmvQxfuAmZZG
 rxO4ZWvq05aHEvYqpEygN2rSTfA+mXlVPObuoRWOZ2rvcbJkgt3YF8tXPs2bEt2LsX
 fr1rpnnVOpFLK3mBe2QBcY7ySzdzfhFwVRJVVkULUyDfbbyzLzYfIefSZBbjEj9ikK
 uenKqkMdZBbx1bbP67RSbhXmLo9CsTYjcNF0CkPRIKFDKUrfZQgkW/VGVex1OHSW2F
 s/UTSvAW/LUhjhe9LXLPfhLvo+lnCJxE5ESy32h6qL3NKEMH3TbY3AreunH/KCv3Ji
 m7qZrqTZO7TdR84FQ3zPtmCgzGGVe/IaYw6mEnQ8y9U0gqP8K1ya4ZiWBFIozwgJYm
 Zy2LXc+JIQ8TWmPbUIzbKhCY60IRFWmCxgXMi4y2cGYVNEDZwUbWDR/DdBKY4YogdM
 JNrh2xXtXIK1G2HepQyU2GoUo/WU+hEn97iNvd1UhVsxYVr8oq0BDn2BfpOJIC76Yc
 iv4IlnMcw2lEvgVzUN7X7SkQ=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id KolnuEgFa8nR; Thu, 23 Jan 2025 06:25:51 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Thu, 23 Jan 2025 06:25:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 8b562cf9;
 Thu, 23 Jan 2025 06:29:11 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v2 2/4] gnu: gdk-pixbuf: Respect GUIX_GDK_PIXBUF_MODULE_FILES
 search path.
Date: Thu, 23 Jan 2025 14:28:56 +0800
Message-ID: <96be080084ef425fb5d5a8ab920d30667dc68c99.1737613671.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
References: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

This fixes <https://issues.guix.gnu.org/75523>.

* gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/gtk.scm (gdk-pixbuf)[source]: Add patch.
[native-search-paths]: Replace GDK_PIXBUF_MODULE_FILE with GUIX_GDK_PIXBUF_MODULE_FILES.

Change-Id: I63ce8fa14799e04551522e6d27e89bf47b08043e
---
 gnu/local.mk                                   |  1 +
 gnu/packages/gtk.scm                           |  8 +++++---
 ...-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6bb3a35770..4249476dfa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1400,6 +1400,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
   %D%/packages/patches/gdb-hurd64.patch				\
+  %D%/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch	\
   %D%/packages/patches/gdm-default-session.patch		\
   %D%/packages/patches/gdm-elogind-support.patch		\
   %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch	\
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 7ed7d7b7df..392734a33c 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -726,7 +726,10 @@ (define-public gdk-pixbuf
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "0jz4kziz5lirnjjvbspbqzsigk8vnqknng1fga89d81vs5snr6zf"))))
+                "0jz4kziz5lirnjjvbspbqzsigk8vnqknng1fga89d81vs5snr6zf"))
+              (patches
+               (search-patches
+                "gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch"))))
     (build-system meson-build-system)
     (outputs '("out" "debug"))
     (arguments
@@ -777,9 +780,8 @@ (define-public gdk-pixbuf
      ;; This file is produced by the gdk-pixbuf-loaders-cache-file
      ;; profile hook.
      (list (search-path-specification
-            (variable "GDK_PIXBUF_MODULE_FILE")
+            (variable "GUIX_GDK_PIXBUF_MODULE_FILES")
             (files (list %gdk-pixbuf-loaders-cache-file))
-            (separator #f)              ;single valued
             (file-type 'regular))))
     (synopsis "Image loading library")
     (description "GdkPixbuf is a library that loads image data in various
diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
new file mode 100644
index 0000000000..eb22761403
--- /dev/null
+++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
@@ -0,0 +1,18 @@
+diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
+index e1df590..ba24cf6 100644
+--- a/gdk-pixbuf/gdk-pixbuf-io.c
++++ b/gdk-pixbuf/gdk-pixbuf-io.c
+@@ -670,6 +670,13 @@ gdk_pixbuf_io_init (void)
+ 	gboolean ret;
+ 
+ 	gdk_pixbuf_io_init_builtin ();
++
++	/* Load loaders from GUIX_GDK_PIXBUF_MODULE_FILES. */
++	gchar **guix_module_files = g_build_guix_search_path_dirs ("GUIX_GDK_PIXBUF_MODULE_FILES");
++	for (int i = 0; guix_module_files[i] != NULL; i++)
++	    gdk_pixbuf_io_init_modules (guix_module_files[i], NULL);
++        g_strfreev (guix_module_files);
++
+ #ifdef USE_GMODULE
+ 	module_file = gdk_pixbuf_get_module_file ();
+ #endif
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 23 Jan 2025 06:25:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 01:25:58 2025
Received: from localhost ([127.0.0.1]:38730 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taqf7-0007Sx-QA
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:25:58 -0500
Received: from mail.envs.net ([5.199.136.28]:58298)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taqf4-0007Sa-5C
 for 75688 <at> debbugs.gnu.org; Thu, 23 Jan 2025 01:25:55 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id D3AD038A3E4C;
 Thu, 23 Jan 2025 06:25:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737613551; bh=QFNSsGI4Gyi8bL0h5r+aVnoD9AEJ9qZBOp2tTDFpHk4=;
 h=From:To:Cc:Subject:Date:From;
 b=TKnGVNB3tuVHUhhHR3sXl1oQVW/g1aR8A3krFaqQv5S89Nczhx33YWRujupBghumm
 oj45xkX2IUKh+AI2YoZpDppHQV+DXDrKHzrCNHD/zN62Q17JitIV6Q+LjyiUF+ohnN
 3P22cFlbD5uHcIfjHjYyjIsBnPKAU/4XYXNyOzeqei/JIchpCW+jezFTvaxy4qClVu
 E3hXvEf1AZBUMoY6R34a4wi7DTT19ZR+BzV/JBOWVxzYJIFLxy+9iNIGg+448fcmHb
 Lo02AVekcdqzB5zRVyElPR5K1Q2WmsE+X97u6dl4KtFZ/AdiqT32qc2944RKFpA2wr
 r7sYvRyQy4r3rjtbZab20LNBBTqD7755PJJZEIRno8BdzJhKMD1cPpXht3U2SCVRPV
 4unkGJQW1cJGqjabjd/PiWVI7uQ8NQLccsUZDMljxAHiROLBjAYOPcT3JHxzmnWQC9
 hlcXiXk+R7SDNrlxMi5cHa0UT6GHZpVvWgPH4eKPoWJnmIDK6lEVnQVxqCQnhO/tr4
 w1jTN6B8mtPgmTfdPVrCm/fumKqXrD3JaKu172+O/eJ6rFQdHzafnCDSjEjUhS23aM
 cdCgOw15OxynEbNgD00/YbzcYUfDrlWSta98Mx4yzN8JBFF8olGVRByYXZrHL9Hd9e
 ay38bDw2pelbvyDWm66FfLvA=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 6QagBnzDIC0r; Thu, 23 Jan 2025 06:25:48 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Thu, 23 Jan 2025 06:25:48 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id e7e2719b;
 Thu, 23 Jan 2025 06:29:10 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH v2 1/4] gnu: glib: Support load search paths from
 etc/search-paths.d files.
Date: Thu, 23 Jan 2025 14:28:55 +0800
Message-ID: <916f2d3087c47d6212682656f47a2899ba795df1.1737613671.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

Add a new function "g_build_guix_search_path_dirs" to GLIB, which in addition
to environment variable, read search path values from etc/search-paths.d
directory of the current executable.  This can be used to replace wrapper
scripts.

Use it for GUIX_GSETTINGS_SCHEMA_DIR, GUIX_GIO_EXTRA_MODULES,
GUIX_XDG_DATA_DIRS and GUIX_XDG_CONFIG_DIRS.

* gnu/packages/patches/glib-guix-search-paths.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/glib.scm (glib)[source]: Add patch.
[native-search-paths]: Add GUIX_GSETTINGS_SCHEMA_DIR, Replace
GIO_EXTRA_MODULES with GUIX_GIO_EXTRA_MODULES.

Change-Id: I1d6d113fc38b20ebd4dce195f6d9c58ce85967e4
---
 gnu/local.mk                                  |   1 +
 gnu/packages/glib.scm                         |   9 +-
 .../patches/glib-guix-search-paths.patch      | 158 ++++++++++++++++++
 3 files changed, 166 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/glib-guix-search-paths.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5091f93eb8..6bb3a35770 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1436,6 +1436,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/git-filter-repo-generate-doc.patch	\
   %D%/packages/patches/gklib-suitesparse.patch			\
   %D%/packages/patches/glib-appinfo-watch.patch			\
+  %D%/packages/patches/glib-guix-search-paths.patch		\
   %D%/packages/patches/glib-skip-failing-test.patch		\
   %D%/packages/patches/glibc-2.33-riscv64-miscompilation.patch	\
   %D%/packages/patches/glibc-2.39-git-updates.patch	\
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index e04eedb7ba..0704ba2c53 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -258,7 +258,8 @@ (define glib
         (base32 "0c3vagxl77wma85qinbj974jvw96n5bvch2m7hqcwxq8fa5spsj4"))
        (patches
         (search-patches "glib-appinfo-watch.patch"
-                        "glib-skip-failing-test.patch"))
+                        "glib-skip-failing-test.patch"
+                        "glib-guix-search-paths.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -516,9 +517,13 @@ (define glib
       (search-path-specification
        (variable "XDG_DATA_DIRS")
        (files '("share")))
+      ;; To load gsettings schemas from GTK, etc.
+      (search-path-specification
+       (variable "GUIX_GSETTINGS_SCHEMA_DIR")
+       (files '("share/glib-2.0/schemas")))
       ;; To load extra gio modules from glib-networking, etc.
       (search-path-specification
-       (variable "GIO_EXTRA_MODULES")
+       (variable "GUIX_GIO_EXTRA_MODULES")
        (files '("lib/gio/modules")))))
     (search-paths native-search-paths)
     (synopsis "Low-level core library for GNOME projects")
diff --git a/gnu/packages/patches/glib-guix-search-paths.patch b/gnu/packages/patches/glib-guix-search-paths.patch
new file mode 100644
index 0000000000..ebd57024dd
--- /dev/null
+++ b/gnu/packages/patches/glib-guix-search-paths.patch
@@ -0,0 +1,158 @@
+diff --git a/gio/giomodule.c b/gio/giomodule.c
+index 76c2028..49b02bb 100644
+--- a/gio/giomodule.c
++++ b/gio/giomodule.c
+@@ -1330,6 +1330,13 @@ _g_io_modules_ensure_loaded (void)
+       g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
+       g_free (module_dir);
+ 
++      /* GUIX: Load gio modules from GUIX_GIO_EXTRA_MODULES */
++      gchar **guix_giomodule_dirs = g_build_guix_search_path_dirs ("GUIX_GIO_EXTRA_MODULES");
++      for (int i = 0; guix_giomodule_dirs[i] != NULL; i++) {
++        g_io_modules_scan_all_in_directory_with_scope (guix_giomodule_dirs[i], scope);
++      }
++      g_strfreev (guix_giomodule_dirs);
++
+       g_io_module_scope_free (scope);
+ 
+       /* Initialize types from built-in "modules" */
+diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
+index e8ccc8c..b8bae14 100644
+--- a/gio/gsettingsschema.c
++++ b/gio/gsettingsschema.c
+@@ -354,6 +354,13 @@ initialise_schema_sources (void)
+       while (i--)
+         try_prepend_data_dir (dirs[i]);
+ 
++      /* GUIX: Load schemas from GUIX_GSETTINGS_SCHEMA_DIR. */
++      char **guix_schema_dirs = g_build_guix_search_path_dirs ("GUIX_GSETTINGS_SCHEMA_DIR");
++      i = g_strv_length(guix_schema_dirs);
++      while (i--)
++        try_prepend_dir (guix_schema_dirs[i]);
++      g_strfreev (guix_schema_dirs);
++
+       try_prepend_data_dir (g_get_user_data_dir ());
+ 
+       /* Disallow loading extra schemas if running as setuid, as that could
+diff --git a/glib/gutils.c b/glib/gutils.c
+index 8628a56..bc21efc 100644
+--- a/glib/gutils.c
++++ b/glib/gutils.c
+@@ -2708,6 +2708,16 @@ g_build_system_data_dirs (void)
+     data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+ #endif
+ 
++  /* GUIX: Use data files from GUIX_XDG_DATA_DIRS. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) data_dir_vector);
++  g_strfreev (data_dir_vector);
++  data_dir_vector = g_build_guix_search_path_dirs ("GUIX_XDG_DATA_DIRS");
++  g_strv_builder_addv (builder, (const gchar **) data_dir_vector);
++  g_strfreev (data_dir_vector);
++  data_dir_vector = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return g_steal_pointer (&data_dir_vector);
+ }
+ 
+@@ -2800,6 +2810,16 @@ g_build_system_config_dirs (void)
+   conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+ #endif
+ 
++  /* GUIX: Use config files from GUIX_XDG_CONFIG_DIRS. */
++  GStrvBuilder *builder = g_strv_builder_new ();
++  g_strv_builder_addv (builder, (const gchar **) conf_dir_vector);
++  g_strfreev (conf_dir_vector);
++  conf_dir_vector = g_build_guix_search_path_dirs ("GUIX_XDG_CONFIG_DIRS");
++  g_strv_builder_addv (builder, (const gchar **) conf_dir_vector);
++  g_strfreev (conf_dir_vector);
++  conf_dir_vector = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++
+   return g_steal_pointer (&conf_dir_vector);
+ }
+ 
+@@ -2849,6 +2869,69 @@ g_get_system_config_dirs (void)
+   return system_config_dirs;
+ }
+ 
++gchar **
++g_build_guix_search_path_dirs (const gchar *variable)
++{
++  gchar **dirs = NULL;
++  char *value = NULL;
++  GStrvBuilder *builder = g_strv_builder_new ();
++
++#if defined(__linux__) || defined(__gnu_hurd__)
++  /* First add paths from the etc/search-paths.d, which can be used to replace wrapper script. */
++  gchar *exe_path = g_file_read_link ("/proc/self/exe", NULL);
++  gchar *out_path = NULL;
++  gchar *search_paths_d = NULL;
++
++  /* We install executables under "bin" or "libexec", can also be a subdirectory of "libexec". */
++  if (exe_path && (g_str_match_string("/bin/", exe_path, FALSE) ||
++                   g_str_match_string("/libexec/", exe_path, FALSE))) {
++    /* Find output directory, which is the parent directory of "bin" or "libexec". */
++    out_path = g_path_get_dirname (exe_path);
++    while (g_str_match_string("/bin/", out_path, FALSE) ||
++           g_str_match_string("/libexec/", out_path, FALSE)) {
++      gchar *dir_path = out_path;
++      out_path = g_path_get_dirname (dir_path);
++      g_free (dir_path);
++    }
++
++    /* Now add paths from etc/search-paths.d/VARIABLE file. */
++    search_paths_d = g_build_filename (out_path, "etc", "search-paths.d", NULL);
++    if (g_file_test (search_paths_d, G_FILE_TEST_EXISTS)) {
++      gchar *var_path = g_build_filename (search_paths_d, variable, NULL);
++      if (g_file_get_contents (var_path, &value, NULL, NULL)) {
++        dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
++        g_strv_builder_addv (builder, (const gchar **) dirs);
++        g_strfreev (dirs);
++        g_free (value);
++      }
++      g_free (var_path);
++    }
++  }
++
++  g_free (exe_path);
++  g_free (out_path);
++  g_free (search_paths_d);
++#endif
++
++  /* Then add paths from the environment variable. */
++  gboolean is_setuid = GLIB_PRIVATE_CALL (g_check_setuid) ();
++  if (is_setuid) /* we don't want to access arbitrary files when running as setuid. */
++    value = NULL;
++  else
++    value = g_strdup (g_getenv (variable));
++
++  if (value && value[0]) {
++      dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
++      g_strv_builder_addv (builder, (const gchar **) dirs);
++      g_strfreev (dirs);
++  }
++  g_free (value);
++
++  dirs = g_strv_builder_end (builder);
++  g_strv_builder_unref (builder);
++  return dirs;
++}
++
+ /**
+  * g_nullify_pointer:
+  * @nullify_location: (not nullable): the memory address of the pointer.
+diff --git a/glib/gutils.h b/glib/gutils.h
+index efc6914..710cf27 100644
+--- a/glib/gutils.h
++++ b/glib/gutils.h
+@@ -36,6 +36,9 @@
+ 
+ G_BEGIN_DECLS
+ 
++GLIB_AVAILABLE_IN_ALL
++gchar **g_build_guix_search_path_dirs (const gchar *variable);
++
+ GLIB_AVAILABLE_IN_ALL
+ const gchar *         g_get_user_name        (void);
+ GLIB_AVAILABLE_IN_ALL

base-commit: 7080aaf08102ec4c9c976582d6adfa0c14e6c640
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.
Changed bug title to 'GUIX_ify harmful environment variables and replace wrapper scripts with search path value files' from '[PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace harmful environment variables' Request was from 宋文武 <iyzsong@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 22 Jan 2025 09:39:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 22 04:39:31 2025
Received: from localhost ([127.0.0.1]:59901 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taXCs-00063i-LJ
	for submit <at> debbugs.gnu.org; Wed, 22 Jan 2025 04:39:31 -0500
Received: from mail.envs.net ([5.199.136.28]:37760)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taXCo-00063X-J5
 for 75688 <at> debbugs.gnu.org; Wed, 22 Jan 2025 04:39:27 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id B460A38A2BE6;
 Wed, 22 Jan 2025 09:39:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737538764; bh=SvdjhohUc3OnfPNz5T3iHjAy0xHpl25P8AqpMmSOguc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=efvPbUao+dSbq0yDlo25mZfrOBYdMB3h9s9CFAABU+0IBAgRRTkVwCqHrdVN4kkFr
 UCH7qSEgx3mpGS6L5kAmK/VNzniSCT5mqkEq33xVdTr/E8jyFzhGmhqP9UIuMYq4Z6
 W/fmQDK9I9/gBaUdI58jQ+2cb57YuKeLBzfEX9U98XyJn8kYXhv38ncIJMCUj9wByQ
 0xc80QR940MtLadaxQ1kFo5r2yuQiijftfDGxurE2iwAnKMwsKjWXv1h3y8ylR8/JD
 /dYM/g5gRfPYGko6+1pg0zIqcFRkfwNPHmbMHB3ymHi599OzEokhkV69RE4o57mtj/
 24ys1Yc4zHZopu+vENkdQE5UtFVxt2e4rqJX+QQpkAJyb0u8Ec99wBmY/8repp4NKs
 /n3MOz+4W6M9He2QPkO9JLgZVxXcCRHXejOVAoDbOvRxbZMPsNjHW08uvlN5fgItyu
 2UpXy2BajkEwPGl5lZeMstZLHzQaCbztRnb82I5qeFoQG/aCYDZFTkAdRwTBC6Bla9
 bGEY59p0L0f139AZnVX5d9pUXvYP+5ztR/2/NN6mINNyrY5v1isMTDZJjijXWAihvJ
 drWeQx5ii0wDhjICeS/gnjaVO37IeRWcdAI3AJNwIbXEM/yMtg6xU5bQV5bhbmaLT7
 RU5w18QV9hTzgyxjLTvb+0CE=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id NB4TQsb-Dvtu; Wed, 22 Jan 2025 09:39:17 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Wed, 22 Jan 2025 09:39:16 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 3cbcb7dd;
 Wed, 22 Jan 2025 09:42:44 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87tt9rr776.fsf@HIDDEN> (Maxim Cournoyer's message of "Wed, 22
 Jan 2025 10:03:09 +0900")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
 <87o700p6xl.fsf@HIDDEN> <87tt9rr776.fsf@HIDDEN>
Date: Wed, 22 Jan 2025 17:42:44 +0800
Message-ID: <87r04vyyjv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

> I see; I agree that if the environment variables or not set by a search
> path and instead picked up by the binary from some file, then it solves
> this class of problem, but that seems equivalent to wrapping the
> binaries, no?
Well, wrapping solve it in one way, since we use 'prefix' in wrapper,
eg: konsole has:

export QT_PLUGIN_PATH="/gnu/store/.../lib/qt6/plugins${QT_PLUGIN_PATH:+:}$QT_PLUGIN_PATH"

which let konsole work in a environment which has an incompatible
QT_PLUGIN_PATH, since the incompatible one load last and applications
only load a named plugin once.

It dosen't work other way, that in konsole when you run an another
unwrapped application, can be influenced by QT_PLUGIN_PATH from
konsole's wrapper script.

> You'd still have some glue code reading .VARIABLE and
> then doing a bunch of setenv before launching the actual program, no?
> That glue code is currently the shell or Guile script used to wrap the
> binaries.

The point for those .VARIABLE files is without wrapper scripts there're
no setenv call anymore, ensure that getenv only get profiles paths, in
another words: reading from file and apply the values replaced setenv
then getenv and apply the values.

>
> Unless we can fully eliminate search paths and propagation, we'll still
> have the issue of having environment variables being set, even with the
> use of .VARIABLE, as far s I understand.

Well, we must have environment variables due to we want to mix profiles.
Search paths can be applied without environment variables, by using
.VARIABLE files for hardcoded dependencies; and by finding current
profile path from executable (lookup argv[0] in PATH), from current
profile path we can construct and apply search paths values.

Use GUIX_* would solve problems for foreign programs, then reduce
wrapper scripts would solve some problems for guix programs.

Disallow load plugins from different profiles will solve more remaining
problems, but this can be considered later if there are actually reports.


>> Then when you try to run a incompatible program (eg: with a newer glibc
>> or gtk), those variables leaks from wrapper scripts will make the
>> program crash.
>>
>> By replace those variables via .VARIABLE file, those starts with
>
> nitpick: Perhaps it could be called .environment or
> .environment-variables, similarly named as in our failed Guix builds.

Those are not variables in the "environment", but search-path values
hardcoded for the specified binary.  Maybe I should use one set of files
for all binaries in one output like 'etc/ld.so.cache' does tough.
Compare with use one ".environment-variables" file, use different files
for each variable value simplify the logic and be more efficiency.

How about /etc/search-paths.d/VAR1, /etc/search-paths.d/VAR2?
Need more logic to get "etc", and add it to %harmless-collisions for
union-build though.

> As you can see, perhaps I'm still missing pieces of your big picture.  a
> RFC/GCD documenting the idea, or a demo implementation if that's
> easier/faster would help (code is often more succinct than text).

Sure, I'll work on implementation this.  Thank you!




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 22 Jan 2025 01:03:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 20:03:34 2025
Received: from localhost ([127.0.0.1]:58381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taP9V-0003Wu-SY
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2025 20:03:34 -0500
Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:54491)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1taP9T-0003Vy-6y
 for 75688 <at> debbugs.gnu.org; Tue, 21 Jan 2025 20:03:28 -0500
Received: by mail-pl1-x630.google.com with SMTP id
 d9443c01a7336-21c2f1b610dso108814415ad.0
 for <75688 <at> debbugs.gnu.org>; Tue, 21 Jan 2025 17:03:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737507801; x=1738112601; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fPs91xsvnOYgtHNg4zoVOLHO9HWSkeRT8OKoAgLdSYc=;
 b=fkxUUNcTzsa9fy/BccVppafYhSq+nUos/Nm+N6TW28wZhlNvDEKVQ1YtWJn9jKCcvh
 FngwGrtjPTQSGkH1/4vbJqYTKbWu4GLhv8EbTYBEwwqu9w4UFSaL/VFMWza7hBRRLvE/
 5lQrM+hB+GxjW+ov7QaedXoivdGfSdOntq7tZDIcOZ342+gWi+a4kYf5WxYyQQ4K/7GF
 FUgb1ZS7X05SP3RhxwptFVs7O5pCPN7VqW7jF5oil54TcGE4Qfrp5wTje0POZ9nJrNJe
 HNPlN/NfgEhUPHxI+4zzF8iFWkvodjYw3zv+kz/cbtfeiRTlGjPJgNI5CU+GnbQejt53
 JGbA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737507801; x=1738112601;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=fPs91xsvnOYgtHNg4zoVOLHO9HWSkeRT8OKoAgLdSYc=;
 b=bCi0kuoVLzPh5csK6rVflR/W1fe69kDAezEsjsY1ePTehcnaAYO/K+v5/PNgeR9LFS
 oJAkjvMMA0/l9JdzeFZBpaMXfdwYs1dyWfZNgJ9NwZibIQKQyThp6JtrzS28L/FiiQF3
 P2Kf1DYbtbzaj3e671fm8Oe1QLyYSarRI5et41d8pq70S5wznyyzgx/W8Da94SAkw9uh
 Ra7BkN6ZHbfZfxwAYbtfo9nAtCwpVSupsc1Vm1+oMBzHvRKA+9a513bXqj1XwaISo8qk
 huQUyzlAKF8eXBcVgXbNev3p9MqEO8tAHSdvp7Bn7wiPMYOaJ9drOjb1x4oQXMjQJ9+5
 TRCw==
X-Gm-Message-State: AOJu0YzZ/f4zuOJBabWlRAJomhC23v4T7vT52N+xF6He6I3YacCZy4uG
 KiZPOmPJVyR+Ada3HswNHZxCMqqO9V8eDfHNR+6zMRZNCzWjlHg+
X-Gm-Gg: ASbGncuM1Q8rhBIUMeeEVdv6QWaCATRfK/v0fnZQmWuLkr/NzCd4XpMEDenAl3XluAR
 JZOq+iQfHkLe+ckrC5/dDiF4Paarwc10dyYRZtHYcUPuZ+cL1+EVblMOo2T+Xh8P5hSG9qlzylS
 +oMTDK7L2eono0PGlgZEbFoL/F5TdsyyvM81XBQbP5F9lqKxoCyLoTjBu+Q5URlIN7q0F3laS9K
 uhCTm+Dtv0sRKVErcqf2eYP3kpv7m3wrV/dqp+E0uT2JwKmYKLUcPIiAuK+zAvc3Fc=
X-Google-Smtp-Source: AGHT+IG6dL3+eJy6pZiBI6D6l+cD9NkiQh0t9VcounNiFrVR+z4f5BazT0KAGjgQ0qGUU5ABC+fFGA==
X-Received: by 2002:a17:902:d551:b0:216:2bd7:1c4a with SMTP id
 d9443c01a7336-21c35562974mr285151875ad.26.1737507800977; 
 Tue, 21 Jan 2025 17:03:20 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-21c2d3e8081sm84250025ad.185.2025.01.21.17.03.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 21 Jan 2025 17:03:20 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87o700p6xl.fsf@HIDDEN> (=?utf-8?B?IuWui+aWh+atpiIncw==?=
 message of "Tue, 21 Jan 2025 22:39:34 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
 <87o700p6xl.fsf@HIDDEN>
Date: Wed, 22 Jan 2025 10:03:09 +0900
Message-ID: <87tt9rr776.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

=E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> writes:

[...]

>> inheriting its parent environment, but otherwise I'm not sure I
>> understand the issue, especially how processing a .VARIABLE file instead
>> would handle this better?  Could yo give an example?
>
> A program try to load different versions of plugins via
> GIO_EXTRA_MODULES, QT_PLUGIN_PATHS could crash due to ABI incompatible, s=
ee:
>
> mix Qt 5.9.3 and 5.9.4: https://yhetil.org/guix/874jzl2n16.fsf@HIDDEN/
> mix GIO modules with different glibc: https://yhetil.org/guix/87r0rvasph.=
fsf@HIDDEN/
>
> In a desktop environment, with wrapper scripts you would get
> GIO_EXTRA_MODULES, GTK_PATH contains store paths:
>
> https://yhetil.org/guix/2c93c29e-032b-2b5e-6139-b28de456b47b@HIDDEN/
>
> GIO_EXTRA_MODULES=3D/gnu/store/8k9s3z2315p494fj937jyvc9v7gpbjr8-dconf-0.4=
0.0/lib/gio/modules:/gnu/store/knm6b1dxg2j3vji4wrgngv99pvb6f5ff-glib-networ=
king-2.70.0/lib/gio/modules::/run/current-system/profile/lib/gio/modules
> GTK_PATH=3D/gnu/store/kq72g9hjl1sj4c1qhw98m8rdw2ymmk7m-gtk+-3.24.30/lib/g=
tk-3.0:/gnu/store/fkl4fg06f538ryhiw4bs2iwwfs56g2k3-libcanberra-0.30/lib/gtk=
-3.0

I see; I agree that if the environment variables or not set by a search
path and instead picked up by the binary from some file, then it solves
this class of problem, but that seems equivalent to wrapping the
binaries, no?  You'd still have some glue code reading .VARIABLE and
then doing a bunch of setenv before launching the actual program, no?
That glue code is currently the shell or Guile script used to wrap the
binaries.

Unless we can fully eliminate search paths and propagation, we'll still
have the issue of having environment variables being set, even with the
use of .VARIABLE, as far s I understand.

> Then when you try to run a incompatible program (eg: with a newer glibc
> or gtk), those variables leaks from wrapper scripts will make the
> program crash.
>
> By replace those variables via .VARIABLE file, those starts with

nitpick: Perhaps it could be called .environment or
.environment-variables, similarly named as in our failed Guix builds.

[...]

As you can see, perhaps I'm still missing pieces of your big picture.  a
RFC/GCD documenting the idea, or a demo implementation if that's
easier/faster would help (code is often more succinct than text).

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 21 Jan 2025 14:36:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 09:36:26 2025
Received: from localhost ([127.0.0.1]:53819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taFMg-0002yY-3y
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2025 09:36:26 -0500
Received: from mail.envs.net ([5.199.136.28]:37350)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taFMZ-0002yB-Mo
 for 75688 <at> debbugs.gnu.org; Tue, 21 Jan 2025 09:36:20 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 93F8D38A3E42;
 Tue, 21 Jan 2025 14:36:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737470177; bh=Up21bLKmNyihsjtS/mePdyjWAe+YIjR5Pv2Q7HZUaeM=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=AI2kDPo0KDfXU30H315KtGkaptK6coXHSyzX0dhk/7bnYzD69sm9HWOj4ox5P2oEO
 k0nwDNICUEOwKVbjoH4BiVoZ76//YwjSPAu0iePjYqHqI1+FkoQMqm54sv0DwjygIe
 gblQPeN63UcN7kcZpXVc1a8ZXYgKC4gp7N8LQd9L5B+DEFkJPREXnYk8IWI0rbfqGu
 L4m5Yi7apYOdaM/aHx/JLmD00HcPBV02AArCW0eQZ16VVTTY/vmkQ2dmgC5hyPbs+6
 UXeiWFb61h71nxwq094m8+jSbJp+NfciIE4pBAScuDIvdl+f8zUCfJwvZNKRmQytkt
 Qu55I5Q9ucZBRGKB7pQV26iq8KjGHxRHWkN970hfE3NyBpjvx9zVVkCoJhj7vpui5E
 toWfTtr7tj/iJSMiXAi6FkHF1EWFoDOQ0vrjUhNZvSfmLb4RJrEMsB3TTwTS97FoWM
 w388gF7tH1wUgTP9fU+0h6SiB1AlXpSiH9k9+JY06qXnuvriJOefcJ6oGiqSvmTm7p
 5F1oTjN0UH/ocvqaRdMOEB83aAP2ovXJBBOk3+O1jLL8Ll68snmZEWDeNO9TTVjF4D
 EZlGhvqljmKXfvH23io0xKBRNvsv05CWCgMoWz+kAC/elMBoJiO9rhvB2fKAQYK0D+
 EceR76sq6MT+VgPymVqL5Mwc=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Yd6tCLaaliLW; Tue, 21 Jan 2025 14:36:08 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Tue, 21 Jan 2025 14:36:08 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 5568a498;
 Tue, 21 Jan 2025 14:39:34 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87o700s3re.fsf@HIDDEN> (Maxim Cournoyer's message of "Tue, 21
 Jan 2025 22:19:49 +0900")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN> <87o700s3re.fsf@HIDDEN>
Date: Tue, 21 Jan 2025 22:39:34 +0800
Message-ID: <87o700p6xl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

>> Okay, I changed the plan, since use only one env like GUIX_LIBRARY_PATH
>> would lead to some form of 'stats storm', and the logic is not harder
>> for patching different variables. If we get rid of wrapper scripts, the
>> "noise" will only contains profile paths, so are acceptable..
>>
>> Now I get this patch for glib:
>>
>> 1. add a `gchar **g_build_guix_search_path_dirs (const gchar *variable)`
>>    function to GLIB, which handle .VARIABLE file in addition to the env
>>    value.  Those .VARIABLE files sit at the same directory of
>>    executable, would be used to replace wrapper script.  As said early,
>>    wrapper scripts leaks environment variables could cause incompatable
>>    problems.
>>
>> 2. Use `g_build_guix_search_path_dirs` for GUIX_GIO_EXTRA_MODULES,
>>    GUIX_GSETTINGS_SCHEMA_DIR, and etc. (later).
>>
>> 3. (later) Modify wrap-program usages to use .VARIABLE files to get rid
>>    of environment variables leaks.
>
> This reminds me of how Python virtualenv works, IIRC.  What do you mean
> by "wrapper scripts leak environment variables and could cause
> incompatibility problems" ?  Sure, if your term binary is wrapped, your
> shell will have these environment variables as its a child process
> inheriting its parent environment, but otherwise I'm not sure I
> understand the issue, especially how processing a .VARIABLE file instead
> would handle this better?  Could yo give an example?

A program try to load different versions of plugins via
GIO_EXTRA_MODULES, QT_PLUGIN_PATHS could crash due to ABI incompatible, see:

mix Qt 5.9.3 and 5.9.4: https://yhetil.org/guix/874jzl2n16.fsf@HIDDEN/
mix GIO modules with different glibc: https://yhetil.org/guix/87r0rvasph.fsf@HIDDEN/

In a desktop environment, with wrapper scripts you would get
GIO_EXTRA_MODULES, GTK_PATH contains store paths:

https://yhetil.org/guix/2c93c29e-032b-2b5e-6139-b28de456b47b@HIDDEN/

GIO_EXTRA_MODULES=/gnu/store/8k9s3z2315p494fj937jyvc9v7gpbjr8-dconf-0.40.0/lib/gio/modules:/gnu/store/knm6b1dxg2j3vji4wrgngv99pvb6f5ff-glib-networking-2.70.0/lib/gio/modules::/run/current-system/profile/lib/gio/modules
GTK_PATH=/gnu/store/kq72g9hjl1sj4c1qhw98m8rdw2ymmk7m-gtk+-3.24.30/lib/gtk-3.0:/gnu/store/fkl4fg06f538ryhiw4bs2iwwfs56g2k3-libcanberra-0.30/lib/gtk-3.0

Then when you try to run a incompatible program (eg: with a newer glibc
or gtk), those variables leaks from wrapper scripts will make the
program crash.

By replace those variables via .VARIABLE file, those starts with
'/gnu/store/' won't get exported to the shell and desktop sessions,
since they're not in the environ, but read from file (any executable
will read its unique set of .VARIABLE files) and used by executables
directly.  So it should reduce the chance of incompatible, also if we
wrap programs need dconf/glib-networking with .VARIABLE file, there will
be no need to install dconf/glib-networking in the system profile,
reduce the risk more.

'/run/current-system/' still could cause problems though, which user can
update all packages sync or choose to not mix profiles.




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 21 Jan 2025 13:20:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 08:20:11 2025
Received: from localhost ([127.0.0.1]:53698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taEAs-0007EW-KQ
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2025 08:20:11 -0500
Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:59737)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1taEAo-00079Z-9w
 for 75688 <at> debbugs.gnu.org; Tue, 21 Jan 2025 08:20:08 -0500
Received: by mail-pl1-x62a.google.com with SMTP id
 d9443c01a7336-2166651f752so128469225ad.3
 for <75688 <at> debbugs.gnu.org>; Tue, 21 Jan 2025 05:20:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737465600; x=1738070400; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=lxcLPMKGPFGmHgN45dRu22AxOfPXsxm32s4ScWNJxBI=;
 b=b4k3DF915T8t8FSyLkSviceDsbbIfhZCgsVyAgubfkVa+2g8LUyFdXQWk3uKg6cP7y
 D+HT0sNXHmxDRNvw3LVYD4WYrEXhJj4CdRS2vQaF+7KaP5BtUUlR3O41eVmbboHErVdz
 tYnrffTLAKCfNwvfZzQapMEkygGODjQ/6zfsHHtDKjEb9gj0K1JU/RP7YGydzj4diUk4
 wIVH15t5TVFBCrEoRdp7VxVBo/Cp1JPHkD4de1/CxMHwc7Q1IxFnHRnMyHToiJ54IRoN
 SYeQsQgVq2wBEMOMl2K2drRzT6M0IpdvzuTdlDhfUKMJQg1W9uzTNHC4YqTQxGLALk4n
 458Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737465600; x=1738070400;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=lxcLPMKGPFGmHgN45dRu22AxOfPXsxm32s4ScWNJxBI=;
 b=M+SLx5U3x2gpkSH8/sCgx37C8MYflm4lDJHoeBlUd+xRFtZeM6dBXalLM5onV2uOnd
 BzJ6A8tiTkgDLJhszm/hl06MSJIAOK3/IWJP2YInBWo3ujuI9+Ou/uHj3eltqgchsdFq
 DMpDi+G68mbgrc1V/rp/TR6a9tVbf4qwu0+jl5rvSleQaln0LqImd0Z2JQIpVBQKxkFS
 tPuugBgleAcZ83FC+bx2CJNQJTO+9TqkpRSdHgc7Yv4qKWexEhfJLHsJ589zSnRGUIGh
 vwX9DJ4Vc1OdGo5ZbBRpfDWHM5GihxaPlLm42B0C4ICsFrrCkTT+YJaKF4lk/iHemm7N
 Gjpw==
X-Gm-Message-State: AOJu0YxsitFy66q3uoDsRCQE6wJUreJJr2Qrsj7kW9kLngK3qpqMHQtW
 Gy04mse8MX5Ce6KFZRaQNBcYn6LF3W+bLJXXfc3xQ0xQkQkaTu2n
X-Gm-Gg: ASbGncsiMHV3PNLov/GtYr33tn5MfLoxSDx/UohrcP106cucyDsrXMccRB1fBWuKRzr
 xQB3XlPVjizz7lxSzNCHxmC9cd0YEKAPHZGv8aoFOrJU5IiC12vHLJ6+Qn12Vvf744nwftxUmGv
 ScO+G/opTH2t1sMvs8m8sNoAF4M7esyRU3umLlLuXjOu+bM0hURFHBq/jgiU2lmBz0i9DN0PF9K
 N68GWtua9Q8q0cSoVR9lVVYpGLzK/FSdpdnzrN1N8gm+Kw0lq3EFvwOozIRgGaADks=
X-Google-Smtp-Source: AGHT+IHCP3ifXrsbJIXAmrTz2sl1mBxPwbT0EKICb2uFyD3aBoErEg9WesobZu6MjYvq/tvhQCrNPw==
X-Received: by 2002:a05:6a21:6da4:b0:1e0:cadd:f670 with SMTP id
 adf61e73a8af0-1eb2144d4fdmr24220398637.5.1737465600376; 
 Tue, 21 Jan 2025 05:20:00 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-a9bca47e790sm8730922a12.2.2025.01.21.05.19.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 21 Jan 2025 05:19:59 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87wmeophsk.fsf@HIDDEN> (=?utf-8?B?IuWui+aWh+atpiIncw==?=
 message of "Tue, 21 Jan 2025 18:44:59 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
 <87wmeophsk.fsf@HIDDEN>
Date: Tue, 21 Jan 2025 22:19:49 +0900
Message-ID: <87o700s3re.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

=E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> writes:

[...]

> Okay, I changed the plan, since use only one env like GUIX_LIBRARY_PATH
> would lead to some form of 'stats storm', and the logic is not harder
> for patching different variables. If we get rid of wrapper scripts, the
> "noise" will only contains profile paths, so are acceptable..
>
> Now I get this patch for glib:
>
> 1. add a `gchar **g_build_guix_search_path_dirs (const gchar *variable)`
>    function to GLIB, which handle .VARIABLE file in addition to the env
>    value.  Those .VARIABLE files sit at the same directory of
>    executable, would be used to replace wrapper script.  As said early,
>    wrapper scripts leaks environment variables could cause incompatable
>    problems.
>
> 2. Use `g_build_guix_search_path_dirs` for GUIX_GIO_EXTRA_MODULES,
>    GUIX_GSETTINGS_SCHEMA_DIR, and etc. (later).
>=20=20=20=20
> 3. (later) Modify wrap-program usages to use .VARIABLE files to get rid
>    of environment variables leaks.

This reminds me of how Python virtualenv works, IIRC.  What do you mean
by "wrapper scripts leak environment variables and could cause
incompatibility problems" ?  Sure, if your term binary is wrapped, your
shell will have these environment variables as its a child process
inheriting its parent environment, but otherwise I'm not sure I
understand the issue, especially how processing a .VARIABLE file instead
would handle this better?  Could yo give an example?

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 21 Jan 2025 13:15:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 08:15:29 2025
Received: from localhost ([127.0.0.1]:53688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taE6K-0006wq-M6
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2025 08:15:29 -0500
Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:48320)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1taE6H-0006wO-NH
 for 75688 <at> debbugs.gnu.org; Tue, 21 Jan 2025 08:15:26 -0500
Received: by mail-pl1-x633.google.com with SMTP id
 d9443c01a7336-216281bc30fso127406225ad.0
 for <75688 <at> debbugs.gnu.org>; Tue, 21 Jan 2025 05:15:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737465320; x=1738070120; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=cHLZwdPiLuhpBphXq/mYblFaMMZ3533DaHTRtSlaFmY=;
 b=i0WXJPIewagfBNr+Xnmxg8Wilu86qY/6npk4628vqWTgiiZRJOOcDcivnfaoRvLQhy
 8mHU1NEVCqHb+iFKWqHniiOPxnlqUxLs1PrY/HdKgbqA/yHPIryfIQsPOtNsL3PIBPcf
 KDNqX6pKMzZij7kaRpPRWL61gR0OVeBx/3wEIsbAHwx5tWyJ8Gxuxfq/i8YCZLm/sbS+
 yTgTgIu7QfIIfihf28ihj6Bp/ndwNEwS47YV1Q7Pu4+1aob8qZEmuyxAb850g2AOWVeW
 2p/Q4MiVDQ4SvaPQXyyZFB4enAbZfMapcQjOz3bfz62W+4SH+iAAqng0peMP6FZaj58R
 tJWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737465320; x=1738070120;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=cHLZwdPiLuhpBphXq/mYblFaMMZ3533DaHTRtSlaFmY=;
 b=UFwqr8tmVWHAB1XMKLrVrrl4cvTFWrj2iQwcvHEOvFZM5IP6pMSxOiDXWCbBLUjVG/
 RiBYn74o9mso1nXTxiiCkx6OpxWD3wcgI4g8XW5c3NigAHAoSU8Nn6lktaOb3KXT4Ssn
 V2I7/Aa725ie9Z4duK/twqylW3JQFDceklpQhZ3+uhGn7iHKGESUDFNI4vNKHfj3Td42
 Roj8j9pHfKxPsYZODWNo7N1cdwhIdIB/AF2sT+KujDMf62XtRkW3FoivEb7oGPtlqpV2
 ybFkGkXNI5xFGUz5K5+gIfnOW/5A2HsSabaWLSTiVkHGPXl40hIZuDHrlU+zZb03FYcL
 iVJg==
X-Gm-Message-State: AOJu0YzRPfbLZY9Jc4Ifnawpx3/Hq4HuiRM4N4oGvEzeB3HfeZEdGp1K
 A/GXbbkJEOjJo6Cis9/xa3tWJ31lGUYsKxqwFMo2VeIfXBahbENw
X-Gm-Gg: ASbGncuBdpNx+64mtxYhB/pWeXPoGaeJ2nQeKbCq3TEa6IcOn/sA6eQi9w9HVtgL/aG
 m+Yehw+dktSCFewZGqtkPiLbFmFWZFc8D5oQyQ3BSRHJo9O/XgDRLN8kZIiKLqFcEBjYFR/EQFO
 R/U2k4y29L86IoJioc9URVgdePu6hb6zYL99Y1Yed+uxsfs0n3HS+rw/m0OAUihrArX16Z2zOOO
 oGMeDGQqy1HYZjvRF5VNfU0flFbQej9tDHPd8xF5IxD5a3mc3x8MC21o2YMxHuMUiY=
X-Google-Smtp-Source: AGHT+IHi0m10UNk47Z8sR5h5/a6xZyCgkGEFO7Woeg6Z47sR1hIiR7x4VkRla8vxDQH0rrCXr0rEIw==
X-Received: by 2002:a05:6a20:1589:b0:1e1:ca25:8da3 with SMTP id
 adf61e73a8af0-1eb214de8e8mr27949629637.20.1737465318123; 
 Tue, 21 Jan 2025 05:15:18 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-72dabacdc6csm8974622b3a.165.2025.01.21.05.15.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 21 Jan 2025 05:15:17 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <877c6ord5p.fsf@HIDDEN> (=?utf-8?B?IuWui+aWh+atpiIncw==?=
 message of "Tue, 21 Jan 2025 12:42:10 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
Date: Tue, 21 Jan 2025 22:15:06 +0900
Message-ID: <87sepcs3z9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

=E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> writes:

[...]

> Sure, but using GDK_PIXBUF_MODULE_FILES after upstreamed would also
> cause problems for foreign system, since host programs will try to load
> plugins from guix packages, which may or may not work, even crash.

Ah, I wasn't thinking about these being plugins depending on a specific
ABI, likely incompatible.  I see.

>> Alternatively we could use GUIX_GDK_PIXBUF_MODULE_FILE.
>
> Another alternative is to make softwares "relocatable" to profile
> directory, make them discovery plugins relative to their executables,
> gdk-pixbuf does have a "relocatable" build option, but it use
> "/proc/self/exe" which resolved to the final store path instead of
> profile level directory.  Improve that likely could go upstreams, eg: by
> first add 'g_get_executable_path' for glib:
> https://gitlab.gnome.org/GNOME/glib/-/issues/31
>
> It also open the chance to get rid of wrapper scripts (eg: by using a
> virtualenv'd python as interpreter instead of wrap executables with
> GUIX_PYTHONPATH), which I plan to play with later.  But this
> "relocatable" way doesn't allow mix paths from differenet directories
> (system and user profiles), it's good as it reduce the risk of
> incompability, but not convenient.

It sounds interesting, worth exploring.  But being unable to compose
multiple profile together easily defeats its purpose a bit (though the
same would be true with single valued variable such as
GDK_PIXBUF_MODULE_FILE: you can't honor the two profiles here, one has
to win).

> So using specified GUIX_* variables are a must to avoid influence host
> programs and use plugins from multiple profiles.
>
>
>> But I don't see why we should use an intermetate GUIX_LIBRARY_PATH to
>> compute all the other correct paths; this should be left to the search
>> paths, in my opinion (as it's simpler, cleaner).
>
> Well, lesser variables give a "clean" feeling, it's mostly aesthetic,
> especially in GNOME and KDE, mixed with wrappers, there are a lot
> variables "noise" in the environment.

While aesthetic is nice, I'd rather to keep the design stupid simple and
rely on the search path mechanism; we can refine later.  Having 10 or 20
environment variables in my profile doesn't appear to be that big of a
deal to me.

> Also think a litte more, as we need patching software anyway, I hope to
> modify the logic `guix_build_library_path` to also include paths from
> what wrappers currently provides, to drop wrappers.  That logic should
> be simpler to implement in one place than for every specified variable.

Sorry, I've lost you; what is this `guix_build_library_path` variable?
I'm not sure we'd be able to get rid of wrappers fully, as not
everything would be relative to lib.  I guess that's in the space to be
explored :-).

> Note that even with GUIX_ specified variables, they're still problems
> since we have different profiles and problems built with different
> versions of libraries.  Search "undefined symbol: __libc_pthread_init"
> in the list could find some reports.

Right.  It seems the responsibility of the user to avoid combining
incompatible software from different profiles.

> I think the final goal is:
>
> - profile only provides PATH, GUIX_LIBRARY_PATH (replace most if not all
>   other "libs/.*" paths), XDG_DATA_DIRS, INFOPATH, and other shareable
>   (usually for data files, under the "share" directory) environment
>   variables.
>
> - no wrapper scripts for hardcoded plugins, so GUIX_LIBRARY_PATH only
>   contains user, home, system profiles.
>
> - if incompability problems occurs, we can just unset one
>   GUIX_LIBRARY_PATH to launch the influenced program without
>   incompatible plugins from profiles.  ofc this is temporary, you should
>   not mix incompatible libraries (by update all packages in profile(s)
>   at once), but handy for hurry adventurers.
>
> If this looks reasonable, then I'd work on patch gtk or qt to get rid of
> wrappers to justify this, how's this sound?

It's too early for me to say if it could really work, but I'll repeat
that a priori I'm not too fond of GUIX_LIBRARY_PATH (just the name would
clash with a GCC env var too) and custom logic that'd need to be
maintained in the software (we'd need to patch the software to have
GUIX_* variables anyway but the resulting patch would be trivial); I
think I'd rather have multiple, explicit environment variables computed
by search paths.

Just to make sure, GUIX_* variables would be honored *on top* of their
non GUIX_ prefixed (stock) variants, right?  E.g. we wouldn't want GCC
to stop honoring LIBRARY_PATH even if we add GUIX_LIBRARY_PATH, as that
would confuse users.

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 21 Jan 2025 10:41:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 21 05:41:45 2025
Received: from localhost ([127.0.0.1]:53385 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1taBhY-0002ks-Nk
	for submit <at> debbugs.gnu.org; Tue, 21 Jan 2025 05:41:45 -0500
Received: from mail.envs.net ([5.199.136.28]:42030)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1taBhU-0002kb-69
 for 75688 <at> debbugs.gnu.org; Tue, 21 Jan 2025 05:41:43 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 73EDD38A2BE2;
 Tue, 21 Jan 2025 10:41:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737456097; bh=b1xbTaeuzzB262NpO4K0S3Vae0tm7xFUG5danU/3OFU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Z7pgIHhdyo0nhf7vMYWD60Qjyc1Cyeh2fjuAbB/LXCJ9zUD0azPWb7jR+6PPJONl1
 EB1Tx83VVC6vP1WUFfZgo68SbWp4eEkHAFMX6kD9MPCNcarzo+bo1IKOpzC/y6kejG
 tpjXPLVUh8Z/ib8ecUuzEMweUyDThcYBPHQ+PUPBj5Y8X5gU9eqnXiI83EoSP61whr
 ExMsTXDJkjQGb88DPxxAER8v4KGEuLTwtA4fc8ZDrcovPHYhix3JM5v/S5Nfjugg8P
 PQuy2l1W6bQl5H6qR8oGtURdCRQLmY3cBpKoqqK1as6eAId2UeeMZHGmaUO0XR9EKK
 I3FL51LuakF24uDDo1EfT2iFSL/DxWM9dFgV8WXUWGra0hSkxsFXhNAQG9oMKxteOb
 lmldaoXZ9MkLMwKC4rusWkxjWgbzDZq/2mFUF1a1MzzSj74Y2Ib9hmsAQZ8LhTc32c
 WZNEDJUIUQXe7Xby3zTs74TEcJCfDLi+iznY2I10bokMV18ynvcyHGFszJLLokomuj
 g2Wp0rqczvj1MuW5RH+ShmnnweB/A8Np06za6BfhQBy2NADg/cS6dakuxm3Eb3JogD
 CfYZ7x5C0GI4fqupYnTuSzSZpKopVKb6x44EJhWOgbllBo5GOsHzmfgWOCdIOHQiZP
 vaFZ3zZyrAl0BB3AXpXAHKuc=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id u8NwooWvWhac; Tue, 21 Jan 2025 10:41:30 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Tue, 21 Jan 2025 10:41:30 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 9b294453;
 Tue, 21 Jan 2025 10:44:59 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <877c6ord5p.fsf@HIDDEN> (=?utf-8?B?IuWui+aWh+atpiIncw==?=
 message of "Tue, 21 Jan 2025 12:42:10 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN> <877c6ord5p.fsf@HIDDEN>
Date: Tue, 21 Jan 2025 18:44:59 +0800
Message-ID: <87wmeophsk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

=E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> writes:

>> But I don't see why we should use an intermetate GUIX_LIBRARY_PATH to
>> compute all the other correct paths; this should be left to the search
>> paths, in my opinion (as it's simpler, cleaner).
>
> Well, lesser variables give a "clean" feeling, it's mostly aesthetic,
> especially in GNOME and KDE, mixed with wrappers, there are a lot
> variables "noise" in the environment.
>
> Also think a litte more, as we need patching software anyway, I hope to
> modify the logic `guix_build_library_path` to also include paths from
> what wrappers currently provides, to drop wrappers.  That logic should
> be simpler to implement in one place than for every specified
> variable.

Okay, I changed the plan, since use only one env like GUIX_LIBRARY_PATH
would lead to some form of 'stats storm', and the logic is not harder
for patching different variables. If we get rid of wrapper scripts, the
"noise" will only contains profile paths, so are acceptable..

Now I get this patch for glib:

1. add a `gchar **g_build_guix_search_path_dirs (const gchar *variable)`
   function to GLIB, which handle .VARIABLE file in addition to the env
   value.  Those .VARIABLE files sit at the same directory of
   executable, would be used to replace wrapper script.  As said early,
   wrapper scripts leaks environment variables could cause incompatable
   problems.

2. Use `g_build_guix_search_path_dirs` for GUIX_GIO_EXTRA_MODULES,
   GUIX_GSETTINGS_SCHEMA_DIR, and etc. (later).
=20=20=20
3. (later) Modify wrap-program usages to use .VARIABLE files to get rid
   of environment variables leaks.



--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=glib-guix-search-paths.patch

diff --git a/gio/giomodule.c b/gio/giomodule.c
index 76c2028..49b02bb 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -1330,6 +1330,13 @@ _g_io_modules_ensure_loaded (void)
       g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
       g_free (module_dir);
 
+      /* GUIX: Load gio modules from GUIX_GIO_EXTRA_MODULES */
+      gchar **guix_giomodule_dirs = g_build_guix_search_path_dirs ("GUIX_GIO_EXTRA_MODULES");
+      for (int i = 0; guix_giomodule_dirs[i] != NULL; i++) {
+        g_io_modules_scan_all_in_directory_with_scope (guix_giomodule_dirs[i], scope);
+      }
+      g_strfreev (guix_giomodule_dirs);
+
       g_io_module_scope_free (scope);
 
       /* Initialize types from built-in "modules" */
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index e8ccc8c..d7ff8f4 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -369,6 +369,13 @@ initialise_schema_sources (void)
           g_strfreev (extra_schema_dirs);
         }
 
+      /* GUIX: Load schemas from GUIX_GSETTINGS_SCHEMA_DIR. */
+      char **guix_schema_dirs = g_build_guix_search_path_dirs ("GUIX_GSETTINGS_SCHEMA_DIR");
+      i = g_strv_length(guix_schema_dirs);
+      while (i--)
+        try_prepend_dir (guix_schema_dirs[i]);
+      g_strfreev (guix_schema_dirs);
+
       g_once_init_leave (&initialised, TRUE);
     }
 }
diff --git a/glib/gutils.c b/glib/gutils.c
index 8628a56..0139d42 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2849,6 +2849,46 @@ g_get_system_config_dirs (void)
   return system_config_dirs;
 }
 
+gchar **
+g_build_guix_search_path_dirs (const gchar *variable)
+{
+  gchar **dirs = NULL;
+  char *value = NULL;
+  GStrvBuilder *builder = g_strv_builder_new ();
+
+#if defined(__linux__) || defined(__gnu_hurd__)
+  /* First add paths from the .VARIABLE file, which can be used to replace wrapper script. */
+  gchar *exe_path = g_file_read_link ("/proc/self/exe", NULL);
+  gchar *var_path = g_strjoin(NULL, exe_path, ".", variable, NULL);
+  if (g_file_get_contents (var_path, &value, NULL, NULL)) {
+      dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
+      g_strv_builder_addv (builder, (const gchar **) dirs);
+      g_strfreev (dirs);
+      g_free (value);
+  }
+  g_free (exe_path);
+  g_free (var_path);
+#endif
+
+  /* Then add paths from the environment variable. */
+  gboolean is_setuid = GLIB_PRIVATE_CALL (g_check_setuid) ();
+  if (is_setuid) /* we don't want to access arbitrary files when running as setuid. */
+    value = NULL;
+  else
+    value = g_strdup (g_getenv (variable));
+
+  if (value && value[0]) {
+      dirs = g_strsplit (value, G_SEARCHPATH_SEPARATOR_S, 0);
+      g_strv_builder_addv (builder, (const gchar **) dirs);
+      g_strfreev (dirs);
+  }
+  g_free (value);
+
+  dirs = g_strv_builder_end (builder);
+  g_strv_builder_unref (builder);
+  return dirs;
+}
+
 /**
  * g_nullify_pointer:
  * @nullify_location: (not nullable): the memory address of the pointer.
diff --git a/glib/gutils.h b/glib/gutils.h
index efc6914..710cf27 100644
--- a/glib/gutils.h
+++ b/glib/gutils.h
@@ -36,6 +36,9 @@
 
 G_BEGIN_DECLS
 
+GLIB_AVAILABLE_IN_ALL
+gchar **g_build_guix_search_path_dirs (const gchar *variable);
+
 GLIB_AVAILABLE_IN_ALL
 const gchar *         g_get_user_name        (void);
 GLIB_AVAILABLE_IN_ALL

--=-=-=
Content-Type: text/plain


A similiar patch would needed for qtbase, or maybe I can use glib API
directly from any Qt application? (haven't tried)  Does this level of
patching seems okay?

Thanks!

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 21 Jan 2025 04:38:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 23:38:58 2025
Received: from localhost ([127.0.0.1]:52894 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ta62U-0000I9-2o
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 23:38:58 -0500
Received: from mail.envs.net ([5.199.136.28]:39806)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1ta62Q-0000Hi-IU
 for 75688 <at> debbugs.gnu.org; Mon, 20 Jan 2025 23:38:56 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 491E138A2BD2;
 Tue, 21 Jan 2025 04:38:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1737434331; bh=zWM1uxQtKE6MJILwGeyze6m5oD76dmf/5qzWVWJbV5A=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=h4YadWYQw4aC5hCl5qXIbZaCCTR98PmIwaFOKqjZGQi3CshJ6VRXvY5wkcZl1m+D2
 SpCcfq4nICPvRCDBFl/4il9EgvyhD9upCUMJcKO659ihc+E6VqSqn7pP2bqVGRewVU
 ZBj4TjVupiYL93Ma6yRadxh0TqeKVXx1PIqItg5BTCKYU2eUySRykzThG4k4ohjhEb
 132DXx/JmMmA3Yq2ZeDspPxD1LfaUTCeiAqrLMmOszqd/rpzpiljWn3Nd9eEdZgjHO
 BwUad4GRRydpz8a6Kn4Qme+lUXTt8VVkTfvjcPSxhCUHs039HkZ+txhEFyvTyo7P2d
 Lg+MtjCJFA2OvXWdrDILMnAkWXxjxPfH/FfPqyNuKdHTzh8SbNrkW8uVu2p5ahnp2b
 swLMjHFHS2tkoY0D/e5fLLO4vUaPq9m9qYAzk5lAQi6uoGXdm4sJuIwc3VhYzCYabQ
 N/4C2MAnrJIRcs1+F4jXjYabEQYOXvt6PmobyVJ2m0uGTXCI8gCextpx4EFBGd9KlC
 KD5vSlBBxIVkNJspyO9VTbEUlyLy6e+LvA/Tf2PWyTDvZFSi4Gh5dXz+9nV5DeJdCq
 zbOStoY10Ye2HJYewR6zhZ6WAV1MnjwKbeInvswAKl5/QUGRKXq0ggKQyXmFns5m/I
 o6h/bRewxhel7El1MFXx5l2o=
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id DwLAUvF1FbK0; Tue, 21 Jan 2025 04:38:43 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Tue, 21 Jan 2025 04:38:43 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 02636ea4;
 Tue, 21 Jan 2025 04:42:10 +0000 (UTC)
From: =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <87msfld1pi.fsf@HIDDEN> (Maxim Cournoyer's message of "Mon, 20
 Jan 2025 23:00:57 +0900")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <87msfld1pi.fsf@HIDDEN>
Date: Tue, 21 Jan 2025 12:42:10 +0800
Message-ID: <877c6ord5p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Maxim Cournoyer <maxim.cournoyer@HIDDEN> writes:

> Hello,
>
> iyzsong@HIDDEN writes:
>
>> From: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
>>
>> Hello, we currently set many environment variables from search-paths, so=
me can be harmful for
>> foreign system, which leading crash, eg: GDK_PIXBUF_MODULE_FILE, QT_PLUG=
IN_PATH, as reported in:
>>
>>  <https://issues.guix.gnu.org/53514>
>>  <https://issues.guix.gnu.org/75523>
>>  <https://issues.guix.gnu.org/73897>
>>
>> Instead of patch each software/library with its own environment variable=
s (GUIX_GTK3_PATH, GUIX_QT_PLUGIN_PATH),
>> we can try patch all to calculate their from one GUIX_LIBRARY_PATH (defa=
ult to ~/.guix-profile/lib), since the
>> problems mostly come from incompatible libraries ABI, so from "lib" cons=
truct its subdirectories should be enough.
>> eg:
>>   GTK3_PATH use: lib/gtk-3.0
>>   FCITX_ADDONS_DIRS use: lib/fcitx5
>
> Instead of reconstructing the paths from something like the suggested
> new GUIX_LIBRARY_PATH, I think it'd be nice if additionally to the stock
> environment variables supported by each software, we introduced GUIX_
> prefixed variants such as GUIX_GTK3_PATH and GUIX_QT_PLUGIN_PATH which
> would be used by the Guix search paths specifications defined on these
> packages.

Yes, that will also works.

>
>> First patch add GUIX_LIBRARY_PATH to the default search paths, like PATH.
>> Second patch replace GDK_PIXBUF_MODULE_FILE with GUIX_LIBRARY_PATH.
>
> For the GDK_PIXBUF_MODULE_FILE special case, the problem is foremost
> that it's a single entry value; as mentioned previously it'd be nice if
> we could contribute a true multi-items variant named
> GDK_PIXBUF_MODULE_FILES that could point to more than one file.

Sure, but using GDK_PIXBUF_MODULE_FILES after upstreamed would also
cause problems for foreign system, since host programs will try to load
plugins from guix packages, which may or may not work, even crash.


> Alternatively we could use GUIX_GDK_PIXBUF_MODULE_FILE.

Another alternative is to make softwares "relocatable" to profile
directory, make them discovery plugins relative to their executables,
gdk-pixbuf does have a "relocatable" build option, but it use
"/proc/self/exe" which resolved to the final store path instead of
profile level directory.  Improve that likely could go upstreams, eg: by
first add 'g_get_executable_path' for glib:
https://gitlab.gnome.org/GNOME/glib/-/issues/31

It also open the chance to get rid of wrapper scripts (eg: by using a
virtualenv'd python as interpreter instead of wrap executables with
GUIX_PYTHONPATH), which I plan to play with later.  But this
"relocatable" way doesn't allow mix paths from differenet directories
(system and user profiles), it's good as it reduce the risk of
incompability, but not convenient.

So using specified GUIX_* variables are a must to avoid influence host
programs and use plugins from multiple profiles.


> But I don't see why we should use an intermetate GUIX_LIBRARY_PATH to
> compute all the other correct paths; this should be left to the search
> paths, in my opinion (as it's simpler, cleaner).

Well, lesser variables give a "clean" feeling, it's mostly aesthetic,
especially in GNOME and KDE, mixed with wrappers, there are a lot
variables "noise" in the environment.

Also think a litte more, as we need patching software anyway, I hope to
modify the logic `guix_build_library_path` to also include paths from
what wrappers currently provides, to drop wrappers.  That logic should
be simpler to implement in one place than for every specified variable.

Note that even with GUIX_ specified variables, they're still problems
since we have different profiles and problems built with different
versions of libraries.  Search "undefined symbol: __libc_pthread_init"
in the list could find some reports.

I think the final goal is:

- profile only provides PATH, GUIX_LIBRARY_PATH (replace most if not all
  other "libs/.*" paths), XDG_DATA_DIRS, INFOPATH, and other shareable
  (usually for data files, under the "share" directory) environment
  variables.

- no wrapper scripts for hardcoded plugins, so GUIX_LIBRARY_PATH only
  contains user, home, system profiles.

- if incompability problems occurs, we can just unset one
  GUIX_LIBRARY_PATH to launch the influenced program without
  incompatible plugins from profiles.  ofc this is temporary, you should
  not mix incompatible libraries (by update all packages in profile(s)
  at once), but handy for hurry adventurers.

If this looks reasonable, then I'd work on patch gtk or qt to get rid of
wrappers to justify this, how's this sound?


> Thanks for the initiative!  Let me know if I misunderstood something.

There is no misunderstood, thank you to let me think and clarify more.




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 20 Jan 2025 14:04:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 09:04:17 2025
Received: from localhost ([127.0.0.1]:49442 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZsO0-0005cG-LT
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 09:04:17 -0500
Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:45344)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tZsNx-0005by-J5
 for 75688 <at> debbugs.gnu.org; Mon, 20 Jan 2025 09:04:14 -0500
Received: by mail-pl1-x629.google.com with SMTP id
 d9443c01a7336-2164b1f05caso81875455ad.3
 for <75688 <at> debbugs.gnu.org>; Mon, 20 Jan 2025 06:04:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737381847; x=1737986647; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=zSGCrFw0TobD81PPh+maaTLsjVNL3loOfihJWuYSQsk=;
 b=ViSxtDI/ZPoiV6/8/GjolL3sC2NAzYOFlEFRjpye47kZ28goC3OFN7un9tKzUg+YfC
 y+cQ544EYf0FmiOPo7yWMuzmkFsXovTSDJvavI9OCQtQ0gZCxEKmoKu9Pat/06UpwNMY
 Qtt+dnFEYbZs3FKluPirp5f6E5TgJc/lgHIaUpiFY9msYezrR/FLN6PtKQm/ANydlX79
 /pbTsUPJcsu6IUCmj1t/2IN7bMTwX6+y3Vw9WQSDf6KxFy5/aec+Gj+WszO9xVet8l0P
 EsVLSba+27vPTsULArLs0jOX0urwS70ZL/8EiwmcnO1kMVzS2ZEBdjvMXfod77HEB6/R
 tihg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737381847; x=1737986647;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=zSGCrFw0TobD81PPh+maaTLsjVNL3loOfihJWuYSQsk=;
 b=PfOjTtshtP3qE/qiKVMc+9TMyrqqZtAXZ+VY1JIquwfrkhY3bFUSBoaRodmnJB6l7q
 qy5evckvCO5Q5Ykqfcvn2GD5bVczCEXaKj+jHvHH45W8LU5QikTMzCvLslLro7fxbF4o
 Pep7IogYyxIG1cUNErOIAm4cxxKvVZMz686tb9JDGEQeI6yx3y2vrb6Lgcit6ElS4GF5
 ylzTL8rcRywn6rY44eXMtdlQVUCN8IMyw9+jg+DOzgkegGXPl+Ciwqrdx5kWzdsmkb03
 /zN2iYUJ7Z9GUtAWu0bLJdzH5hZ/79KkY7qBJiw3YASexmC9TnUHcgNTCu5z5EObDbJz
 KKUg==
X-Gm-Message-State: AOJu0YxZsKNcQa42ZCuD5U+dlGUslqMPt3eD2802BJeXLfrwOaYVFQl5
 V7Q1HQQLpa/RNSMxRPJx7bukHdVokL4DHMn4Mb6LV5/Olmd7XpcA
X-Gm-Gg: ASbGnctCwVd/aRchj3pZ2J+Uei0QBCSi1B7nNWmaEmtpuzpJO1Xy5VAhxW8gRxxHwF9
 iURtzL4AycEJwwJoIec5wvPeYFHQqkq9Ch4hm4ZRdmTMRYcIsduWdJTaKTbdVd749T/6y1XWiyC
 2A7LSMgv6aUilbkMdcQ45fEnsnVwojKh5KOgyZ2lygmTDhJfebBsdbQfnLQPELSUTgsVJDW5aRr
 WiM5AsXdAYUb0DYIKNws5VNoF7lYaPcUFY9j+wkR2DKaUlwyRRJIjktNG2im+j8FlM=
X-Google-Smtp-Source: AGHT+IHXyhBdbgfPURw5peCf2IECh8t4Khsm6qTYL8n4cvIX1sY+uxIgR3epiwvLIXwjbTmnTeiDKg==
X-Received: by 2002:a17:903:1ce:b0:216:4a06:e87a with SMTP id
 d9443c01a7336-21c355dc64bmr202655915ad.40.1737381847474; 
 Mon, 20 Jan 2025 06:04:07 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-21c2ceb7476sm61957355ad.56.2025.01.20.06.04.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Jan 2025 06:04:06 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: iyzsong@HIDDEN
Subject: Re: [bug#75688] [PATCH 2/2] gnu: gdk-pixbuf: Respect
 GUIX_LIBRARY_PATH.
In-Reply-To: <9596193713fcfc45725e0b1f0008bf0453d352f1.1737374057.git.iyzsong@HIDDEN>
 (iyzsong@HIDDEN's message of "Mon, 20 Jan 2025 20:06:51 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
 <9596193713fcfc45725e0b1f0008bf0453d352f1.1737374057.git.iyzsong@HIDDEN>
Date: Mon, 20 Jan 2025 23:03:55 +0900
Message-ID: <87ikq9d1kk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

iyzsong@HIDDEN writes:

> From: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
>
> This fixes <https://issues.guix.gnu.org/75523>.
>
> * gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch: New fi=
le.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/gtk.scm (gdk-pixbuf)[source]: Apply patch.
> [native-search-paths]: Remove GDK_PIXBUF_MODULE_FILE.

[...]

> diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.pa=
tch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch
> new file mode 100644
> index 0000000000..3ec7bc28ab
> --- /dev/null
> +++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch
> @@ -0,0 +1,42 @@
> +diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
> +index e1df590..e553eba 100644
> +--- a/gdk-pixbuf/gdk-pixbuf-io.c
> ++++ b/gdk-pixbuf/gdk-pixbuf-io.c
> +@@ -663,6 +663,19 @@ gdk_pixbuf_io_init_builtin (void)
> + #undef load_one_builtin_module
> + }
> +=20
> ++
> ++static gchar **
> ++build_guix_library_path (void)
> ++{
> ++        gchar **dirs =3D NULL;
> ++        gchar *library_path =3D g_strdup (g_getenv ("GUIX_LIBRARY_PATH"=
));
> ++        if (!library_path || !library_path[0])
> ++            library_path =3D g_build_filename (g_get_home_dir (), ".gui=
x-profile", "lib", NULL);
> ++        dirs =3D g_strsplit (library_path, G_SEARCHPATH_SEPARATOR_S, 0);
> ++        g_free (library_path);
> ++        return dirs;
> ++}
> ++
> + static gboolean
> + gdk_pixbuf_io_init (void)
> + {
> +@@ -670,6 +683,17 @@ gdk_pixbuf_io_init (void)
> + 	gboolean ret;
> +=20
> + 	gdk_pixbuf_io_init_builtin ();
> ++
> ++	/* Load loaders from GUIX_LIBRARY_PATH */
> ++	gchar **guix_libdirs =3D build_guix_library_path ();
> ++	for (gsize i =3D 0; guix_libdirs[i] !=3D NULL; i++) {
> ++	    module_file =3D g_build_filename (guix_libdirs[i], "gdk-pixbuf-2.0=
",
> ++                                            GDK_PIXBUF_BINARY_VERSION, =
"loaders.cache", NULL);
> ++	    gdk_pixbuf_io_init_modules (module_file, NULL);
> ++	    g_free (module_file);
> ++	}
> ++	g_strfreev (guix_libdirs);
> ++
> + #ifdef USE_GMODULE
> + 	module_file =3D gdk_pixbuf_get_module_file ();
> + #endif

As I mentioned in my previous reply, I think having a
GDK_PIXBUF_MODULE_FILES environment variable using similar code as above
would be a nicer solution, since it could probably be upstreamed and
thus no custom patches to maintain on our side indefinitely (and useful
functionality available to others -- a win/win situation)

Do you agree that'd be nicer?

--=20
Thanks,
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 20 Jan 2025 14:01:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 09:01:27 2025
Received: from localhost ([127.0.0.1]:49438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZsLD-0005VN-Gj
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 09:01:27 -0500
Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:52709)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1tZsL6-0005Uz-MA
 for 75688 <at> debbugs.gnu.org; Mon, 20 Jan 2025 09:01:20 -0500
Received: by mail-pj1-x1033.google.com with SMTP id
 98e67ed59e1d1-2ee51f8c47dso6104935a91.1
 for <75688 <at> debbugs.gnu.org>; Mon, 20 Jan 2025 06:01:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737381670; x=1737986470; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=H75SBnxHgzIUyxRpWOiR2/eEZb1bdHENsIAYXTEaTaw=;
 b=B0u7z6AvGDSs5k+h8LlKft1GJWON4PP/89Rx3CS/Y2fsEuu71upkcKIJ5nGMOsfzRV
 IdwK7/bBkvasCFyPzZu2gyG/OJYrj2Ck0ZfgLTyKNMU65VnH0JrJej6RbBqa6xRQxm4t
 fwzka3sQ62CaSv3MFcTLKk8Za6H9cJHlZ8TXYylor2XtScZm2inNmaOgGpYqNl1ITjCd
 g0DEWp5Rw3/mOjI6VYv/lNkcLchLkUdUNtTd2MsyYtaEsW+uB5LwK0q968xU5SgDWohE
 TYNceToJq1fQs2Z4ekLphuPBg3zXnLY4gQb3hGCRTSZHlodc8u8r4pqxNfwPefNn2EuU
 hjWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737381670; x=1737986470;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=H75SBnxHgzIUyxRpWOiR2/eEZb1bdHENsIAYXTEaTaw=;
 b=sx57K8IIvPcHAenJJ/okYof8G1Lw2VY+yVf7QXbyPO0q7651sZ4r5/XfX5pd2Q3jW/
 tPgpn2QVWQl4/WRf2ld07904mmDCaHXfs2LYq1pvFl+mvDxv0mzQk0xqCme6HkrkLhwd
 02jZuubuFe35KOLImO8G7xGcwfthvuLu1TPe+CS8jAcmF4Z1qPK8hk/K8ya+O3e/x3mR
 aNNR5Cs5U4xVb2irAm7x2QQUkNbbK8b62D0n1jiEw6w7CCVIndUmzXJjdjsXOTkYcUUI
 kIRKXYf0xiT7Ow/GvY+52Vx7JWXBO7FpX29VtFwWHNxWDwVHBHG6NC3hyFj7RsV4XCMn
 Gzcw==
X-Gm-Message-State: AOJu0YwaQPAUnyedJZBhjn/9ACjDdXP13eBINCFlM4aEGfhJLIz/W02+
 gUVctu7fXa4fsWMW1Ps1338KEOXW3uwUHZkcHzdV8S/9HjT2jalS
X-Gm-Gg: ASbGncut6BvA1i8lRjzJ88VGIpKsnCOcuIn39Keg/RKGzlPgZ6UgTrgWpUHiSWD6mnD
 oHgmrjySBJv6iClGqFscw7WSJ09rHd51prNGe2gWkE8tp3gyvX03VVcvFYyvOgrJNXNcXn7Z4b2
 nVY24Wf2XM3/6oxZt16fnU1KdWBRveAEh+mWzVPlu0mdA2kOk2BTawADbjphFqNURmupCtydN/0
 d2dB5FUsntkD4AVJQ1kltAsNaJPsQIZbkGE+PSUlPNB5lj/Yrz+vTfwaxGirzZUWsQ=
X-Google-Smtp-Source: AGHT+IGkk5kF7Mh2TG1kZzG4JNrXFcapHvhDbb2wiLFQ+9zQPYC+ugyaCaP1gOkH1icGDjNpAXdMxA==
X-Received: by 2002:a05:6a00:190c:b0:729:1b8f:9645 with SMTP id
 d2e1a72fcca58-72dafbd02ecmr22454257b3a.24.1737381670309; 
 Mon, 20 Jan 2025 06:01:10 -0800 (PST)
Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-72dab7f3025sm7346151b3a.12.2025.01.20.06.01.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Jan 2025 06:01:09 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: iyzsong@HIDDEN
Subject: Re: [bug#75688] [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace
 harmful environment variables
In-Reply-To: <cover.1737374057.git.iyzsong@HIDDEN> (iyzsong@HIDDEN's
 message of "Mon, 20 Jan 2025 20:04:37 +0800")
References: <cover.1737374057.git.iyzsong@HIDDEN>
Date: Mon, 20 Jan 2025 23:00:57 +0900
Message-ID: <87msfld1pi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: 75688 <at> debbugs.gnu.org, =?utf-8?B?5a6L5paH5q2m?= <iyzsong@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

iyzsong@HIDDEN writes:

> From: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
>
> Hello, we currently set many environment variables from search-paths, som=
e can be harmful for
> foreign system, which leading crash, eg: GDK_PIXBUF_MODULE_FILE, QT_PLUGI=
N_PATH, as reported in:
>
>  <https://issues.guix.gnu.org/53514>
>  <https://issues.guix.gnu.org/75523>
>  <https://issues.guix.gnu.org/73897>
>
> Instead of patch each software/library with its own environment variables=
 (GUIX_GTK3_PATH, GUIX_QT_PLUGIN_PATH),
> we can try patch all to calculate their from one GUIX_LIBRARY_PATH (defau=
lt to ~/.guix-profile/lib), since the
> problems mostly come from incompatible libraries ABI, so from "lib" const=
ruct its subdirectories should be enough.
> eg:
>   GTK3_PATH use: lib/gtk-3.0
>   FCITX_ADDONS_DIRS use: lib/fcitx5

Instead of reconstructing the paths from something like the suggested
new GUIX_LIBRARY_PATH, I think it'd be nice if additionally to the stock
environment variables supported by each software, we introduced GUIX_
prefixed variants such as GUIX_GTK3_PATH and GUIX_QT_PLUGIN_PATH which
would be used by the Guix search paths specifications defined on these
packages.

> First patch add GUIX_LIBRARY_PATH to the default search paths, like PATH.
> Second patch replace GDK_PIXBUF_MODULE_FILE with GUIX_LIBRARY_PATH.

For the GDK_PIXBUF_MODULE_FILE special case, the problem is foremost
that it's a single entry value; as mentioned previously it'd be nice if
we could contribute a true multi-items variant named
GDK_PIXBUF_MODULE_FILES that could point to more than one file.
Alternatively we could use GUIX_GDK_PIXBUF_MODULE_FILE.  But I don't see
why we should use an intermetate GUIX_LIBRARY_PATH to compute all the
other correct paths; this should be left to the search paths, in my
opinion (as it's simpler, cleaner).

Thanks for the initiative!  Let me know if I misunderstood something.

--=20
Maxim




Information forwarded to guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 20 Jan 2025 12:03:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 07:03:40 2025
Received: from localhost ([127.0.0.1]:49231 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZqVI-00059x-0n
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:03:40 -0500
Received: from mail.envs.net ([5.199.136.28]:60472)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tZqVC-00059f-KQ
 for 75688 <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:03:35 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 8F36638A3E16;
 Mon, 20 Jan 2025 12:03:32 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id AZOtMjSbeiNg; Mon, 20 Jan 2025 12:03:29 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 20 Jan 2025 12:03:28 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 7d02abf6;
 Mon, 20 Jan 2025 12:06:55 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH 2/2] gnu: gdk-pixbuf: Respect GUIX_LIBRARY_PATH.
Date: Mon, 20 Jan 2025 20:06:51 +0800
Message-ID: <9596193713fcfc45725e0b1f0008bf0453d352f1.1737374057.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <cover.1737374057.git.iyzsong@HIDDEN>
References: <cover.1737374057.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

This fixes <https://issues.guix.gnu.org/75523>.

* gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/gtk.scm (gdk-pixbuf)[source]: Apply patch.
[native-search-paths]: Remove GDK_PIXBUF_MODULE_FILE.

Change-Id: I109565e5f506b9335856143f68abe164aff3cd26
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gtk.scm                          | 12 ++----
 ...gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch | 42 +++++++++++++++++++
 3 files changed, 46 insertions(+), 9 deletions(-)
 create mode 100644 gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e06a605712..133512d613 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1400,6 +1400,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
   %D%/packages/patches/gdb-hurd64.patch				\
+  %D%/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch	\
   %D%/packages/patches/gdm-default-session.patch		\
   %D%/packages/patches/gdm-elogind-support.patch		\
   %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch	\
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 7ed7d7b7df..4a4069d495 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -726,7 +726,9 @@ (define-public gdk-pixbuf
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "0jz4kziz5lirnjjvbspbqzsigk8vnqknng1fga89d81vs5snr6zf"))))
+                "0jz4kziz5lirnjjvbspbqzsigk8vnqknng1fga89d81vs5snr6zf"))
+              (patches
+               (search-patches "gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch"))))
     (build-system meson-build-system)
     (outputs '("out" "debug"))
     (arguments
@@ -773,14 +775,6 @@ (define-public gdk-pixbuf
            ;; For the documentation.
            gi-docgen
            python-docutils))
-    (native-search-paths
-     ;; This file is produced by the gdk-pixbuf-loaders-cache-file
-     ;; profile hook.
-     (list (search-path-specification
-            (variable "GDK_PIXBUF_MODULE_FILE")
-            (files (list %gdk-pixbuf-loaders-cache-file))
-            (separator #f)              ;single valued
-            (file-type 'regular))))
     (synopsis "Image loading library")
     (description "GdkPixbuf is a library that loads image data in various
 formats and stores it as linear buffers in memory.  The buffers can then be
diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch
new file mode 100644
index 0000000000..3ec7bc28ab
--- /dev/null
+++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch
@@ -0,0 +1,42 @@
+diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
+index e1df590..e553eba 100644
+--- a/gdk-pixbuf/gdk-pixbuf-io.c
++++ b/gdk-pixbuf/gdk-pixbuf-io.c
+@@ -663,6 +663,19 @@ gdk_pixbuf_io_init_builtin (void)
+ #undef load_one_builtin_module
+ }
+ 
++
++static gchar **
++build_guix_library_path (void)
++{
++        gchar **dirs = NULL;
++        gchar *library_path = g_strdup (g_getenv ("GUIX_LIBRARY_PATH"));
++        if (!library_path || !library_path[0])
++            library_path = g_build_filename (g_get_home_dir (), ".guix-profile", "lib", NULL);
++        dirs = g_strsplit (library_path, G_SEARCHPATH_SEPARATOR_S, 0);
++        g_free (library_path);
++        return dirs;
++}
++
+ static gboolean
+ gdk_pixbuf_io_init (void)
+ {
+@@ -670,6 +683,17 @@ gdk_pixbuf_io_init (void)
+ 	gboolean ret;
+ 
+ 	gdk_pixbuf_io_init_builtin ();
++
++	/* Load loaders from GUIX_LIBRARY_PATH */
++	gchar **guix_libdirs = build_guix_library_path ();
++	for (gsize i = 0; guix_libdirs[i] != NULL; i++) {
++	    module_file = g_build_filename (guix_libdirs[i], "gdk-pixbuf-2.0",
++                                            GDK_PIXBUF_BINARY_VERSION, "loaders.cache", NULL);
++	    gdk_pixbuf_io_init_modules (module_file, NULL);
++	    g_free (module_file);
++	}
++	g_strfreev (guix_libdirs);
++
+ #ifdef USE_GMODULE
+ 	module_file = gdk_pixbuf_get_module_file ();
+ #endif
-- 
2.47.1





Information forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at 75688 <at> debbugs.gnu.org:


Received: (at 75688) by debbugs.gnu.org; 20 Jan 2025 12:03:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 07:03:34 2025
Received: from localhost ([127.0.0.1]:49228 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZqVC-00059g-CX
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:03:34 -0500
Received: from mail.envs.net ([5.199.136.28]:60466)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tZqV9-00059W-CF
 for 75688 <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:03:32 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 84F7038A3E15;
 Mon, 20 Jan 2025 12:03:30 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id M6w6s9B9-OsH; Mon, 20 Jan 2025 12:03:27 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 20 Jan 2025 12:03:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id acc2ad42;
 Mon, 20 Jan 2025 12:06:55 +0000 (UTC)
From: iyzsong@HIDDEN
To: 75688 <at> debbugs.gnu.org
Subject: [PATCH 1/2] profiles: Add $GUIX_LIBRARY_PATH to default search paths.
Date: Mon, 20 Jan 2025 20:06:50 +0800
Message-ID: <26c794d4f4f2d2d8a118e35b0509c190df21373d.1737374057.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
In-Reply-To: <cover.1737374057.git.iyzsong@HIDDEN>
References: <cover.1737374057.git.iyzsong@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75688
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: 宋文武 <iyzsong@HIDDEN>

* guix/search-paths.scm ($GUIX_LIBRARY_PATH): New search path.
* guix/profiles.scm (manifest-search-paths): Add $GUIX_LIBRARY_PATH.
* guix/build/profiles.scm (manifest-sexp->inputs+search-paths): Add
$GUIX_LIBRARY_PATH.

Change-Id: I9ff090552bb40df7b42aaec71d587d3db07b20ed
---
 guix/build/profiles.scm |  1 +
 guix/profiles.scm       |  8 ++++----
 guix/search-paths.scm   | 10 ++++++++++
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/guix/build/profiles.scm b/guix/build/profiles.scm
index b19d93f971..760b519bfa 100644
--- a/guix/build/profiles.scm
+++ b/guix/build/profiles.scm
@@ -180,6 +180,7 @@ (define (manifest-sexp->inputs+search-paths manifest)
           (values (reverse inputs)
                   (delete-duplicates
                    (cons* $PATH
+                          $GUIX_LIBRARY_PATH
                           $GUIX_EXTENSIONS_PATH
                           (map sexp->search-path-specification
                                (reverse search-paths)))))))))))
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 87b9543ac0..f6ec51fe0b 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -742,11 +742,11 @@ (define (manifest-matching-entries manifest patterns)
 
 (define (manifest-search-paths manifest)
   "Return the list of search path specifications that apply to MANIFEST,
-including the search path specification for $PATH."
+including the search path specification for $PATH and $GUIX_LIBRARY_PATH."
   (delete-duplicates
-   (cons $PATH
-         (append-map manifest-entry-search-paths
-                     (manifest-entries manifest)))))
+   (cons* $PATH $GUIX_LIBRARY_PATH
+          (append-map manifest-entry-search-paths
+                      (manifest-entries manifest)))))
 
 (define* (manifest->code manifest
                          #:key (entry-package-version (const "")))
diff --git a/guix/search-paths.scm b/guix/search-paths.scm
index 27fcb78054..359ddc1750 100644
--- a/guix/search-paths.scm
+++ b/guix/search-paths.scm
@@ -40,6 +40,7 @@ (define-module (guix search-paths)
             $LIBRARY_PATH
             $GUIX_EXTENSIONS_PATH
             $PATH
+            $GUIX_LIBRARY_PATH
             $PKG_CONFIG_PATH
             $SSL_CERT_DIR
             $SSL_CERT_FILE
@@ -128,6 +129,15 @@ (define $PATH
    (variable "PATH")
    (files '("bin" "sbin"))))
 
+(define $GUIX_LIBRARY_PATH
+  ;; Set some environment variables can make a foreign system crash, eg:
+  ;;   GDK_PIXBUF_MODULE_FILE  <https://issues.guix.gnu.org/75523>
+  ;;   QT_PLUGIN_PATH          <https://issues.guix.gnu.org/73897>
+  ;; For those cases, we could patch softwares to use this special variable.
+  (search-path-specification
+   (variable "GUIX_LIBRARY_PATH")
+   (files '("lib"))))
+
 (define $GUIX_EXTENSIONS_PATH
   ;; 'GUIX_EXTENSIONS_PATH' is used by Guix to locate extension commands.
   ;; Unlike 'PATH', it is attached to a package, Guix; however, it is
-- 
2.47.1





Information forwarded to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Jan 2025 12:01:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 07:01:45 2025
Received: from localhost ([127.0.0.1]:49221 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZqTR-000567-AW
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:01:45 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50802)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tZqTO-00055t-R4
 for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 07:01:43 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <iyzsong@HIDDEN>) id 1tZqTJ-0003dY-8e
 for guix-patches@HIDDEN; Mon, 20 Jan 2025 07:01:37 -0500
Received: from mail.envs.net ([5.199.136.28])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <iyzsong@HIDDEN>) id 1tZqTH-0007VL-7h
 for guix-patches@HIDDEN; Mon, 20 Jan 2025 07:01:36 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 34C6038A3E16;
 Mon, 20 Jan 2025 12:01:30 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at mail.envs.net
Received: from mail.envs.net ([127.0.0.1])
 by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Au3xbN3trl-X; Mon, 20 Jan 2025 12:01:26 +0000 (UTC)
Received: from localhost (unknown [112.44.100.254])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.envs.net (Postfix) with ESMTPSA;
 Mon, 20 Jan 2025 12:01:26 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id b0f51109;
 Mon, 20 Jan 2025 12:04:50 +0000 (UTC)
From: iyzsong@HIDDEN
To: guix-patches@HIDDEN
Subject: [PATCH 0/2] Introduce GUIX_LIBRARY_PATH to replace harmful
 environment variables
Date: Mon, 20 Jan 2025 20:04:37 +0800
Message-ID: <cover.1737374057.git.iyzsong@HIDDEN>
X-Mailer: git-send-email 2.47.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Debbugs-Cc: Liliana Marie Prikler <liliana.prikler@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Vivien Kraus <vivien@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=5.199.136.28; envelope-from=iyzsong@HIDDEN;
 helo=mail.envs.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

From: 宋文武 <iyzsong@HIDDEN>

Hello, we currently set many environment variables from search-paths, some can be harmful for
foreign system, which leading crash, eg: GDK_PIXBUF_MODULE_FILE, QT_PLUGIN_PATH, as reported in:

 <https://issues.guix.gnu.org/53514>
 <https://issues.guix.gnu.org/75523>
 <https://issues.guix.gnu.org/73897>

Instead of patch each software/library with its own environment variables (GUIX_GTK3_PATH, GUIX_QT_PLUGIN_PATH),
we can try patch all to calculate their from one GUIX_LIBRARY_PATH (default to ~/.guix-profile/lib), since the
problems mostly come from incompatible libraries ABI, so from "lib" construct its subdirectories should be enough.
eg:
  GTK3_PATH use: lib/gtk-3.0
  FCITX_ADDONS_DIRS use: lib/fcitx5

First patch add GUIX_LIBRARY_PATH to the default search paths, like PATH.
Second patch replace GDK_PIXBUF_MODULE_FILE with GUIX_LIBRARY_PATH.

If this is fine, I could work on replace QT_PLUGIN_PATH, etc. later.
What do you think?  Thank you! 


Sou Bunnbu (宋文武) (2):
  profiles: Add $GUIX_LIBRARY_PATH to default search paths.
  gnu: gdk-pixbuf: Respect GUIX_LIBRARY_PATH.

 gnu/local.mk                                  |  1 +
 gnu/packages/gtk.scm                          | 12 ++----
 ...gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch | 42 +++++++++++++++++++
 guix/build/profiles.scm                       |  1 +
 guix/profiles.scm                             |  8 ++--
 guix/search-paths.scm                         | 10 +++++
 6 files changed, 61 insertions(+), 13 deletions(-)
 create mode 100644 gnu/packages/patches/gdk-pixbuf-respect-GUIX_LIBRARY_PATH.patch


base-commit: c985075db3e6682d8a5a231c01c770aa5a147f72
-- 
2.47.1





Acknowledgement sent to iyzsong@HIDDEN:
New bug report received and forwarded. Copy sent to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to liliana.prikler@HIDDEN, maxim.cournoyer@HIDDEN, vivien@HIDDEN, guix-patches@HIDDEN:
bug#75688; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 27 Jan 2025 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.