GNU logs - #76428, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: iyzsong@HIDDEN
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 20 Feb 2025 04:06:02 +0000
Resent-Message-ID: <handler.76428.B.17400243122822 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 76428 <at> debbugs.gnu.org
Cc: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.17400243122822
          (code B ref -1); Thu, 20 Feb 2025 04:06:02 +0000
Received: (at submit) by debbugs.gnu.org; 20 Feb 2025 04:05:12 +0000
Received: from localhost ([127.0.0.1]:57203 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tkxoB-0000hm-O8
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 23:05:12 -0500
Received: from lists.gnu.org ([2001:470:142::17]:37004)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tkxo9-0000cB-6D
 for submit <at> debbugs.gnu.org; Wed, 19 Feb 2025 23:05:06 -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 1tkxnx-0003kz-Fw
 for guix-patches@HIDDEN; Wed, 19 Feb 2025 23:04:53 -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 1tkxnt-0000fF-Vk
 for guix-patches@HIDDEN; Wed, 19 Feb 2025 23:04:52 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 48BC038A3E89;
 Thu, 20 Feb 2025 04:04:40 +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 FmLO5oPLJfz9; Thu, 20 Feb 2025 04:04:36 +0000 (UTC)
Received: from localhost (unknown [112.44.101.188])
 (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, 20 Feb 2025 04:04:36 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id aef8af97;
 Thu, 20 Feb 2025 04:08:31 +0000 (UTC)
From: iyzsong@HIDDEN
Date: Thu, 20 Feb 2025 12:08:23 +0800
Message-ID: <20250220040827.4127-1-iyzsong@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
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=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
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>

* 003-set-search-paths-without-program-wrappers.md: New file.
---
 ...t-search-paths-without-program-wrappers.md | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 003-set-search-paths-without-program-wrappers.md

diff --git a/003-set-search-paths-without-program-wrappers.md b/003-set-search-paths-without-program-wrappers.md
new file mode 100644
index 0000000..1a75bcb
--- /dev/null
+++ b/003-set-search-paths-without-program-wrappers.md
@@ -0,0 +1,146 @@
+title: Set search paths without program wrappers
+id: 003
+status: submitted
+discussion: https://issues.guix.gnu.org/<number assigned by issue tracker>
+authors: 宋文武 <iyzsong@HIDDEN>
+sponsors: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
+date-submitted: 2025-02-20
+date: 2025-02-20
+SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-only
+---
+
+# Summary
+
+Currently program wrappers are widely used to set search paths via
+environment variables.  Those wrappers have some problems:
+
+  - environment variables leakage from a process to its child
+    processes;
+  - duplicate entries in environment variables;
+  - obscured process names.
+
+To address those problems, we propose a way to set search paths with
+some per-output configuration files, reduce the need of creating
+program wrappers.
+
+
+# Motivation
+
+To make sure programs work out-of-the-box rather then depend on some
+external settings, Guix encourages the use of [program wrappers](https://guix.gnu.org/manual/en/html_node/Build-Utilities.html#Wrappers)
+when define packages.  In particular,  both `glib-or-gtk-build-system`
+and `qt-build-system` includes a wrap phase to make program wrappers for every
+GNOME and KDE program.
+
+Those wrappers have some unsolved issues:
+
+- [Program crash due to leaked environment variables](https://issues.guix.gnu.org/63203)
+- [Duplicate entries in various environment variables](https://issues.guix.gnu.org/23118)
+- [Ansible & others' problems with wrapped '.ansible-real' scripts](https://issues.guix.gnu.org/26752)
+
+If we managed to find a way to set search paths without using program
+wappers, then programs will be more robust.
+
+
+# Detailed Design
+
+In addition to environment variables, some programs also allow to set search
+paths via configuration files, for example you can use
+[path configuration files](https://docs.python.org/3/library/site.html)
+to set `sys.path` for Python, and we have a per-output [`ld.so.cache`](https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/)
+to load shared libraries efficiently.  Inspired by them, we are going to patch
+some programs and libraries, so that when they build a search path from an
+environment variable, would also honor a per-output search path configuration
+file.  The details are how to make those search path configuration files and
+how to find them when an executable is running.
+
+## Search path configuration files
+
+We'll create search path configuration files under the `etc/search-path.d`
+directory of each package output, with each file specify a search path.
+The file name and its content are same to the corresponding environment
+variable.  For example the output of the `gnome-console` package would have:
+
+```
+bin
+  kgx
+etc
+  ld.so.cache
+  search-paths.d
+    GUIX_XDG_DATA_DIRS
+    GUIX_GIO_EXTRA_MODULES
+    GUIX_GTK4_PATH
+lib
+share
+```
+
+The content of its `GUIX_XDG_DATA_DIRS` file would be:
+```
+/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/share:/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libadwaita-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-console-44.4/share
+```
+
+Those search path configuration files would be created by the package builder,
+after the `install` phase, replace usages of `wrap-program` when possible.
+
+
+## Find the location of the current executable
+
+To find its search path configuration files when an executable is running,
+we can first find the location of the executable.  Conveniently, Linux
+provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
+well for ELF executables.   But for an interpreter script, `/proc/self/exe`
+would return the file name of its interpreter instead of the script, so
+we patch interpreters to set 2 environment variables:
+
+  - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
+  - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
+
+And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
+we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternatively,
+we can try to construct the script file name from command line arguments, but
+that won't work when you run a script using a relative file name and its
+current working directory changed before we figure out the script file name.
+
+
+## Implementation plan
+
+A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.
+
+- Add a new function `g_guix_build_search_path_dirs` to GLib, which returns a
+  search path as a list of file or directory names from a search path
+  configuration file and an environment variable.
+- Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
+  `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
+  `GUIX_GSETTINGS_SCHEMA_DIR`.
+- Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
+- Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
+  `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
+  `GUIX_QML2_IMPORT_PATH`, `GUIX_QTWEBENGINEPROCESS_PATH`.
+- Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
+- Modify `qt-build-system` to get rid of `wrap-program`.
+
+
+# The Cost Of Reverting
+
+We can revert to program wrappers by manually adding wrap phases on a case by
+case basic, if needed.
+
+
+# Drawbacks or Open Questions
+
+If implemented, we would likely carry several custom patches for GLib,
+GTK, Qt, Python, etc. forever.
+
+
+This proposal focuses solving problems caused by program wrappers in desktop
+environments, namely GNOME and KDE.  Individual `wrap-progam` usages are not
+addressed.  We plan to handle that in build systems later, for example:
+
+  - Handle `GUIX_GI_TYPELIB_PATH` and `GUIX_GDK_PIXBUF_MODULE_FILES` in
+    `glib-or-gtk-build-system` without wrappers.
+  - Handle `GUIX_PYTHONPATH` in `python-build-system` without wrappers.
+
+
+There are still ABI problems caused by environment variables from
+profiles, which may be addressed later as suggested by Maxime Devos in
+<https://issues.guix.gnu.org/63203#5>.
-- 
2.48.1





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: iyzsong@HIDDEN
Subject: bug#76428: Acknowledgement ([GCD PATCH] 003-set-search-paths-without-program-wrappers:
 Submit.)
Message-ID: <handler.76428.B.17400243122822.ack <at> debbugs.gnu.org>
References: <20250220040827.4127-1-iyzsong@HIDDEN>
X-Gnu-PR-Message: ack 76428
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 76428 <at> debbugs.gnu.org
Date: Thu, 20 Feb 2025 04:06:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 76428 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
76428: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76428
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: Simon Tournier <zimon.toutoune@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 20 Feb 2025 17:26:05 +0000
Resent-Message-ID: <handler.76428.B76428.174007234013755 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: iyzsong@HIDDEN
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174007234013755
          (code B ref 76428); Thu, 20 Feb 2025 17:26:05 +0000
Received: (at 76428) by debbugs.gnu.org; 20 Feb 2025 17:25:40 +0000
Received: from localhost ([127.0.0.1]:39711 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlAIs-0003ZS-IQ
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 12:25:40 -0500
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:47544)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1tlAIp-0003Y0-EU
 for 76428 <at> debbugs.gnu.org; Thu, 20 Feb 2025 12:25:36 -0500
Received: by mail-wm1-x32c.google.com with SMTP id
 5b1f17b1804b1-439a1e8ba83so11792095e9.3
 for <76428 <at> debbugs.gnu.org>; Thu, 20 Feb 2025 09:25:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740072329; x=1740677129; 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=Ad4STafod6Nq70gYfA84jojg5TYUeK/Lj3qnyl7csx8=;
 b=JjumS4dHsDzoo8QGZEBPin6f7He57ueX+EZcGEwhGm0t0u5w1jMoB0m8VvVAtjg1Hy
 4SrMTKHpRdsSgxI4+EfKQ5qbi2eSRNo/PcqhzfXfZcE4yns2Bndz1rqYBxfk7fqzNqHJ
 jVSNOqgpyDlHcxdluObM1ZjLT5NhobsdcZfgHD3HOUN3ChbrIo1RbSADuU7m8jtF5l19
 IPcpea6969KqlLIftDlfXtYROHfY8xVFJaNCyVFT7IDfTIThAMOYTSGEQPCbw39Nu8er
 nEln6JIyNYC5LjMzqU1qqFUXsCRDkmyBTj8iQLwlmUX6zpFjyyCbsz7t1RZ2DzikHL6K
 lWJg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740072329; x=1740677129;
 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=Ad4STafod6Nq70gYfA84jojg5TYUeK/Lj3qnyl7csx8=;
 b=fxNXsSuamNog8t9KADskxO3+AKxjacufDVDd8ImshoZRiUfyc8/hALJtlWE5Vs4XmC
 XZrsK/Hm7hZ3XN28agmMcSu4cgn0sIaHFg/TxtS6M3B2sNyeZoPSWazdFBSTWheLcd6z
 VZ7GccPk8fmC/JqQtNps8QSC5NVp6PSpjcZlCiY4K4MlRDUxhnCLR1cJioHZ+Y1+7WLx
 iDXs0HAAhY163IxlMueKIvJq7nTl9vn+EYn3+2dJfB63/ZwHT/uCX0R7u8Sm9sA4IFnk
 jdfEuu3LgFAT79sS9KFE1GMQB/9oAp192ZbNULpjzVXVQuSjTxpF/vcCDqy8744c5RDy
 g0sA==
X-Gm-Message-State: AOJu0YwTky6Ek/1zHO9Y9YgM8Fe0631wb8gPpDc82fpZcbsobYlXM44h
 BTHQrMboDXuhL4xWxXJ+dU7B3htu+Z8vvFcrFrwU7db9N6qpOIyr
X-Gm-Gg: ASbGncvkYtDy3EwTe+odsgXmmhNjPWZHaQbZrBDdqQ9x7mOQCHu70FhDN1yCOHnspyI
 i+A8GF2EHPHrw3UPcqWfJ/cHPfwiQw/jPyW0jPS8BLLh/NjTzayD+0+f6zdEuxHOqJUOsqK2aRC
 az3sbRTr86mfEjmjPEwNiqaiIU/FmfXQ5oWuVgc/rineUCQc2UjVsHvPoHP05Hf/9NBN3tGQ6K/
 pNlUsuJqDdOB63JnOo5owpnQHwEwhMny95ji41xsPqEuIOmtCnxFXTXGFYGHpZpSnu+eefyiw04
 Zcpw90Q871/FuKrMgObXnluUWeTdbF5PjYjsbysHlatUWEJ9rTsl8QjodHemRXeQAuBpmy6g0C+
 1
X-Google-Smtp-Source: AGHT+IGyMJTXM6fu0OGe6D983TU+qZjNQPdY5ojbh2fu3e8UbYagb7wmgHPhrgT2aHAeBTGGANWAAA==
X-Received: by 2002:a05:6000:1863:b0:38f:2ffc:10b0 with SMTP id
 ffacd0b85a97d-38f6e978a1emr97610f8f.27.1740072327772; 
 Thu, 20 Feb 2025 09:25:27 -0800 (PST)
Received: from lili (roam-nat-fw-prg-194-254-61-47.net.univ-paris-diderot.fr.
 [194.254.61.47]) by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-38f259fdce7sm21382203f8f.96.2025.02.20.09.25.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 20 Feb 2025 09:25:27 -0800 (PST)
From: Simon Tournier <zimon.toutoune@HIDDEN>
In-Reply-To: <20250220040827.4127-1-iyzsong@HIDDEN> (iyzsong@HIDDEN's
 message of "Thu, 20 Feb 2025 12:08:23 +0800")
References: <20250220040827.4127-1-iyzsong@HIDDEN>
Date: Thu, 20 Feb 2025 14:24:15 +0100
Message-ID: <87eczseolc.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: 1.1 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi, On Thu, 20 Feb 2025 at 12:08,
 > * 003-set-search-paths-without-program-wrappers.md: New file. 
 Content analysis details:   (1.1 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2a00:1450:4864:20:0:0:0:32c listed in]
 [list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 1.1 DATE_IN_PAST_03_06     Date: is 3 to 6 hours before Received: date
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (zimon.toutoune[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
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 (/)

Hi,

On Thu, 20 Feb 2025 at 12:08, iyzsong@HIDDEN wrote:

> * 003-set-search-paths-without-program-wrappers.md: New file.

[...]

> +id: 003

Please consider that bug#76407 [1] is already 003.  Well, the numbering
changes nothing at this point.  The final number of this GCD =E2=80=9CSet s=
earch
paths without program wrappers=E2=80=9D will be 004 though.


> +SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-only

I think this should be: GFDL-1.3-no-invariants-or-later as GCD 001 and
000-template.md mentions it [2,3].

Except if you specifically want to be =E2=80=9C-only=E2=80=9D instead. :-)

Cheers,
simon


1: [bug#76407] [GCD] A better name for the default branch
Liliana Marie Prikler <liliana.prikler@HIDDEN>
Tue, 18 Feb 2025 23:07:07 +0100
id:b900cd17b88123af3ae95f4e7d572e540f86e879.camel@HIDDEN
https://issues.guix.gnu.org/76407
https://issues.guix.gnu.org/msgid/b900cd17b88123af3ae95f4e7d572e540f86e879.=
camel@HIDDEN
https://yhetil.org/guix/b900cd17b88123af3ae95f4e7d572e540f86e879.camel@gmai=
l.com

2: https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/tree=
/001-gcd-process.md?id=3Dc6a594ceb316e23bea975928eb2f40b7df450c94#n8

3: https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/tree=
/000-template.md?id=3Dc6a594ceb316e23bea975928eb2f40b7df450c94#n8




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [PATCH v2] 004-set-search-paths-without-program-wrappers: Submit.
References: <20250220040827.4127-1-iyzsong@HIDDEN>
In-Reply-To: <20250220040827.4127-1-iyzsong@HIDDEN>
Resent-From: iyzsong@HIDDEN
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 21 Feb 2025 02:28:01 +0000
Resent-Message-ID: <handler.76428.B76428.174010483623160 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 76428 <at> debbugs.gnu.org
Cc: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174010483623160
          (code B ref 76428); Fri, 21 Feb 2025 02:28:01 +0000
Received: (at 76428) by debbugs.gnu.org; 21 Feb 2025 02:27:16 +0000
Received: from localhost ([127.0.0.1]:47313 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlIl2-00061P-1z
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:27:16 -0500
Received: from mail.envs.net ([5.199.136.28]:33888)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tlIkx-00060f-Lj
 for 76428 <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:27:13 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id E54C238A3E53;
 Fri, 21 Feb 2025 02:27:09 +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 zyWQi67Cx3IK; Fri, 21 Feb 2025 02:27:06 +0000 (UTC)
Received: from localhost (unknown [112.44.101.188])
 (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, 21 Feb 2025 02:27:06 +0000 (UTC)
Received: from localhost.localdomain (localhost.lan [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id b0d4bb36;
 Fri, 21 Feb 2025 02:31:01 +0000 (UTC)
From: iyzsong@HIDDEN
Date: Fri, 21 Feb 2025 10:30:58 +0800
Message-ID: <20250221023100.2257-1-iyzsong@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
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>

* 004-set-search-paths-without-program-wrappers.md: New file.
---
 ...t-search-paths-without-program-wrappers.md | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 004-set-search-paths-without-program-wrappers.md

diff --git a/004-set-search-paths-without-program-wrappers.md b/004-set-search-paths-without-program-wrappers.md
new file mode 100644
index 0000000..39fb473
--- /dev/null
+++ b/004-set-search-paths-without-program-wrappers.md
@@ -0,0 +1,146 @@
+title: Set search paths without program wrappers
+id: 004
+status: submitted
+discussion: https://issues.guix.gnu.org/76428
+authors: 宋文武 <iyzsong@HIDDEN>
+sponsors: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
+date-submitted: 2025-02-20
+date: 2025-02-21
+SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-or-later
+---
+
+# Summary
+
+Currently program wrappers are widely used to set search paths via
+environment variables.  Those wrappers have some problems:
+
+  - environment variables leakage from a process to its child
+    processes;
+  - duplicate entries in environment variables;
+  - obscured process names.
+
+To address those problems, we propose a way to set search paths with
+some per-output configuration files, reduce the need of creating
+program wrappers.
+
+
+# Motivation
+
+To make sure programs work out-of-the-box rather then depend on some
+external settings, Guix encourages the use of [program wrappers](https://guix.gnu.org/manual/en/html_node/Build-Utilities.html#Wrappers)
+when define packages.  In particular,  both `glib-or-gtk-build-system`
+and `qt-build-system` includes a wrap phase to make program wrappers for every
+GNOME and KDE program.
+
+Those wrappers have some unsolved issues:
+
+- [Program crash due to leaked environment variables](https://issues.guix.gnu.org/63203)
+- [Duplicate entries in various environment variables](https://issues.guix.gnu.org/23118)
+- [Ansible & others' problems with wrapped '.ansible-real' scripts](https://issues.guix.gnu.org/26752)
+
+If we managed to find a way to set search paths without using program
+wappers, then programs will be more robust.
+
+
+# Detailed Design
+
+In addition to environment variables, some programs also allow to set search
+paths via configuration files, for example you can use
+[path configuration files](https://docs.python.org/3/library/site.html)
+to set `sys.path` for Python, and we have a per-output [`ld.so.cache`](https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/)
+to load shared libraries efficiently.  Inspired by them, we are going to patch
+some programs and libraries, so that when they build a search path from an
+environment variable, would also honor a per-output search path configuration
+file.  The details are how to make those search path configuration files and
+how to find them when an executable is running.
+
+## Search path configuration files
+
+We'll create search path configuration files under the `etc/search-path.d`
+directory of each package output, with each file specify a search path.
+The file name and its content are same to the corresponding environment
+variable.  For example the output of the `gnome-console` package would have:
+
+```
+bin
+  kgx
+etc
+  ld.so.cache
+  search-paths.d
+    GUIX_XDG_DATA_DIRS
+    GUIX_GIO_EXTRA_MODULES
+    GUIX_GTK4_PATH
+lib
+share
+```
+
+The content of its `GUIX_XDG_DATA_DIRS` file would be:
+```
+/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/share:/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libadwaita-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-console-44.4/share
+```
+
+Those search path configuration files would be created by the package builder,
+after the `install` phase, replace usages of `wrap-program` when possible.
+
+
+## Find the location of the current executable
+
+To find its search path configuration files when an executable is running,
+we can first find the location of the executable.  Conveniently, Linux
+provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
+well for ELF executables.   But for an interpreter script, `/proc/self/exe`
+would return the file name of its interpreter instead of the script, so
+we patch interpreters to set 2 environment variables:
+
+  - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
+  - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
+
+And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
+we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternatively,
+we can try to construct the script file name from command line arguments, but
+that won't work when you run a script using a relative file name and its
+current working directory changed before we figure out the script file name.
+
+
+## Implementation plan
+
+A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.
+
+- Add a new function `g_guix_build_search_path_dirs` to GLib, which returns a
+  search path as a list of file or directory names from a search path
+  configuration file and an environment variable.
+- Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
+  `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
+  `GUIX_GSETTINGS_SCHEMA_DIR`.
+- Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
+- Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
+  `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
+  `GUIX_QML2_IMPORT_PATH`, `GUIX_QTWEBENGINEPROCESS_PATH`.
+- Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
+- Modify `qt-build-system` to get rid of `wrap-program`.
+
+
+# The Cost Of Reverting
+
+We can revert to program wrappers by manually adding wrap phases on a case by
+case basic, if needed.
+
+
+# Drawbacks or Open Questions
+
+If implemented, we would likely carry several custom patches for GLib,
+GTK, Qt, Python, etc. forever.
+
+
+This proposal focuses solving problems caused by program wrappers in desktop
+environments, namely GNOME and KDE.  Individual `wrap-progam` usages are not
+addressed.  We plan to handle that in build systems later, for example:
+
+  - Handle `GUIX_GI_TYPELIB_PATH` and `GUIX_GDK_PIXBUF_MODULE_FILES` in
+    `glib-or-gtk-build-system` without wrappers.
+  - Handle `GUIX_PYTHONPATH` in `python-build-system` without wrappers.
+
+
+There are still ABI problems caused by environment variables from
+profiles, which may be addressed later as suggested by Maxime Devos in
+<https://issues.guix.gnu.org/63203#5>.
-- 
2.48.1





Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 21 Feb 2025 02:28:02 +0000
Resent-Message-ID: <handler.76428.B76428.174010487323453 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Simon Tournier <zimon.toutoune@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174010487323453
          (code B ref 76428); Fri, 21 Feb 2025 02:28:02 +0000
Received: (at 76428) by debbugs.gnu.org; 21 Feb 2025 02:27:53 +0000
Received: from localhost ([127.0.0.1]:47320 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlIld-000668-1t
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:27:53 -0500
Received: from mail.envs.net ([5.199.136.28]:46084)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tlIla-00065e-Qv
 for 76428 <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:27:51 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id F03BE38A3E53;
 Fri, 21 Feb 2025 02:27:49 +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 vCuFGfhXrxbI; Fri, 21 Feb 2025 02:27:45 +0000 (UTC)
Received: from localhost (unknown [112.44.101.188])
 (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, 21 Feb 2025 02:27:45 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id e7660d49;
 Fri, 21 Feb 2025 02:31:45 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87eczseolc.fsf@HIDDEN> (Simon Tournier's message of "Thu, 20
 Feb 2025 14:24:15 +0100")
References: <20250220040827.4127-1-iyzsong@HIDDEN> <87eczseolc.fsf@HIDDEN>
Date: Fri, 21 Feb 2025 10:31:44 +0800
Message-ID: <87v7t46nan.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-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 (-)

Simon Tournier <zimon.toutoune@HIDDEN> writes:

> Hi,
>
> On Thu, 20 Feb 2025 at 12:08, iyzsong@HIDDEN wrote:
>
>> * 003-set-search-paths-without-program-wrappers.md: New file.
>
> [...]
>
>> +id: 003
>
> Please consider that bug#76407 [1] is already 003.  Well, the numbering
> changes nothing at this point.  The final number of this GCD =E2=80=9CSet=
 search
> paths without program wrappers=E2=80=9D will be 004 though.
>
>
>> +SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-only
>
> I think this should be: GFDL-1.3-no-invariants-or-later as GCD 001 and
> 000-template.md mentions it [2,3].
>
> Except if you specifically want to be =E2=80=9C-only=E2=80=9D instead. :-)
>

Updated in v2, thank you!




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD] Set search paths without program wrappers
References: <20250220040827.4127-1-iyzsong@HIDDEN>
In-Reply-To: <20250220040827.4127-1-iyzsong@HIDDEN>
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 21 Feb 2025 02:39:04 +0000
Resent-Message-ID: <handler.76428.B76428.174010548729261 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: info-guix@HIDDEN
Cc: 76428 <at> debbugs.gnu.org
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174010548729261
          (code B ref 76428); Fri, 21 Feb 2025 02:39:04 +0000
Received: (at 76428) by debbugs.gnu.org; 21 Feb 2025 02:38:07 +0000
Received: from localhost ([127.0.0.1]:47474 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlIvQ-0007b0-Jq
	for submit <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:38:05 -0500
Received: from mail.envs.net ([5.199.136.28]:52350)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tlIvL-0007a5-Nx
 for 76428 <at> debbugs.gnu.org; Thu, 20 Feb 2025 21:37:59 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 3362038A3F62;
 Fri, 21 Feb 2025 02:37:54 +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 0lDVQkR88FjW; Fri, 21 Feb 2025 02:37:50 +0000 (UTC)
Received: from localhost (unknown [112.44.101.188])
 (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, 21 Feb 2025 02:37:50 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id f70ac00f;
 Fri, 21 Feb 2025 02:41:50 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Date: Fri, 21 Feb 2025 10:41:50 +0800
Message-ID: <87r03s6mtt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
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

Hi Guix, "GCD 004: Set search paths without program wrappers" was
submitted to address the issues of program wrappers.

Discuss via email in <76428 <at> debbugs.gnu.org>, thanks.


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline;
 filename=004-set-search-paths-without-program-wrappers.md
Content-Transfer-Encoding: quoted-printable

title: Set search paths without program wrappers
id: 004
status: submitted
discussion: https://issues.guix.gnu.org/76428
authors: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
sponsors: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
date-submitted: 2025-02-21
date: 2025-02-21
SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-or-later
---

# Summary

Currently program wrappers are widely used to set search paths via
environment variables.  Those wrappers have some problems:

  - environment variables leakage from a process to its child
    processes;
  - duplicate entries in environment variables;
  - obscured process names.

To address those problems, we propose a way to set search paths with
some per-output configuration files, reduce the need of creating
program wrappers.


# Motivation

To make sure programs work out-of-the-box rather then depend on some
external settings, Guix encourages the use of [program wrappers](https://gu=
ix.gnu.org/manual/en/html_node/Build-Utilities.html#Wrappers)
when define packages.  In particular,  both `glib-or-gtk-build-system`
and `qt-build-system` includes a wrap phase to make program wrappers for ev=
ery
GNOME and KDE program.

Those wrappers have some unsolved issues:

- [Program crash due to leaked environment variables](https://issues.guix.g=
nu.org/63203)
- [Duplicate entries in various environment variables](https://issues.guix.=
gnu.org/23118)
- [Ansible & others' problems with wrapped '.ansible-real' scripts](https:/=
/issues.guix.gnu.org/26752)

If we managed to find a way to set search paths without using program
wappers, then programs will be more robust.


# Detailed Design

In addition to environment variables, some programs also allow to set search
paths via configuration files, for example you can use
[path configuration files](https://docs.python.org/3/library/site.html)
to set `sys.path` for Python, and we have a per-output [`ld.so.cache`](http=
s://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/)
to load shared libraries efficiently.  Inspired by them, we are going to pa=
tch
some programs and libraries, so that when they build a search path from an
environment variable, would also honor a per-output search path configurati=
on
file.  The details are how to make those search path configuration files and
how to find them when an executable is running.

## Search path configuration files

We'll create search path configuration files under the `etc/search-path.d`
directory of each package output, with each file specify a search path.
The file name and its content are same to the corresponding environment
variable.  For example the output of the `gnome-console` package would have:

```
bin
  kgx
etc
  ld.so.cache
  search-paths.d
    GUIX_XDG_DATA_DIRS
    GUIX_GIO_EXTRA_MODULES
    GUIX_GTK4_PATH
lib
share
```

The content of its `GUIX_XDG_DATA_DIRS` file would be:
```
/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/share:=
/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libadwai=
ta-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-console=
-44.4/share
```

Those search path configuration files would be created by the package build=
er,
after the `install` phase, replace usages of `wrap-program` when possible.


## Find the location of the current executable

To find its search path configuration files when an executable is running,
we can first find the location of the executable.  Conveniently, Linux
provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
well for ELF executables.   But for an interpreter script, `/proc/self/exe`
would return the file name of its interpreter instead of the script, so
we patch interpreters to set 2 environment variables:

  - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
  - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script

And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternativel=
y,
we can try to construct the script file name from command line arguments, b=
ut
that won't work when you run a script using a relative file name and its
current working directory changed before we figure out the script file name.


## Implementation plan

A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.

- Add a new function `g_guix_build_search_path_dirs` to GLib, which returns=
 a
  search path as a list of file or directory names from a search path
  configuration file and an environment variable.
- Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS=
`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
  `GUIX_GSETTINGS_SCHEMA_DIR`.
- Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
- Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
  `GUIX_QML2_IMPORT_PATH`, `GUIX_QTWEBENGINEPROCESS_PATH`.
- Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
- Modify `qt-build-system` to get rid of `wrap-program`.


# The Cost Of Reverting

We can revert to program wrappers by manually adding wrap phases on a case =
by
case basic, if needed.


# Drawbacks or Open Questions

If implemented, we would likely carry several custom patches for GLib,
GTK, Qt, Python, etc. forever.


This proposal focuses solving problems caused by program wrappers in desktop
environments, namely GNOME and KDE.  Individual `wrap-progam` usages are not
addressed.  We plan to handle that in build systems later, for example:

  - Handle `GUIX_GI_TYPELIB_PATH` and `GUIX_GDK_PIXBUF_MODULE_FILES` in
    `glib-or-gtk-build-system` without wrappers.
  - Handle `GUIX_PYTHONPATH` in `python-build-system` without wrappers.


There are still ABI problems caused by environment variables from
profiles, which may be addressed later as suggested by Maxime Devos in
<https://issues.guix.gnu.org/63203#5>.

--=-=-=--




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [PATCH v2] 004-set-search-paths-without-program-wrappers: Submit.
Resent-From: Simon Tournier <zimon.toutoune@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Fri, 21 Feb 2025 19:24:04 +0000
Resent-Message-ID: <handler.76428.B76428.1740165838972 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: iyzsong@HIDDEN, 76428 <at> debbugs.gnu.org
Cc: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.1740165838972
          (code B ref 76428); Fri, 21 Feb 2025 19:24:04 +0000
Received: (at 76428) by debbugs.gnu.org; 21 Feb 2025 19:23:58 +0000
Received: from localhost ([127.0.0.1]:36355 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlYcv-0000FS-9t
	for submit <at> debbugs.gnu.org; Fri, 21 Feb 2025 14:23:57 -0500
Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46283)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <zimon.toutoune@HIDDEN>)
 id 1tlYcd-0000BU-3T
 for 76428 <at> debbugs.gnu.org; Fri, 21 Feb 2025 14:23:41 -0500
Received: by mail-wr1-x42b.google.com with SMTP id
 ffacd0b85a97d-38f2b7ce2f3so1818655f8f.0
 for <76428 <at> debbugs.gnu.org>; Fri, 21 Feb 2025 11:23:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740165813; x=1740770613; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=y7bkX4PkoHOdNaIBom7d7NhxnXsTABIwHiBZ+V2vUbE=;
 b=jTuvvFseERw9yGIm4zHz68dR87mo4fI1o4tm2tKJ03O6HmB4XAZ1AoEgVZKFL2kYsI
 ulfvlJaZqKd+egj1ZLE6FXAt9I+M9hOKWr7fspGHs198OdsIAS2qVYsAkwPDDAgCz3lN
 2qpluP9xqk2i8Hm0rHadf0WiJ1Dux5vkaHjvIbcDCSUPcx0Pgk0gZoFZgGIJUwdEj11L
 WXL9rrLWaV/V5LyFBsBUecp2GoA9r+MIjjG2ncpS68wbzPijRdiuMupoeXl/C1fEd+H1
 s7Z9HRN3dIVTUyw+wDZ+29DiJ7zFkcXOn53iSLGyJhx+AmbpoEjWOJi2beMn8deMiZPe
 aXuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740165813; x=1740770613;
 h=content-transfer-encoding:mime-version: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=y7bkX4PkoHOdNaIBom7d7NhxnXsTABIwHiBZ+V2vUbE=;
 b=DsVZ2CgzPsWzFjpz6SN2gpRJAZAQjwtEvMSlTnhb0jZD2FyEu/usBxcrtW658K8IQQ
 2vl5yP08fy0And63j/bWCXWLa2zU+r7TL7J64rbjnBNNMqtR4yG2mmZIMwPvz2KI8ZAh
 WoFJNs0lEutB0Id9JrQ4eld/M0rc5+yOZuMNgclzrvnQYp3+3Fj10qy0nEN4oTz9O7Wg
 /lYIYQ6N+sGasiW5tgp+wJZ4ZkhrSacBbV8WYZAc6NdMhSSM4PAWDEokfbzRvbJEFdyQ
 DBZvqF8vhj4zooDkcIeOL6Mtx6h/yZhM8eMN6c7a8Vqzelw0sXBngr+h/qG+a96hk4Dj
 Mf4w==
X-Forwarded-Encrypted: i=1;
 AJvYcCVBpfoLeaJfvcz87Lu+XHGZm39ZOaIjTmvyPGjTK1EEhkwBQ1asu9puaX3/qJlJLWQ7s/oRww==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YznDCHr1s5uyUqNkGMi93ykbr+zn2xJBkmTeoVoKB4f5WBtESWm
 aW8Ygtsyua8v+raUCRqLhLmGYNjd/N5fdr2l6oboaqj7og4QFLapfjePBA==
X-Gm-Gg: ASbGncsrQpniK6ktRwHlTOjBTH9y8NodDKxf8qGm1psuNnnvu7T1qL434NKaoEIsR26
 CkY3BPeP7lNPkjlxiFYFGIWYbVvBJHw+NCSdmVO0/nIbTN2gCBSaqmbGZ5Wa7O+wCrymLWScP9w
 K0LdSZ7SrThYYHmuxFb7GteJhpRi+js8o8ebBxnkr2Z+vZti7F8KXF0uc5i85+JzOkCByPVGf72
 i47aS6ynqk6c4TxrdZgJoHRB3wvuWU/XpcgQg1+fPtwNd7MisET/Pkn1xsHLbGxbErkP9Al65no
 A57/ZhbbtwShwryXaSap82mzl0unL/smInZAyXDetaLRIO4F4SKaKZJ7O2fA8tveaYPJ32f4XK8
 /h8PalPW65z0=
X-Google-Smtp-Source: AGHT+IHXcoGgYL8AjOA2yOeIt9r/lPJjzK1eSdumqRa0xw6NC/pH/12rICuvmbQKKjjJbCsRhPWZOA==
X-Received: by 2002:adf:e309:0:b0:38f:2b59:b550 with SMTP id
 ffacd0b85a97d-38f70857b6bmr3183893f8f.50.1740165812645; 
 Fri, 21 Feb 2025 11:23:32 -0800 (PST)
Received: from lili (roam-nat-fw-prg-194-254-61-44.net.univ-paris-diderot.fr.
 [194.254.61.44]) by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-439b02d519dsm25534855e9.11.2025.02.21.11.23.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 21 Feb 2025 11:23:32 -0800 (PST)
From: Simon Tournier <zimon.toutoune@HIDDEN>
In-Reply-To: <20250221023100.2257-1-iyzsong@HIDDEN>
References: <20250220040827.4127-1-iyzsong@HIDDEN>
 <20250221023100.2257-1-iyzsong@HIDDEN>
Date: Fri, 21 Feb 2025 18:47:06 +0100
Message-ID: <87bjuvry05.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
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 (-)

=E5=97=A8 =E5=AE=8B=E6=96=87=E6=AD=A6!

More or less copy/pasting [1] what I wrote to Liliana about GCD 003.

Now, the GCD=E2=80=99s submitted \o/, I recommend to push the two first
revisions and then each new revision to a dedicated branch, say
=E2=80=99wip-set-search-paths-without-program-wrapper=E2=80=99 directly to =
the GCDs
repository.

    https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git

You can take example from wip-default-branch-name. :-) At the end of the
process, this branch will be merged to =E2=80=99main=E2=80=99.

Why?  Based on the experience of 001, it can quickly become a mess. :-)

There is several revisions in different emails and all becomes harder
and harder to follow.  Do I read the last revision?  This one?  Ah no
there is this yet another email?  And that MUA screwed up the subject=E2=80=
=A6
Is it really the last revision?  etc.  Hard to follow; especially for
the ones who just want to read the last current revision.

Moreover, it=E2=80=99s more comfortable to read a plain file than a diff or=
 a
patch, IMHO.  For example, one specific revision of 001:

    https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/tre=
e/0001-rfc-process.md?id=3D7da54b980efcd23ce662040b00712bd7fa76982e

(It perfectly works with Emacs browser EWW so it works for any
browser. ;-))

Last, having all the revisions in a dedicated branch allows to easily
diff between each revision.

So for the next revision, you could announce a link for the new revision
(for example of a link, the one above) in addition to the patch or plain
file.

My 2 cents. :-)

Cheers,
simon



1: [bug#76407] [GCD] A better name for the default branch
Simon Tournier <zimon.toutoune@HIDDEN>
Thu, 20 Feb 2025 18:25:02 +0100
id:87frk8lea9.fsf@HIDDEN
https://issues.guix.gnu.org/76407
https://issues.guix.gnu.org/msgid/87frk8lea9.fsf@HIDDEN
https://yhetil.org/guix/87frk8lea9.fsf@HIDDEN




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD] Set search paths without program wrappers
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 22 Feb 2025 03:50:02 +0000
Resent-Message-ID: <handler.76428.B76428.17401961659265 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= via "Development of GNU Guix and the GNU System distribution." <guix-devel@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, Hartmut Goebel <h.goebel@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17401961659265
          (code B ref 76428); Sat, 22 Feb 2025 03:50:02 +0000
Received: (at 76428) by debbugs.gnu.org; 22 Feb 2025 03:49:25 +0000
Received: from localhost ([127.0.0.1]:42354 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlgW5-0002PI-0c
	for submit <at> debbugs.gnu.org; Fri, 21 Feb 2025 22:49:25 -0500
Received: from mail.envs.net ([5.199.136.28]:42448)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tlgW0-0002OH-9O
 for 76428 <at> debbugs.gnu.org; Fri, 21 Feb 2025 22:49:21 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 3DF0738A3ED5;
 Sat, 22 Feb 2025 03:49:18 +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 0S5IPH78H1KN; Sat, 22 Feb 2025 03:49:12 +0000 (UTC)
Received: from localhost (unknown [112.44.106.181])
 (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;
 Sat, 22 Feb 2025 03:49:11 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 9732e49a;
 Sat, 22 Feb 2025 03:53:07 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <877c5isnv1.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= via
 \"Development of GNU Guix
 and the GNU System distribution.\""'s message of "Sat, 22 Feb 2025
 10:40:50 +0800")
References: <87tt9dq6zc.fsf@HIDDEN>
 <3b03b83e-ad9b-4bb2-82b8-9285a8949d33@HIDDEN>
 <877c5isnv1.fsf@HIDDEN>
Date: Sat, 22 Feb 2025 11:53:07 +0800
Message-ID: <871pvqskik.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-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 (-)

=E5=AE=8B=E6=96=87=E6=AD=A6 via "Development of GNU Guix and the GNU System=
 distribution."
<guix-devel@HIDDEN> writes:

> Hartmut Goebel <h.goebel@HIDDEN> writes:
>
>> Hi,
>>
>> I don't understand what solution you propose.
>>
>> The GCD talks about setting some Env variable, like
>> `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE` (for Python).
>> What is happening then? Isn't there some code required for reading
>> the files in search-paths.d and set the variables
>> accordingly?
Add a small section to clarify where search-paths.d is used:

https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/commit/=
004-set-search-paths-without-program-wrappers.md?h=3Dwip-set-search-paths-w=
ithout-program-wrappers&id=3D990d1a273018a2782666089de2c9878f02cfe6e6


The lastest version of this GCD can be viewed from:

https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/plain/0=
04-set-search-paths-without-program-wrappers.md?h=3Dwip-set-search-paths-wi=
thout-program-wrappers


Hope it helps, thanks.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [PATCH v2] 004-set-search-paths-without-program-wrappers: Submit.
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 22 Feb 2025 03:53:03 +0000
Resent-Message-ID: <handler.76428.B76428.174019634511215 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Simon Tournier <zimon.toutoune@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174019634511215
          (code B ref 76428); Sat, 22 Feb 2025 03:53:03 +0000
Received: (at 76428) by debbugs.gnu.org; 22 Feb 2025 03:52:25 +0000
Received: from localhost ([127.0.0.1]:42408 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlgYz-0002uo-9k
	for submit <at> debbugs.gnu.org; Fri, 21 Feb 2025 22:52:25 -0500
Received: from mail.envs.net ([5.199.136.28]:37734)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tlgYx-0002uM-86
 for 76428 <at> debbugs.gnu.org; Fri, 21 Feb 2025 22:52:23 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 6999438A3ED5;
 Sat, 22 Feb 2025 03:52:22 +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 WtBPl8E5o80u; Sat, 22 Feb 2025 03:52:16 +0000 (UTC)
Received: from localhost (unknown [112.44.106.181])
 (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;
 Sat, 22 Feb 2025 03:52:16 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id fae60f79;
 Sat, 22 Feb 2025 03:56:16 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87bjuvry05.fsf@HIDDEN> (Simon Tournier's message of "Fri, 21
 Feb 2025 18:47:06 +0100")
References: <20250220040827.4127-1-iyzsong@HIDDEN>
 <20250221023100.2257-1-iyzsong@HIDDEN> <87bjuvry05.fsf@HIDDEN>
Date: Sat, 22 Feb 2025 11:56:16 +0800
Message-ID: <87eczqr5sv.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-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 (-)

Simon Tournier <zimon.toutoune@HIDDEN> writes:

> =E5=97=A8 =E5=AE=8B=E6=96=87=E6=AD=A6!
>
> More or less copy/pasting [1] what I wrote to Liliana about GCD 003.
>
> Now, the GCD=E2=80=99s submitted \o/, I recommend to push the two first
> revisions and then each new revision to a dedicated branch, say
> =E2=80=99wip-set-search-paths-without-program-wrapper=E2=80=99 directly t=
o the GCDs
> repository.

Done, thanks.


It now can be view from:

https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/tree/00=
4-set-search-paths-without-program-wrappers.md?h=3Dwip-set-search-paths-wit=
hout-program-wrappers




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Tue, 25 Feb 2025 16:54:02 +0000
Resent-Message-ID: <handler.76428.B76428.174050241315491 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: iyzsong@HIDDEN
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174050241315491
          (code B ref 76428); Tue, 25 Feb 2025 16:54:02 +0000
Received: (at 76428) by debbugs.gnu.org; 25 Feb 2025 16:53:33 +0000
Received: from localhost ([127.0.0.1]:48187 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmyBY-00041n-Nl
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 11:53:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:38968)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tmyBU-00041W-Se
 for 76428 <at> debbugs.gnu.org; Tue, 25 Feb 2025 11:53:30 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tmyBO-0000gx-Cg; Tue, 25 Feb 2025 11:53:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=SDk8uCQVBIqyec3SVLyKQ6nElgLYU92z1+CPTH5YvtQ=; b=mBVYNONVrOVDBL8phXq0
 Xf98Mrt0p6vvQGFo6zLCCIoZbQnEdDcUKc+b/MPHuqNv1McKNbwLVEHdeLXzVmGuaUPKL5s9TxQJK
 gvGESWHFsNOAmfKqZ1z2JH93ih1rwZbLqMRMwa7jdpE8mvC3fGXlVxiVqf4I8UA0XW957lt0SjFhH
 da9TuMYvUBXUS0NP4SaWXvNK+ercKidSk64qq5nYN92KPIX4PHRQbLTOF/G76NrKv9EDZcXE+ry8E
 eACgyrwVwkE1ZjegbGlsHGsFm1smkD31Wv3CnRgbejWoaMPr6HbJIXsPMA8jaXto6gFEaM37cmm2x
 LC0k/WklwCk8dg==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <20250220040827.4127-1-iyzsong@HIDDEN> (iyzsong@HIDDEN's
 message of "Thu, 20 Feb 2025 12:08:23 +0800")
References: <20250220040827.4127-1-iyzsong@HIDDEN>
Date: Tue, 25 Feb 2025 17:53:00 +0100
Message-ID: <871pvmnez7.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: -2.3 (--)
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: -3.3 (---)

Hi =E5=AE=8B=E6=96=87=E6=AD=A6,

iyzsong@HIDDEN skribis:

> +etc
> +  ld.so.cache
> +  search-paths.d
> +    GUIX_XDG_DATA_DIRS
> +    GUIX_GIO_EXTRA_MODULES
> +    GUIX_GTK4_PATH
> +lib
> +share
> +```
> +
> +The content of its `GUIX_XDG_DATA_DIRS` file would be:
> +```
> +/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/sha=
re:/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libad=
waita-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-cons=
ole-44.4/share
> +```
> +
> +Those search path configuration files would be created by the package bu=
ilder,
> +after the `install` phase, replace usages of `wrap-program` when possibl=
e.

One thought came to mind.

If we are going to provide that sort of metadata along side package
build results, what about providing a =E2=80=98package=E2=80=99 sexp simila=
r to those
found in the =E2=80=98manifest=E2=80=99 file of profiles (see =E2=80=98mani=
fest->gexp=E2=80=99), for
example in =E2=80=98etc/guix/package=E2=80=99?

The sexp could provide info such as: the package name and version, its
search paths, maybe its propagated inputs.

This could have applications for things like =E2=80=98guix health=E2=80=99=
=C2=B9 and maybe
even fixing <https://issues.guix.gnu.org/20255>.

But now I realize that the main drawback of this approach is that it
would be too hard to parse that in GLib etc.

So this is probably not a useful comment, but now we have it on record.
:-)

Thanks,
Ludo=E2=80=99.

=C2=B9 https://issues.guix.gnu.org/31444




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 26 Feb 2025 04:14:02 +0000
Resent-Message-ID: <handler.76428.B76428.17405431833644 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17405431833644
          (code B ref 76428); Wed, 26 Feb 2025 04:14:02 +0000
Received: (at 76428) by debbugs.gnu.org; 26 Feb 2025 04:13:03 +0000
Received: from localhost ([127.0.0.1]:50244 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tn8n9-0000wi-0U
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 23:13:03 -0500
Received: from mail.envs.net ([5.199.136.28]:38538)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tn8mx-0000w0-Pl
 for 76428 <at> debbugs.gnu.org; Tue, 25 Feb 2025 23:12:53 -0500
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id C1DF038A3F73;
 Wed, 26 Feb 2025 04:12:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1740543169; bh=cpX+vLYN2XvZRdri4oMfVgOoJIQXeFQ/I35QDRlh2eg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=FoKkTQ5bwM/tlv90OrVzXyCon/RnMNOSQJtpedlSCCyRUE9UixL9m9mS/gTCllzyM
 jL/5Xa13CZuh6xdIyvd2CVYBVeWSLOZMYT0g01aldzW3lbb/intwawgSxAhXLVcvlR
 ST3KB5I7vo7QJ9QS/QloX26Waovg1Mx0VYB9PHrtL/wg77C3i0lYbGLimk32qM5eHr
 lnInDwVLb8dECKeRmOXS8U8YDwSOdeupCKMuLDddpgXZW+KHfwvNVtpevt8caPzdxk
 O9XGRBzvaAv5w3FLNLVInSJqMaakGinDFXOZo8oRy1WkcbakP5aEDG3xTd1o5jb31w
 o6+iBZ8Nr+1r1606yPvskS50ZQ7ojoooMEjOiTj9GfoPnWJReWyGqAX8lHOECdM8dL
 WbrqsGJJMVacMx3KPaVmZwyMPEwmefWcCoVB6gSr8ddJoj/OgvwGcMVxA7KJYjv+2w
 6cPzJpISYl7uB6JGWAzHDS2Z/hOHk0AHFswveanLu0S7+JyaghMUrSa6trhT6YbuAI
 dT4g0XI9GdCLjFyZhbDECd8XSKyofnjj4DNtm21ox2nqHuMm6uoRNGg5+NrzMJvusw
 Os29TUrizEFksFA5U2Al59/k+twYAfrLSblq6Xyla9pC2uDNKrS09ENC1y5C5GIZ8D
 0rx+TRtr/ZH7tqxzYruJyex4=
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 pLtjfBzFUPqn; Wed, 26 Feb 2025 04:12:44 +0000 (UTC)
Received: from localhost (unknown [112.44.106.181])
 (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, 26 Feb 2025 04:12:43 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 6fe97bb2;
 Wed, 26 Feb 2025 04:16:38 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <871pvmnez7.fsf@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 25 Feb 2025 17:53:00 +0100")
References: <20250220040827.4127-1-iyzsong@HIDDEN> <871pvmnez7.fsf@HIDDEN>
Date: Wed, 26 Feb 2025 12:16:38 +0800
Message-ID: <877c5djq6x.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-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 (-)

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

>> [...]
>> +Those search path configuration files would be created by the package b=
uilder,
>> +after the `install` phase, replace usages of `wrap-program` when possib=
le.
>
> One thought came to mind.
>
> If we are going to provide that sort of metadata along side package
> build results, what about providing a =E2=80=98package=E2=80=99 sexp simi=
lar to those
> found in the =E2=80=98manifest=E2=80=99 file of profiles (see =E2=80=98ma=
nifest->gexp=E2=80=99), for
> example in =E2=80=98etc/guix/package=E2=80=99?

Okay, I guess that can be done in gnu-build-system.

>
> The sexp could provide info such as: the package name and version, its
> search paths, maybe its propagated inputs.
>
> This could have applications for things like =E2=80=98guix health=E2=80=
=99=C2=B9 and maybe
> even fixing <https://issues.guix.gnu.org/20255>.

That #20255 is already fixed, by 'guix package --search-paths' with
multiple profiles.

I think you mean <https://issues.guix.gnu.org/22138>:
  "Search paths of dependencies are not honored"

> But now I realize that the main drawback of this approach is that it
> would be too hard to parse that in GLib etc.

The sexp file and search-paths.d files could coexist, we can build the
latter from the former.


> So this is probably not a useful comment, but now we have it on record.

I see that a package level sexp metadata file would be useful, we could
do it indepent of this GCD.

Thanks.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 19 Mar 2025 14:02:02 +0000
Resent-Message-ID: <handler.76428.B76428.174239286211104 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: info-guix@HIDDEN
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174239286211104
          (code B ref 76428); Wed, 19 Mar 2025 14:02:02 +0000
Received: (at 76428) by debbugs.gnu.org; 19 Mar 2025 14:01:02 +0000
Received: from localhost ([127.0.0.1]:51684 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tutya-0002sX-0h
	for submit <at> debbugs.gnu.org; Wed, 19 Mar 2025 10:01:02 -0400
Received: from mail.envs.net ([5.199.136.28]:49974)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tutyT-0002sE-Sx
 for 76428 <at> debbugs.gnu.org; Wed, 19 Mar 2025 10:00:53 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 3F8BC38A3FDD;
 Wed, 19 Mar 2025 14:00:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1742392848; bh=BpiTnu0ZLsUJjbLYPdhxccO0Sf0/QaIfSJ1AdCzvL5Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=QsU938YMe+Ykncbs9RVC2cd33IZJ0+qxeLVoWU3Cxg2zhn+6409UaD+ikuPDKs17j
 mmOzI90r962fcuSj8KDlJWEdCAWXprR2IEgN1Bu3rLCTKRS5Qazw0v/DC42Y5zpK5d
 jZFcP1u9HaGuFErSrR1coO0mLw4yldusWqcgRTCHOIMBsQUVJwTDFJJLHHyKtJguFn
 piObmiuHiTj9lirZSyWrawCZFQc3pm1/0UtADxlwoN9RMSUMNfTiriEF6ngsuh3Inf
 myfI1Lpts2+HHga9i9Px3HJHBIySuR3UT33noYqSPHjcjORPii75KvO+zc9zUfQVXP
 DHTO0GVLQbVkLvkp4GW1CwHExzW55vVaq4HK8Ai1bRKHSNrXpxFwZXvkOHcSxtsCjp
 uYYJBzvz8P5PSorCUhC1I4s946tSQK7I/EHnORJv15EEqY2MtC8/ZceHfoulLqYqPJ
 k7CpHqPGiUx7GUWWhjQ+nLXj41jG85xtMFD65FxDVCX2bkLatbzaXUQw8WP2T6LTLo
 AYkrJ6ZuNHgjnFvHpCEciK82DgMJVmUfaSRMq1+u8Ygod5NewbkKgV/0ef0I9jvvqF
 LsE5iJPX9F3bYnby8+uE1WuPHiUXkOxhh3j/+uQdlEX7dBvAZErDxnFMhkSRCNpBl/
 n7HZ04hWYBeUyXjqpfqBjfPo=
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 5wcJpaUJHufc; Wed, 19 Mar 2025 14:00:42 +0000 (UTC)
Received: from localhost (unknown [112.44.105.62])
 (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, 19 Mar 2025 14:00:42 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id bc35146a;
 Wed, 19 Mar 2025 14:05:02 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87r03s6mtt.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= via
 \"Low-traffic mailing list
 for announcements to Guix users.\""'s message of "Fri, 21 Feb 2025
 10:41:50 +0800")
References: <87r03s6mtt.fsf@HIDDEN>
Date: Wed, 19 Mar 2025 22:05:02 +0800
Message-ID: <87a59hdskx.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-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, Below is the final version of GCD for "Set search paths without
program wrappers", which means now this GCD start its deliberation
period (14 days), so team members please reply to
<76428 <at> debbugs.gnu.org> with opinions.  Thanks!


link: https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/p=
lain/004-set-search-paths-without-program-wrappers.md
title: Set search paths without program wrappers
id: 004
status: submitted
discussion: https://issues.guix.gnu.org/76428
authors: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
sponsors: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
date-submitted: 2025-02-21
date: 2025-02-21
SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-or-later
---

# Summary

Currently program wrappers are widely used to set search paths via
environment variables.  Those wrappers have some problems:

  - environment variables leakage from a process to its child
    processes;
  - duplicate entries in environment variables;
  - obscured process names.

To address those problems, we propose a way to set search paths with
some per-output configuration files, reduce the need of creating
program wrappers.


# Motivation

To make sure programs work out-of-the-box rather then depend on some
external settings, Guix encourages the use of [program wrappers](https://gu=
ix.gnu.org/manual/en/html_node/Build-Utilities.html#Wrappers)
when define packages.  In particular,  both `glib-or-gtk-build-system`
and `qt-build-system` includes a wrap phase to make program wrappers for ev=
ery
GNOME and KDE program.

Those wrappers have some unsolved issues:

- [Program crash due to leaked environment variables](https://issues.guix.g=
nu.org/63203)
- [Duplicate entries in various environment variables](https://issues.guix.=
gnu.org/23118)
- [Ansible & others' problems with wrapped '.ansible-real' scripts](https:/=
/issues.guix.gnu.org/26752)

If we managed to find a way to set search paths without using program
wappers, then programs will be more robust.


# Detailed Design

In addition to environment variables, some programs also allow to set search
paths via configuration files, for example you can use
[path configuration files](https://docs.python.org/3/library/site.html)
to set `sys.path` for Python, and we have a per-output [`ld.so.cache`](http=
s://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/)
to load shared libraries efficiently.  Inspired by them, we are going to pa=
tch
some programs and libraries, so that when they build a search path from an
environment variable, would also honor a per-output search path configurati=
on
file.  The details are how to make those search path configuration files and
how to find them when an executable is running.

## Search path configuration files

We'll create search path configuration files under the `etc/search-path.d`
directory of each package output, with each file specify a search path.
The file name and its content are same to the corresponding environment
variable.  For example the output of the `gnome-console` package would have:

```
bin
  kgx
etc
  ld.so.cache
  search-paths.d
    GUIX_XDG_DATA_DIRS
    GUIX_GIO_EXTRA_MODULES
    GUIX_GTK4_PATH
lib
share
```

The content of its `GUIX_XDG_DATA_DIRS` file would be:
```
/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/share:=
/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libadwai=
ta-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-console=
-44.4/share
```

Those search path configuration files would be created by the package build=
er,
after the `install` phase, replace usages of `wrap-program` when possible.


## Find the location of the current executable

To find its search path configuration files when an executable is running,
we can first find the location of the executable.  Conveniently, Linux
provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
well for ELF executables.   But for an interpreter script, `/proc/self/exe`
would return the file name of its interpreter instead of the script, so
we patch interpreters to set 2 environment variables:

  - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
  - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script

And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternativel=
y,
we can try to construct the script file name from command line arguments, b=
ut
that won't work when you run a script using a relative file name and its
current working directory changed before we figure out the script file name.


## Set search paths with configuration files from search-paths.d

Finally, when the program want to build a search path from an
environment variable, we patch the code to search its `search-paths.d`
first, the result search path value will include both the content of
the search path configuration file and the environment variable.  This
usually happens in C/C++ libraries like GLib, GTK and Qt with a
`getenv` call, we need patch these `getenv` calls for each search path
we care.


## Implementation plan

A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.

- Add a new function `g_guix_build_search_path_dirs` to GLib, which returns=
 a
  search path as a list of file or directory names from a search path
  configuration file and an environment variable.
- Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS=
`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
  `GUIX_GSETTINGS_SCHEMA_DIR`.
- Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
- Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
  `GUIX_QML2_IMPORT_PATH`.
- Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
- Modify `qt-build-system` to get rid of `wrap-program`.


# The Cost Of Reverting

We can revert to program wrappers by manually adding wrap phases on a case =
by
case basic, if needed.


# Drawbacks or Open Questions

If implemented, we would likely carry several custom patches for GLib,
GTK, Qt, Python, etc. forever.


This proposal focuses solving problems caused by program wrappers in desktop
environments, namely GNOME and KDE.  Individual `wrap-progam` usages are not
addressed.  We plan to handle that in build systems later, for example:

  - Handle `GUIX_GI_TYPELIB_PATH` and `GUIX_GDK_PIXBUF_MODULE_FILES` in
    `glib-or-gtk-build-system` without wrappers.
  - Handle `GUIX_PYTHONPATH` in `python-build-system` without wrappers.


There are still ABI problems caused by environment variables from
profiles, which may be addressed later as suggested by Maxime Devos in
<https://issues.guix.gnu.org/63203#5>.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: "pelzflorian (Florian Pelz)" <pelzflorian@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Wed, 19 Mar 2025 16:28:03 +0000
Resent-Message-ID: <handler.76428.B76428.174240163629014 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 76428 <at> debbugs.gnu.org
Cc: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174240163629014
          (code B ref 76428); Wed, 19 Mar 2025 16:28:03 +0000
Received: (at 76428) by debbugs.gnu.org; 19 Mar 2025 16:27:16 +0000
Received: from localhost ([127.0.0.1]:52726 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tuwG9-0007XO-8o
	for submit <at> debbugs.gnu.org; Wed, 19 Mar 2025 12:27:15 -0400
Received: from relay.yourmailgateway.de ([188.68.63.102]:42071)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pelzflorian@HIDDEN>)
 id 1tuwG2-0007WB-QG
 for 76428 <at> debbugs.gnu.org; Wed, 19 Mar 2025 12:27:10 -0400
Received: from mors-relay-2502.netcup.net (localhost [127.0.0.1])
 by mors-relay-2502.netcup.net (Postfix) with ESMTPS id 4ZHvHD1Grtz64nx;
 Wed, 19 Mar 2025 17:26:48 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pelzflorian.de;
 s=key2; t=1742401608;
 bh=9qXhJXaRlaTgUEBHq68xlAh60ANdXPcxyCP9hKePDWo=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LWELEnLqLAshdyz6qbgNJbcASCsYMgwdcECYwCJ7IvHlYaovMce1EQuH5R9cQAPTn
 4W5Cu5eBOgdAIUrR7oXQeIR4MfpWqxvLUfSw1/Cr+MYluW0Gaus/MLnN6m+F9Vg+Ef
 whlL6EJTtW6iKDwtGAm1TvX2Cll/ljdLUGkq9xoUgoecXl8Y5Q1spdFnfcK7ZkBKjK
 2wCUaJRfGY0CNM5kusH5YzGzSF7SUQy0RbVaSbU2sdIkx+21/cLQykKnVxd7cBmPvw
 TxJmvQsXmQof1JZJFSs3ZH0dFIPl/YDdwoKyysiXpLkJ6MPuelDDsFaFdOIHFA0Rwi
 xuM4XDNPR4tZQ==
Received: from policy01-mors.netcup.net (unknown [46.38.225.35])
 by mors-relay-2502.netcup.net (Postfix) with ESMTPS id 4ZHvHD0YBvz4xbZ;
 Wed, 19 Mar 2025 17:26:48 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at policy01-mors.netcup.net
X-Spam-Flag: NO
X-Spam-Score: -2.897
X-Spam-Level: 
X-Spam-Status: No, score=-2.897 required=6.31 tests=[ALL_TRUSTED=-1,
 BAYES_00=-1.9, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001,
 URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mxe217.netcup.net (unknown [10.243.12.53])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by policy01-mors.netcup.net (Postfix) with ESMTPS id 4ZHvHB4Hn5z8t4D;
 Wed, 19 Mar 2025 17:26:46 +0100 (CET)
Received: from florianhp (ipb21a5dbf.dynamic.kabel-deutschland.de
 [178.26.93.191])
 by mxe217.netcup.net (Postfix) with ESMTPSA id 1F2AA84AF6;
 Wed, 19 Mar 2025 17:26:45 +0100 (CET)
From: "pelzflorian (Florian Pelz)" <pelzflorian@HIDDEN>
In-Reply-To: <87a59hdskx.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= via
 Guix-patches via"'s message of "Wed, 19 Mar 2025 22:05:02 +0800")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
Date: Wed, 19 Mar 2025 17:27:14 +0100
Message-ID: <87jz8loujh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Server: rspamd-worker-8404
X-Rspamd-Queue-Id: 1F2AA84AF6
X-NC-CID: aFbJ9iYOOjeFsnwVYtfE5PvPxX8nk+lzEM7NFThLxI6W1zsb8gj5DUH1
X-Spam-Score: 0.0 (/)
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 (-)

I support; it is needed and backwards-compatible as said on
<https://lists.gnu.org/archive/html/guix-devel/2025-02/msg00450.html>.

Regards,
Florian




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 22 Mar 2025 06:02:02 +0000
Resent-Message-ID: <handler.76428.B76428.174262326425174 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: info-guix@HIDDEN
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174262326425174
          (code B ref 76428); Sat, 22 Mar 2025 06:02:02 +0000
Received: (at 76428) by debbugs.gnu.org; 22 Mar 2025 06:01:04 +0000
Received: from localhost ([127.0.0.1]:40452 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tvrup-0006Xy-CZ
	for submit <at> debbugs.gnu.org; Sat, 22 Mar 2025 02:01:04 -0400
Received: from mail.envs.net ([5.199.136.28]:50994)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tvrum-0006XP-24
 for 76428 <at> debbugs.gnu.org; Sat, 22 Mar 2025 02:01:01 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id B0E1A38A3FEC;
 Sat, 22 Mar 2025 06:00:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1742623258; bh=BpiTnu0ZLsUJjbLYPdhxccO0Sf0/QaIfSJ1AdCzvL5Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=fIBbRo2oWI0qnSe80BMTXWC6YOl0SqHwSjIowutXV0zUYMcpdTWk7XnFMMhJLfKgC
 Nzg+uAcqc8rWPGaecUjTeaT5BGJYFxdGAH7Q9A92hLXisptbcF17NQSzK4G9/Rhqds
 EmXKzUN/nCuZcyjDsxAXru9TfxCat79e3GV04SphD+KOSy+GFgqIrt5oXt/jerallW
 SFqR9NElNLMVq9zOlKlXPlDTw1iSIp9au671ErHFEhVaXXgxYHmFwtt8NBWHS6IYSb
 Dig/V984bnVpFj6+DwYiGzEvNA9iGqjqPkBnl9hoLCaEfOwMWfTAyWzGH7iE2gWz4Z
 TB8zddM5tRUF/7Zc0hu3dYOxuZAIasIc/YNQon/JX712cFOLteEIyULeNpE8+9NvkB
 bTlEzKlMZ7GEILDweHG3ZDJ316ci7Zb52b8e0imob00V8JlD7552azdw/PCALroDDD
 DJ2N5/6w+OXkrk7V2B9A+TfjblSea43QiBRiutH3Ki47/hyflg7J40avYdooViO1j8
 0PL8iXmdDkEZIyMIrdYCYovejuT7DyS/4DHQ/hOGnpsCoXvk7KH3NvrQs3V9l4UKN6
 twFVc3pYzPQ4yTc8P/eqYAUcXHZc//Akm0kqkLBZJpzxHycySkBqDc4VqCTCCQSCNR
 dA64WWeJJf/UHiQ1u5vMiXFI=
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 rsDIS3YbdxM9; Sat, 22 Mar 2025 06:00:44 +0000 (UTC)
Received: from localhost (unknown [112.44.105.62])
 (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;
 Sat, 22 Mar 2025 06:00:43 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id bc35146a;
 Wed, 19 Mar 2025 14:05:02 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87r03s6mtt.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= via
 \"Low-traffic mailing list
 for announcements to Guix users.\""'s message of "Fri, 21 Feb 2025
 10:41:50 +0800")
References: <87r03s6mtt.fsf@HIDDEN>
Date: Wed, 19 Mar 2025 22:05:02 +0800
Message-ID: <87a59hdskx.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-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, Below is the final version of GCD for "Set search paths without
program wrappers", which means now this GCD start its deliberation
period (14 days), so team members please reply to
<76428 <at> debbugs.gnu.org> with opinions.  Thanks!


link: https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/p=
lain/004-set-search-paths-without-program-wrappers.md
title: Set search paths without program wrappers
id: 004
status: submitted
discussion: https://issues.guix.gnu.org/76428
authors: =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN>
sponsors: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
date-submitted: 2025-02-21
date: 2025-02-21
SPDX-License-Identifier: CC-BY-SA-4.0 OR GFDL-1.3-no-invariants-or-later
---

# Summary

Currently program wrappers are widely used to set search paths via
environment variables.  Those wrappers have some problems:

  - environment variables leakage from a process to its child
    processes;
  - duplicate entries in environment variables;
  - obscured process names.

To address those problems, we propose a way to set search paths with
some per-output configuration files, reduce the need of creating
program wrappers.


# Motivation

To make sure programs work out-of-the-box rather then depend on some
external settings, Guix encourages the use of [program wrappers](https://gu=
ix.gnu.org/manual/en/html_node/Build-Utilities.html#Wrappers)
when define packages.  In particular,  both `glib-or-gtk-build-system`
and `qt-build-system` includes a wrap phase to make program wrappers for ev=
ery
GNOME and KDE program.

Those wrappers have some unsolved issues:

- [Program crash due to leaked environment variables](https://issues.guix.g=
nu.org/63203)
- [Duplicate entries in various environment variables](https://issues.guix.=
gnu.org/23118)
- [Ansible & others' problems with wrapped '.ansible-real' scripts](https:/=
/issues.guix.gnu.org/26752)

If we managed to find a way to set search paths without using program
wappers, then programs will be more robust.


# Detailed Design

In addition to environment variables, some programs also allow to set search
paths via configuration files, for example you can use
[path configuration files](https://docs.python.org/3/library/site.html)
to set `sys.path` for Python, and we have a per-output [`ld.so.cache`](http=
s://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/)
to load shared libraries efficiently.  Inspired by them, we are going to pa=
tch
some programs and libraries, so that when they build a search path from an
environment variable, would also honor a per-output search path configurati=
on
file.  The details are how to make those search path configuration files and
how to find them when an executable is running.

## Search path configuration files

We'll create search path configuration files under the `etc/search-path.d`
directory of each package output, with each file specify a search path.
The file name and its content are same to the corresponding environment
variable.  For example the output of the `gnome-console` package would have:

```
bin
  kgx
etc
  ld.so.cache
  search-paths.d
    GUIX_XDG_DATA_DIRS
    GUIX_GIO_EXTRA_MODULES
    GUIX_GTK4_PATH
lib
share
```

The content of its `GUIX_XDG_DATA_DIRS` file would be:
```
/gnu/store/...-shared-mime-info-2.3/share:/gnu/store/...-glib-2.78.0/share:=
/gnu/store/...-gsettings-desktop-schemas-44.0/share:/gnu/store/...-libadwai=
ta-1.5.2/share:/gnu/store/...-gtk-4.14.5/share:/gnu/store/...-gnome-console=
-44.4/share
```

Those search path configuration files would be created by the package build=
er,
after the `install` phase, replace usages of `wrap-program` when possible.


## Find the location of the current executable

To find its search path configuration files when an executable is running,
we can first find the location of the executable.  Conveniently, Linux
provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
well for ELF executables.   But for an interpreter script, `/proc/self/exe`
would return the file name of its interpreter instead of the script, so
we patch interpreters to set 2 environment variables:

  - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
  - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script

And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternativel=
y,
we can try to construct the script file name from command line arguments, b=
ut
that won't work when you run a script using a relative file name and its
current working directory changed before we figure out the script file name.


## Set search paths with configuration files from search-paths.d

Finally, when the program want to build a search path from an
environment variable, we patch the code to search its `search-paths.d`
first, the result search path value will include both the content of
the search path configuration file and the environment variable.  This
usually happens in C/C++ libraries like GLib, GTK and Qt with a
`getenv` call, we need patch these `getenv` calls for each search path
we care.


## Implementation plan

A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.

- Add a new function `g_guix_build_search_path_dirs` to GLib, which returns=
 a
  search path as a list of file or directory names from a search path
  configuration file and an environment variable.
- Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS=
`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
  `GUIX_GSETTINGS_SCHEMA_DIR`.
- Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
- Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS`,
  `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
  `GUIX_QML2_IMPORT_PATH`.
- Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
- Modify `qt-build-system` to get rid of `wrap-program`.


# The Cost Of Reverting

We can revert to program wrappers by manually adding wrap phases on a case =
by
case basic, if needed.


# Drawbacks or Open Questions

If implemented, we would likely carry several custom patches for GLib,
GTK, Qt, Python, etc. forever.


This proposal focuses solving problems caused by program wrappers in desktop
environments, namely GNOME and KDE.  Individual `wrap-progam` usages are not
addressed.  We plan to handle that in build systems later, for example:

  - Handle `GUIX_GI_TYPELIB_PATH` and `GUIX_GDK_PIXBUF_MODULE_FILES` in
    `glib-or-gtk-build-system` without wrappers.
  - Handle `GUIX_PYTHONPATH` in `python-build-system` without wrappers.


There are still ABI problems caused by environment variables from
profiles, which may be addressed later as suggested by Maxime Devos in
<https://issues.guix.gnu.org/63203#5>.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: Janneke Nieuwenhuizen <janneke@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 23 Mar 2025 11:07:02 +0000
Resent-Message-ID: <handler.76428.B76428.17427279663260 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17427279663260
          (code B ref 76428); Sun, 23 Mar 2025 11:07:02 +0000
Received: (at 76428) by debbugs.gnu.org; 23 Mar 2025 11:06:06 +0000
Received: from localhost ([127.0.0.1]:47951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twJ9X-0000q9-F0
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 07:06:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60168)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <janneke@HIDDEN>) id 1twJ9U-0000oe-2S
 for 76428 <at> debbugs.gnu.org; Sun, 23 Mar 2025 07:06:01 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <janneke@HIDDEN>)
 id 1twJ9N-0001oJ-6i; Sun, 23 Mar 2025 07:05:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=z8zdzPseCCgWeWJg6LzVZ/+hcl+EUvX57VbkGCaWc6A=; b=FLMD+UnzMgc8tUtPuYFo
 zFFE2Lzl0yIq3ABlG2j5i9DJrmmEj98GgcVGO3AtQfZA9bYNFOgfsGaLeSX7FWjiv3JMfbCVqsYxU
 wTCekzUjuVmE1G3h7TM1TM0PEPH4To1a+a3f+l5LQkQKvBypP1Jykjk1H6RkF4nss/zzhgcKXiU/o
 XX/Rjm5/JeFZu0LbTGtwHigVVXwnYQeepy4HedvAM68aakNKxbOnc2PYpHN5gb1swFi9oJ5yK7rtK
 2XW7a9najWdWEStJ6knKiHXsILB74LqtjLKv1Fx+pryiFb368SuADcazYRzAuM6awC9FKAtBwIsiC
 f7jroGeSuIIiDA==;
From: Janneke Nieuwenhuizen <janneke@HIDDEN>
In-Reply-To: <87a59hdskx.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?="'s
 message of "Wed, 19 Mar 2025 22:05:02 +0800")
Organization: AvatarAcademy.nl
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
X-Url: http://AvatarAcademy.nl
Date: Sun, 23 Mar 2025 12:05:46 +0100
Message-ID: <874izk6m7p.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: -2.3 (--)
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: -3.3 (---)


Hello,

> # Detailed Design

[..]

> ## Find the location of the current executable
>
> To find its search path configuration files when an executable is running,
> we can first find the location of the executable.  Conveniently, Linux
> provides a pseudo-file `/proc/self/exe` for this exact purpose, which wor=
ks
> well for ELF executables.   But for an interpreter script, `/proc/self/ex=
e`
> would return the file name of its interpreter instead of the script, so
> we patch interpreters to set 2 environment variables:
>
>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
>
> And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE=
`,
> we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternativ=
ely,
> we can try to construct the script file name from command line arguments,=
 but
> that won't work when you run a script using a relative file name and its
> current working directory changed before we figure out the script file na=
me.

Would this work with `guix pack' tarball archives, esp. think
cross-built `guix pack' archives for MinGW?

Greetings,
Janneke

--=20
Janneke Nieuwenhuizen <janneke@HIDDEN>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar=C2=AE https://AvatarAcade=
my.com




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Tue, 25 Mar 2025 12:29:02 +0000
Resent-Message-ID: <handler.76428.B76428.1742905705745 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Janneke Nieuwenhuizen <janneke@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.1742905705745
          (code B ref 76428); Tue, 25 Mar 2025 12:29:02 +0000
Received: (at 76428) by debbugs.gnu.org; 25 Mar 2025 12:28:25 +0000
Received: from localhost ([127.0.0.1]:36730 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tx3OK-0000Bv-OW
	for submit <at> debbugs.gnu.org; Tue, 25 Mar 2025 08:28:25 -0400
Received: from mail.envs.net ([5.199.136.28]:60410)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1tx3O9-0000BT-4E
 for 76428 <at> debbugs.gnu.org; Tue, 25 Mar 2025 08:28:14 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 6EDF838A4012;
 Tue, 25 Mar 2025 12:28:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1742905690; bh=zLWduE4+E8yaWG45BqCVXWvEf1dUfpprZ+RXephDn0s=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=S9Wq2RllyMNaQx43kcZdwUal/gFsRTO1nC/j31XLfRTpp64ySYlSudXXDONghTp/U
 kFhpu6CBv8Xx7RIzY2+2cIcnF0+rEHRFe4pvnQk7+gtaYLk9ZBRt55ZIcSmVABijQv
 Ku39ocOaIVEhWZbTYZ0v5GSmrvXh71gRi1nBH/CaDcCcllw+/+Dq4hynIErpiCBfRy
 OMMVIBWt4zJQzG2TJcb3lsHJdNcqc+twj+//2x+KUYx6XjKXjLlNPr6vvK6lIYY9jO
 lEItrNRzoxVTt9oOfiyPvP6mFGfAZ7vU5+kx8YcYgBeP359oWFrYg5rjGeQyRpYdkK
 ZqL6E8ls7f7uAf05MFtyhj8NEhDSMalmw+ivP/BPLFqawF0YeewD292/LaLzOBn/CK
 gKvCH0rNT3IA9HoS0Byb4FnfpYS1nNtkG99BiB7Hns5zxC2ik/gwiyhXrv0CIfHpt0
 PFW67CQAIPWv4wRbRyAxf6jM8g+/EjKS7sq9vCJCA5HViWSntB8qcU5kxPbU/QvH3A
 zGXy/MnA7xxpiDlC01TtSnweaaQNNtjSWuHVOHNsrNMo46E9qyRv54uNv7/IIxHcnt
 CLe2R7ltT7VOYK4sbay1KN5tCg9JTm07FzGyfVxiED3OYAxGJEbbGuGxU97Qj6BVT9
 01EW8J1EJcrjjOwK1eLS9S3Q=
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 axdJh862kvWi; Tue, 25 Mar 2025 12:28:05 +0000 (UTC)
Received: from localhost (unknown [112.44.105.62])
 (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, 25 Mar 2025 12:28:05 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id 061f627d;
 Tue, 25 Mar 2025 12:32:23 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <874izk6m7p.fsf@HIDDEN> (Janneke Nieuwenhuizen's message of
 "Sun, 23 Mar 2025 12:05:46 +0100")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
 <874izk6m7p.fsf@HIDDEN>
Date: Tue, 25 Mar 2025 20:32:23 +0800
Message-ID: <87bjtpjnoo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
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 (-)

Janneke Nieuwenhuizen <janneke@HIDDEN> writes:

> [...]
>> And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
>> we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternatively,
>> we can try to construct the script file name from command line arguments, but
>> that won't work when you run a script using a relative file name and its
>> current working directory changed before we figure out the script file name.
>
> Would this work with `guix pack' tarball archives, esp. think
> cross-built `guix pack' archives for MinGW?

I think this should work for `guix pack' when the target is a linux
system, MingGW won't work with '/proc/self/exe', but maybe we can find
something similiar.

I'll keep this in mind and do some tests later, thanks!




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 30 Mar 2025 21:26:02 +0000
Resent-Message-ID: <handler.76428.B76428.174336996021348 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174336996021348
          (code B ref 76428); Sun, 30 Mar 2025 21:26:02 +0000
Received: (at 76428) by debbugs.gnu.org; 30 Mar 2025 21:26:00 +0000
Received: from localhost ([127.0.0.1]:38276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tz0AJ-0005YA-OH
	for submit <at> debbugs.gnu.org; Sun, 30 Mar 2025 17:26:00 -0400
Received: from hera.aquilenet.fr ([185.233.100.1]:54592)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tz0AH-0005Xd-FT
 for 76428 <at> debbugs.gnu.org; Sun, 30 Mar 2025 17:25:58 -0400
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 69BBF2F8;
 Sun, 30 Mar 2025 23:25:50 +0200 (CEST)
Authentication-Results: hera.aquilenet.fr;
	none
X-Virus-Scanned: Debian amavis at hera.aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP
 id 0bYde4_5RPEZ; Sun, 30 Mar 2025 23:25:49 +0200 (CEST)
Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 3626B1B6;
 Sun, 30 Mar 2025 23:25:48 +0200 (CEST)
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <87a59hdskx.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?="'s
 message of "Wed, 19 Mar 2025 22:05:02 +0800")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
Date: Sun, 30 Mar 2025 23:25:47 +0200
Message-ID: <87h63acisk.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-Rspamd-Queue-Id: 69BBF2F8
X-Spamd-Result: default: False [4.90 / 15.00]; SPAM_FLAG(5.00)[];
 BAYES_HAM(-3.00)[100.00%]; NEURAL_SPAM(3.00)[1.000];
 MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+];
 RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[];
 ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];
 TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];
 RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[];
 RCPT_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROM(0.00)[]
X-Spam-Level: ****
X-Rspamd-Action: no action
X-Spamd-Bar: ++++
X-Rspamd-Server: hera
X-Spam-Score: 1.0 (+)
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.0 (/)

Hi =E5=AE=8B=E6=96=87=E6=AD=A6,

First of all, apologies for not really contributing to the discussion
before.

My sentiment could be summarized as: I agree with the rationale, I like
the idea of storing search path metadata in package outputs, but I=E2=80=99m
concerned about the maintainability and viability of some aspects of the
proposal (see below).  I=E2=80=99ll send my deliberation in a separate mess=
age.

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

>   ld.so.cache
>   search-paths.d
>     GUIX_XDG_DATA_DIRS
>     GUIX_GIO_EXTRA_MODULES
>     GUIX_GTK4_PATH

I don=E2=80=99t think the =E2=80=9CGUIX_=E2=80=9D prefix is really justifie=
d in the proposal.

There=E2=80=99s a precedent, =E2=80=98GUIX_PYTHONPATH=E2=80=99, but I think=
 it does not follow
that this can be generalized to every search path environment variable.

For example, the XDG_ variables are honored by a lot of software, not
just GLib- or Qt-based software, and it=E2=80=99s unrealistic to patch them=
 all.
It=E2=80=99s also undesirable: generally speaking, we want to stay as close=
 to
upstream as possible so that documentation, tutorials, and scripts found
elsewhere also work on Guix.

> ## Find the location of the current executable
>
> To find its search path configuration files when an executable is running,
> we can first find the location of the executable.  Conveniently, Linux
> provides a pseudo-file `/proc/self/exe` for this exact purpose, which wor=
ks
> well for ELF executables.   But for an interpreter script, `/proc/self/ex=
e`
> would return the file name of its interpreter instead of the script, so
> we patch interpreters to set 2 environment variables:
>
>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script

We won=E2=80=99t patch every interpreter out there, that=E2=80=99s not reas=
onable.

These two variables could also have unexpected consequences since an
attacker could override them to cause confusion.

> ## Implementation plan
>
> A WIP implementation can be found in <https://issues.guix.gnu.org/75688>.
>
> - Add a new function `g_guix_build_search_path_dirs` to GLib, which retur=
ns a
>   search path as a list of file or directory names from a search path
>   configuration file and an environment variable.
> - Patch GLib to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DI=
RS`,
>   `GUIX_XDG_CONFIG_DIRS`, `GUIX_GIO_EXTRA_MODULES` and
>   `GUIX_GSETTINGS_SCHEMA_DIR`.
> - Patch Python to set `GUIX_INTERPRETER_FILE` and `GUIX_MAIN_SCRIPT_FILE`.
> - Patch Qt to use `g_guix_build_search_path_dirs` for `GUIX_XDG_DATA_DIRS=
`,
>   `GUIX_XDG_CONFIG_DIRS`, `GUIX_QT_PLUGIN_PATH`, `GUIX_QML_IMPORT_PATH`,
>   `GUIX_QML2_IMPORT_PATH`.
> - Modify `glib-or-gtk-build-system` to get rid of `wrap-program`.
> - Modify `qt-build-system` to get rid of `wrap-program`.

I=E2=80=99m concerned about the cost of maintaining these patches.  Again, =
the
ld.so patch (for glibc) sets a precedent, but this part of glibc changes
relatively rarely, and it=E2=80=99s just one patch; what if we have to main=
tain
ten such patches in big and changing libraries like GLib and Qt?

Overall, I think I=E2=80=99d be reassured if we reduced the scope a little =
bit:
don=E2=80=99t insist on the =E2=80=9CGUIX_=E2=80=9D prefix, focus on GTK an=
d Qt applications.

Thanks,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: Rutherther <rutherther@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Mon, 31 Mar 2025 16:44:03 +0000
Resent-Message-ID: <handler.76428.B76428.174343938211486 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174343938211486
          (code B ref 76428); Mon, 31 Mar 2025 16:44:03 +0000
Received: (at 76428) by debbugs.gnu.org; 31 Mar 2025 16:43:02 +0000
Received: from localhost ([127.0.0.1]:42629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tzIE1-0002yv-0a
	for submit <at> debbugs.gnu.org; Mon, 31 Mar 2025 12:43:02 -0400
Received: from ditigal.xyz ([2a01:4f8:1c1b:6a1c::]:47242 helo=mail.ditigal.xyz)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rutherther@HIDDEN>)
 id 1tzIDy-0002xh-Dx
 for 76428 <at> debbugs.gnu.org; Mon, 31 Mar 2025 12:42:59 -0400
Received: by cerebrum (OpenSMTPD) with ESMTPSA id e093737a
 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); 
 Mon, 31 Mar 2025 16:42:51 +0000 (UTC)
From: Rutherther <rutherther@HIDDEN>
In-Reply-To: <87a59hdskx.fsf@HIDDEN>
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
Date: Mon, 31 Mar 2025 18:42:49 +0200
Message-ID: <87tt791792.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ditigal.xyz;
 i=@ditigal.xyz; q=dns/txt; s=20240917; t=1743439371; h=from : to : cc
 : subject : in-reply-to : references : date : message-id :
 mime-version : content-type : from;
 bh=rKbvAHWlys/FuhlAoRQCeo3wUn/1nuTr0Rmv8xG/SUc=;
 b=HjT6CxErM9PIseW3pkfwn3jg+mMAZwAfkJlUPCOf2U1SrOGfr3m0WBPQ9I6uCweqGNaQ7
 9JYTS5jgUslEDWJn3DQWBH5sTvA3S9cOcs2jVNincA23O6BDsIcOnuFfMNFS1ywwaOwfSWg
 xlSSydzcGSA9DFiBD2ilu3L2hHfTOS0=
X-Spam-Score: 0.5 (/)
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.5 (/)


Hi,

I am missing any mention about the current etc/profile file inside of built
Guix profiles. Is it planned to also change the function of the search
paths in profiles?

Because for example currently it can happen that GIO_EXTRA_MODULES will
get set, because dconf is propagated into the profile, and this can
break, even on Guix system, the expected so files used. The home profile
packages can pick up the system so files and when the home profile
hasn't been rebuilt yet, you get crashing programs.
I think this means the env var needs to get effectively replaced
instead, or not set at all by the profile's etc/profile file.
This seems to be quite 'common' (after there start to be ABI
incompatibilities, it's common for users to go asking in the irc channel
about this) when libdconfsettings.so ends up in one of the search path folders.

1. After this change, are packages still going to respect the env var as
well, or will the ones patched and having etc/search-path.d just ignore them
completely? (replace v prepend)
And if they won't ignore them, how is this incompatibility
outlined higher going to be fixed, if anyhow?

1(b). What if user combines the profiles? For example, I will install
python and python-numpy to system profile, then python and
python-matplotlib to user profile. When I start python, which search
path is actually used? Currently both are as the env var is just merged,
but it doesn't seem to be possible to me with etc/search-paths.d (at
least unless the various search-paths.d folders are going to be in an
env var, but I think that would go against the motivation that env vars
shouldn't be 'leaking'. Although they wouldn't be leaking to childs
exactly, they would still be leaking from the profiles sourced.)

2. Is something going to happen to the search-paths / native-search-paths
functionality of the package records in regards to guix profiles? (in
other words will the generation of etc/profile file in guix profiles be
afected) And if so, how exactly? I can't seem to comprehend
it being removed completely as some build systems just won't have the
patches, at least yet, on the other hand how would it be distinguished
which ones should end up in the profile exports and which ones should
just end up in the search-paths.d files?

Apologies if I've just missed answers to these questions in the GCD
text or discussion.

Regards,
Rutherther




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD deliberation] Set search paths without program wrappers
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 05 Apr 2025 00:46:02 +0000
Resent-Message-ID: <handler.76428.B76428.174381393318232 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Rutherther <rutherther@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174381393318232
          (code B ref 76428); Sat, 05 Apr 2025 00:46:02 +0000
Received: (at 76428) by debbugs.gnu.org; 5 Apr 2025 00:45:33 +0000
Received: from localhost ([127.0.0.1]:40641 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u0rfB-0004k0-8e
	for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 20:45:33 -0400
Received: from mail.envs.net ([5.199.136.28]:58070)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1u0rf6-0004jn-Nh
 for 76428 <at> debbugs.gnu.org; Fri, 04 Apr 2025 20:45:30 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 2B7FD38A405D;
 Sat,  5 Apr 2025 00:45:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1743813926; bh=TeezY4gnWi9lz8Y826MEgwBb5il4Lvd0574crKVcbFs=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=n1B2gIBmiH1O8RXqCfiJN0OAkaUzImuIIF0x2Mhv2pL2BFgMvCAUbsolD0axjtV1R
 wVKWWC1aZZhMz4H35RiLXpYrcaOVIzbZZXeFXwzYugSwEKSK3jf5qors6BNvklBdHP
 zWuQgp6ylAn7yTlWRjQIwr4ksPceWZ12j17DSaPd1cEbIJHUfhyRNwdbRkraQZk9/V
 NkRP+o6sdPqPxcrWfFwRO9jsQR4fcINaQh0tnKqD0liM7NLAp+nxOu7uX/9xB2D7cU
 cODv2YBOToDWIeUSUn8QjjDSzX8t/+bJ3HgB2LKBN88/NhKRPJSoKhBQG6gYaiwzvc
 dn149ZIaJxTEke2xQtK5Q9cOPeNlcaePoFLe0/GIh1bGL1JyW1VfwPmYuvB7zmmKyI
 95f2N2A5qMvyo9w5UPDTID4DgJDhDTHn3aq9lVAj0jy7F3mqJgeBOgdcO+FC15+37/
 v/7LJalPRTqO7j/jvOyx2Dy52JyXiH4p8scoBgyACAu8mGLHPRlHb+hWxvj0CmDqUU
 li9cjNf6B+q9eRWydVv6XX9f9mBB0UqS8wxsCbQ7QsbUlQJcRfIGwwCfzSOlDXnp/j
 5XHp2MwmvavLBZrru8unL+9kBvwqrJAwZlrmB5Iwi61qQNkBUDRMGyvhfvvhIW0q0h
 h9dsKO8jFpL9dBzZHm1m3CUA=
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 uzKOSEFWl7hj; Sat,  5 Apr 2025 00:45:21 +0000 (UTC)
Received: from localhost (unknown [112.44.105.84])
 (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;
 Sat,  5 Apr 2025 00:45:19 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id a23cc324;
 Sat, 5 Apr 2025 00:49:57 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87tt791792.fsf@HIDDEN> (rutherther@HIDDEN's message of
 "Mon, 31 Mar 2025 18:42:49 +0200")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
 <87tt791792.fsf@HIDDEN>
Date: Sat, 05 Apr 2025 08:49:57 +0800
Message-ID: <87h6334ekq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
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 (-)

Rutherther <rutherther@HIDDEN> writes:

> Hi,
>
> I am missing any mention about the current etc/profile file inside of built
> Guix profiles. Is it planned to also change the function of the search
> paths in profiles?

Hi, this GCD is for program wrappers.  ABI problems caused by environment
variables from profiles may be addressed later, no actual plan yet.

>
> Because for example currently it can happen that GIO_EXTRA_MODULES will
> get set, because dconf is propagated into the profile, and this can
> break, even on Guix system, the expected so files used.

Just like GUIX_GDK_PIXBUF_MODULE_FILES #75523, I'll send a patch for
GUIX_GIO_EXTRA_MODULES later, which will avoid broke foreign systems.
For Guix system, we need more thinking...

>
> 1. After this change, are packages still going to respect the env var as
> well, or will the ones patched and having etc/search-path.d just ignore them
> completely? (replace v prepend)
> And if they won't ignore them, how is this incompatibility
> outlined higher going to be fixed, if anyhow?

They are still going to respect the env vars.  The incompatibility are
reduced due to there won't be environment variables leakage from a
process to its child.  For environment variables from profiles, we may
make them ABI-dependent as suggested by Maxime Devos in
https://issues.guix.gnu.org/63203#5, or improve the upstream to avoid
load ABI incompatible plugins.

>
> 1(b). What if user combines the profiles? For example, I will install
> python and python-numpy to system profile, then python and
> python-matplotlib to user profile. When I start python, which search
> path is actually used? Currently both are as the env var is just merged,

Yes, It's merged by 'guix package --search-paths' in ~/.bash_profile,
user can choose to not merge them by 'source' each profile's
'etc/profile'.

> but it doesn't seem to be possible to me with etc/search-paths.d (at
> least unless the various search-paths.d folders are going to be in an
> env var, but I think that would go against the motivation that env vars
> shouldn't be 'leaking'. Although they wouldn't be leaking to childs
> exactly, they would still be leaking from the profiles sourced.)

Program wrappers (which 'etc/search-paths.d' going to replace) and
profile level search paths are actually for different use cases, for
the former 'leaking' are side effects we don't want, and for
the later set the environment variables is actually we want.

Wrappers are used for necessary dependencies like GSetting schemes,
SVG plugin, etc, without them applications won't start or unuseable.
Profile level search paths (ideally) are for optional things like theme,
nice to have extra features.

> 2. Is something going to happen to the search-paths / native-search-paths
> functionality of the package records in regards to guix profiles? (in
> other words will the generation of etc/profile file in guix profiles be
> afected) And if so, how exactly? I can't seem to comprehend
> it being removed completely as some build systems just won't have the
> patches, at least yet, on the other hand how would it be distinguished
> which ones should end up in the profile exports and which ones should
> just end up in the search-paths.d files?

Not yet anything for search-paths functionality to guix profiles.  As I
wrote earlier, search-paths.d are to replace program wrappers.  The
general rule for program wrappers applied, I think that's if it's a
necessary or nice to have dependeny (gsettings schema, TLS for browsers,
SVG for image viewers), and it can be handled by program wrappers
without introduce dependencies cycle, then we'll use program wrappers or
search-paths.d, otherwise we have to use search-paths from profiles.


Hope it's more clear now, thank you!




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 05 Apr 2025 02:31:02 +0000
Resent-Message-ID: <handler.76428.B76428.17438202364829 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17438202364829
          (code B ref 76428); Sat, 05 Apr 2025 02:31:02 +0000
Received: (at 76428) by debbugs.gnu.org; 5 Apr 2025 02:30:36 +0000
Received: from localhost ([127.0.0.1]:40841 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u0tIp-0001Fl-CW
	for submit <at> debbugs.gnu.org; Fri, 04 Apr 2025 22:30:36 -0400
Received: from mail.envs.net ([5.199.136.28]:34462)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <iyzsong@HIDDEN>) id 1u0tIl-0001Fa-Bg
 for 76428 <at> debbugs.gnu.org; Fri, 04 Apr 2025 22:30:33 -0400
Received: from localhost (mail.envs.net [127.0.0.1])
 by mail.envs.net (Postfix) with ESMTP id 86B7F38A405D;
 Sat,  5 Apr 2025 02:30:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa;
 t=1743820228; bh=8RQAELxlIXiuYRoxB9lN/sSqUiNnX3X9QJgH0n678yQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=UXcwdvtt82F9yPV5Bf/PayyWuTK2w3OjUxy+4T1uOtgl16mlfbEHpJVxH2rjNVwtD
 wUxE9kCHmWxpCT5029WCjjjEwxQmQuRTa0zFT5xHqcr3+1NgGs7P66tft0a7FbbhQg
 ugCyZJ/+mPKxg807UxMZpIcHV3193HbH09Aubo8BfGOWsPLKZSy2WEF+PIGNUAXenz
 lGiKsg02/F/qmKIL+K/V9Z53LVnpLAf2IMVIBqKmKJqoVBKRaWlcYXdg346kMByAyh
 zlnY+CopVsaeW3+B1T6PqIxpZnOg+1v41gmvqKea4mD4rAuBv/u1kuB+eNnBBVxoGH
 NC94rzCyEHGi1jIlJXUevd58tm8ohCsEtrhX3g/olQ5Gmpdpbz9+IQasXa/G5uPlZP
 c+zwl9PXWXYA9CJaTErzlq2CC/eCzH4efklqpUYdiu7JGZq2yP45pZWNHEjJj1ivZ9
 YHhWL7unrMmwaB09L10KMP09uzYErEtJ8d8W1qr5vic5Y+e7j52D+XvQswd3qwkBo4
 o9HOaxeZ9f/b3pt24SRSJNSoECw6qo7CFHBD6o2JGBTgh7xzHlby4d9t9Il8f9O6Ye
 LFJwABH6ONmqEbph7HAarlxcvS7Fx9ieUOqokuu+d6g9Q7cAOAZxcVlRGLCu7o/Xog
 VCCArZSZL6grgRBybYh9HMQk=
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 QwdTnFeA8-n9; Sat,  5 Apr 2025 02:30:23 +0000 (UTC)
Received: from localhost (unknown [112.44.105.84])
 (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;
 Sat,  5 Apr 2025 02:30:23 +0000 (UTC)
Received: from localhost (localhost [local])
 by localhost (OpenSMTPD) with ESMTPA id ae395f3e;
 Sat, 5 Apr 2025 02:34:59 +0000 (UTC)
From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
In-Reply-To: <87h63acisk.fsf_-_@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sun, 30 Mar 2025 23:25:47 +0200")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
 <87h63acisk.fsf_-_@HIDDEN>
Date: Sat, 05 Apr 2025 10:34:59 +0800
Message-ID: <87wmbz2v58.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-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 (-)

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> skribis:
>
>>   ld.so.cache
>>   search-paths.d
>>     GUIX_XDG_DATA_DIRS
>>     GUIX_GIO_EXTRA_MODULES
>>     GUIX_GTK4_PATH
>
> I don=E2=80=99t think the =E2=80=9CGUIX_=E2=80=9D prefix is really justif=
ied in the proposal.

Sure.  There are 2 reasons, one is to avoid broke foreign systems (
GUIX_GIO_EXTRA_MODULES, GUIX_GTK4_PATH), another is about priority
(GUIX_XDG_*) I'll explain later.

>
> There=E2=80=99s a precedent, =E2=80=98GUIX_PYTHONPATH=E2=80=99, but I thi=
nk it does not follow
> that this can be generalized to every search path environment variable.
>
> For example, the XDG_ variables are honored by a lot of software, not
> just GLib- or Qt-based software, and it=E2=80=99s unrealistic to patch th=
em all.
> It=E2=80=99s also undesirable: generally speaking, we want to stay as clo=
se to
> upstream as possible so that documentation, tutorials, and scripts found
> elsewhere also work on Guix.

Yes, we introduced GUIX_PYTHONPATH, GUIX_GTK* to avoid ABI
incompatibility problems between different programs from foreign systems
and Guix systems.  But XDG_DATA_DIRS, as it's designed for shareable
data files, won't have ABI incompatibility problems, and we rely on it
for a foreign desktop launch to find applications (via desktop files),
fonts installed from Guix.

So do we need 'GUIX_XDG_*'?  Well, In 'wrap-program' we can specifiy how
the wrapped environment variables are going to be combined with the
system level variables in 3 positions: prefix, suffix or =3D (exact).  The
priority between wrapped and system level variables influence the
robustness of programs.

For plugins which might have ABI problems, we'll use 'prefix', so a
wrapped program always load the correct ones (eg: qtbase) first, and
hopefully they can ignore the possible incompatible ones (eg: a qt
theme plugin) with reduced functions but still works.

Or for not real search paths which only support a single directory or
file, we'll use '=3D' (eg: SSL_CERT_FILE).

But for XDG_DATA_DIRS and XDG_CONFIG_DIRS, we'll want to use 'suffix',
so that the shared combined data (icons, mime databases) will be used
instead of a seperated incomplete ones.  Also it allow user to customize
them as usually, or 'guix home' or 'guix system' to custom them at
profile level.

In the specified search-paths.d implementation, for simplify reason, the
envs from search-paths.d files are always used in 'prefix' way.  For '=3D'
cases, we could patch it to a real search path (eg:
GUIX_GDK_PIXBUF_MODULE_FILES), or hardcode it (eg:
QTWEBENGINEPROCESS_PATH #75966).  For 'suffix' cases, it uses 2
variables, that's prefer XDG_DATA_DIRS (set by profile or foreign
system) over GUIX_XDG_DATA_DIRS (set by search-paths.d, not leaking).

>
>> ## Find the location of the current executable
>>
>> To find its search path configuration files when an executable is runnin=
g,
>> we can first find the location of the executable.  Conveniently, Linux
>> provides a pseudo-file `/proc/self/exe` for this exact purpose, which wo=
rks
>> well for ELF executables.   But for an interpreter script, `/proc/self/e=
xe`
>> would return the file name of its interpreter instead of the script, so
>> we patch interpreters to set 2 environment variables:
>>
>>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
>
> We won=E2=80=99t patch every interpreter out there, that=E2=80=99s not re=
asonable.

Yes, python should be the most, also we can avoid patching and still use
'wrap-program' for them.

>
> These two variables could also have unexpected consequences since an
> attacker could override them to cause confusion.

The check (current /prof/self-exe =3D=3D GUIX_INTERPRETER_FILE) done in the
client side should prevent the attack or confusion, if the interpreter
haven't changed then there should be no way to modify
GUIX_MAIN_SCRIPT_FILE set by the interpreter.


> [...]
>
> I=E2=80=99m concerned about the cost of maintaining these patches.  Again=
, the
> ld.so patch (for glibc) sets a precedent, but this part of glibc changes
> relatively rarely, and it=E2=80=99s just one patch; what if we have to ma=
intain
> ten such patches in big and changing libraries like GLib and Qt?

I'm totally fine with reject the implementation due to maintaince
burden.  I could polish the patches later for easier review and decide
they are reasonable or not.

>
> Overall, I think I=E2=80=99d be reassured if we reduced the scope a littl=
e bit:
> don=E2=80=99t insist on the =E2=80=9CGUIX_=E2=80=9D prefix, focus on GTK =
and Qt applications.

Okay, I'll send GUIX_GIO_EXTRA_MODULES as a seperated patch later.  For
'GUIX_XDG_DATA_DIRS' and 'GUIX_XDG_CONFIG_DIRS', do you think the
current implementation plan (GUIX_ ones only used by search-paths.d,
only XDG_DATA_* still set by profile and visible, use 2 variables due to
simplify reason) fine?

Thank you!




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: Nicolas Graves <ngraves@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 10 Apr 2025 00:32:01 +0000
Resent-Message-ID: <handler.76428.B76428.174424508722071 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174424508722071
          (code B ref 76428); Thu, 10 Apr 2025 00:32:01 +0000
Received: (at 76428) by debbugs.gnu.org; 10 Apr 2025 00:31:27 +0000
Received: from localhost ([127.0.0.1]:42794 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2fpG-0005jv-Hy
	for submit <at> debbugs.gnu.org; Wed, 09 Apr 2025 20:31:26 -0400
Received: from 8.mo563.mail-out.ovh.net ([46.105.60.197]:33555)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ngraves@HIDDEN>)
 id 1u2fpC-0005jb-HM
 for 76428 <at> debbugs.gnu.org; Wed, 09 Apr 2025 20:31:24 -0400
Received: from director3.derp.mail-out.ovh.net
 (director3.derp.mail-out.ovh.net [152.228.215.222])
 by mo563.mail-out.ovh.net (Postfix) with ESMTPS id 4ZY12b3bMSz11YL;
 Thu, 10 Apr 2025 00:31:19 +0000 (UTC)
Received: from director3.derp.mail-out.ovh.net
 (director3.derp.mail-out.ovh.net. [127.0.0.1])
 by director3.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP
 for <76428 <at> debbugs.gnu.org>; Thu, 10 Apr 2025 00:31:19 +0000 (UTC)
Received: from mta7.priv.ovhmail-u1.ea.mail.ovh.net (unknown [10.109.140.66])
 by director3.derp.mail-out.ovh.net (Postfix) with ESMTPS id
 4ZY12b0yxLz82Vw; Thu, 10 Apr 2025 00:31:19 +0000 (UTC)
Received: from ngraves.fr (unknown [10.1.6.3])
 by mta7.priv.ovhmail-u1.ea.mail.ovh.net (Postfix) with ESMTPSA id 3C473C3998; 
 Thu, 10 Apr 2025 00:31:18 +0000 (UTC)
Authentication-Results: garm.ovh; auth=pass
 (GARM-112S006ef018cbf-acd2-480d-95c2-dbf0eaa665da,
 52DE3D717B93FEE639900325ECA026A840312384) smtp.auth=ngraves@HIDDEN
X-OVh-ClientIp: 176.171.151.209
From: Nicolas Graves <ngraves@HIDDEN>
In-Reply-To: <877c5djq6x.fsf@HIDDEN>
References: <20250220040827.4127-1-iyzsong@HIDDEN>
 <871pvmnez7.fsf@HIDDEN> <877c5djq6x.fsf@HIDDEN>
Date: Thu, 10 Apr 2025 02:31:16 +0200
Message-ID: <87semgn9gr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Ovh-Tracer-Id: 1249467422814102036
X-VR-SPAMSTATE: OK
X-VR-SPAMSCORE: -100
X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvtdejgeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtgfesthhqredttddtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeffudelkeejveetleeuffejfefftefhhfffuedtteethfelueelveffjedvffdtffenucfkphepuddvjedrtddrtddruddpudejiedrudejuddrudehuddrvddtleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopeegpdhrtghpthhtohepjeeigedvkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehihiiishhonhhgsegvnhhvshdrnhgvthdprhgtphhtthhopehluhguohesghhnuhdrohhrghdprhgtphhtthhopehihiiishhonhhgsehmvghmsggvrhdrfhhsfhdrohhrghdpoffvtefjohhsthepmhhoheeifegmpdhmohguvgepshhmthhpohhuth
DKIM-Signature: a=rsa-sha256; bh=gYqyenAppxkf1i4yTz28/0FV9onm7Zj5B3Co4Q/ENMk=; 
 c=relaxed/relaxed; d=ngraves.fr; h=From;
 s=ovhmo4487190-selector1; t=1744245080; v=1;
 b=jG4skI+kKY8Snzq/aow1qlVexVrPAEZvTInKYxONVytWBoKrybI5GIOiy8k+rkUTaCKNpu5f
 Z9COMBC1JVWlRIwr51qxmU9uOVMPu4CLt+/p/Pz+HmwbzecPUFQxAYfUvhXhmkS1CaXkzMtxHT/
 6/Z3idvoBaxcH4y146CReug1ylHFVF6ijfIKb+fm2LWyx02hdkiGp1bYyaPPwtUNuPcfZLYeNKo
 XoGQCrgbxQP3tiexFx1OFXeXvcOM1Lr3gHDp/w+9Z3PsQ6A7iphUkc+SPSXguH49Dt8Tlszm7R7
 qaX93ZIgrXqfHxIVy8BIROOyKcEv4v8RDajSDYv1fwvrw==
X-Spam-Score: 0.0 (/)
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 (-)

On 2025-02-26 12:16, =E5=AE=8B=E6=96=87=E6=AD=A6 via Guix-patches via wrote:

> Ludovic Court=C3=A8s <ludo@HIDDEN> writes:
>
>>> [...]
>>> +Those search path configuration files would be created by the package =
builder,
>>> +after the `install` phase, replace usages of `wrap-program` when possi=
ble.
>>
>> One thought came to mind.
>>
>> If we are going to provide that sort of metadata along side package
>> build results, what about providing a =E2=80=98package=E2=80=99 sexp sim=
ilar to those
>> found in the =E2=80=98manifest=E2=80=99 file of profiles (see =E2=80=98m=
anifest->gexp=E2=80=99), for
>> example in =E2=80=98etc/guix/package=E2=80=99?
>
> Okay, I guess that can be done in gnu-build-system.
>
>>
>> The sexp could provide info such as: the package name and version, its
>> search paths, maybe its propagated inputs.

Just realised how great this can be.  It would be good for at least
Python to manage propagated-inputs this way, if doable!  If
search-paths.d already has all info about GUIX_PYTHONPATH, then we
probably won't need to install packages in the profile at all, we'll
just have to ensure that GUIX_PYTHONPATH is built as the concatenation
of profile's search-paths.d.

--=20
Best regards,
Nicolas Graves




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludovic.courtes@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 10 Apr 2025 08:27:01 +0000
Resent-Message-ID: <handler.76428.B76428.17442736075497 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17442736075497
          (code B ref 76428); Thu, 10 Apr 2025 08:27:01 +0000
Received: (at 76428) by debbugs.gnu.org; 10 Apr 2025 08:26:47 +0000
Received: from localhost ([127.0.0.1]:43711 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2nFG-0001QY-Km
	for submit <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:26:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43584)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1u2nF7-0001Om-87
 for 76428 <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:26:37 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludovic.courtes@HIDDEN>)
 id 1u2nEz-0001yr-UX; Thu, 10 Apr 2025 04:26:30 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludovic.courtes@HIDDEN>
In-Reply-To: <87wmbz2v58.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?="'s
 message of "Sat, 05 Apr 2025 10:34:59 +0800")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
 <87h63acisk.fsf_-_@HIDDEN> <87wmbz2v58.fsf@HIDDEN>
Date: Thu, 10 Apr 2025 10:15:19 +0200
Message-ID: <87frigv3e0.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: -2.3 (--)
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: -3.3 (---)

Hello,

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

> Yes, we introduced GUIX_PYTHONPATH, GUIX_GTK* to avoid ABI
> incompatibility problems between different programs from foreign systems
> and Guix systems.  But XDG_DATA_DIRS, as it's designed for shareable
> data files, won't have ABI incompatibility problems, and we rely on it
> for a foreign desktop launch to find applications (via desktop files),
> fonts installed from Guix.

(I hadn=E2=80=99t realized GUIX_GTK* and GUIX_GDK* already exist=E2=80=A6)

> So do we need 'GUIX_XDG_*'?  Well, In 'wrap-program' we can specifiy how
> the wrapped environment variables are going to be combined with the
> system level variables in 3 positions: prefix, suffix or =3D (exact).  The
> priority between wrapped and system level variables influence the
> robustness of programs.
>
> For plugins which might have ABI problems, we'll use 'prefix', so a
> wrapped program always load the correct ones (eg: qtbase) first, and
> hopefully they can ignore the possible incompatible ones (eg: a qt
> theme plugin) with reduced functions but still works.
>
> Or for not real search paths which only support a single directory or
> file, we'll use '=3D' (eg: SSL_CERT_FILE).
>
> But for XDG_DATA_DIRS and XDG_CONFIG_DIRS, we'll want to use 'suffix',
> so that the shared combined data (icons, mime databases) will be used
> instead of a seperated incomplete ones.  Also it allow user to customize
> them as usually, or 'guix home' or 'guix system' to custom them at
> profile level.

I understand this, but I=E2=80=99m not sure how it releases to GUIX_-prefix=
ing
more variables.

> In the specified search-paths.d implementation, for simplify reason, the
> envs from search-paths.d files are always used in 'prefix' way.  For '=3D'
> cases, we could patch it to a real search path (eg:
> GUIX_GDK_PIXBUF_MODULE_FILES), or hardcode it (eg:
> QTWEBENGINEPROCESS_PATH #75966).  For 'suffix' cases, it uses 2
> variables, that's prefer XDG_DATA_DIRS (set by profile or foreign
> system) over GUIX_XDG_DATA_DIRS (set by search-paths.d, not leaking).

Uh.  Having GUIX_XDG_DATA_DIRS at all sounds like a problem to me.

>>>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>>>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
>>
>> We won=E2=80=99t patch every interpreter out there, that=E2=80=99s not r=
easonable.
>
> Yes, python should be the most, also we can avoid patching and still use
> 'wrap-program' for them.

Hmm OK.

>> Overall, I think I=E2=80=99d be reassured if we reduced the scope a litt=
le bit:
>> don=E2=80=99t insist on the =E2=80=9CGUIX_=E2=80=9D prefix, focus on GTK=
 and Qt applications.
>
> Okay, I'll send GUIX_GIO_EXTRA_MODULES as a seperated patch later.  For
> 'GUIX_XDG_DATA_DIRS' and 'GUIX_XDG_CONFIG_DIRS', do you think the
> current implementation plan (GUIX_ ones only used by search-paths.d,
> only XDG_DATA_* still set by profile and visible, use 2 variables due to
> simplify reason) fine?

I=E2=80=99m not sure I fully understand what =E2=80=9Conly used by search-p=
aths.d=E2=80=9D
means; I would prefer not introducing any GUIX_-prefixed variable as
part of this work.  Adding these variables could be discussed
separately.

Thanks for explaining!

Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] GCD 004 deliberation
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 10 Apr 2025 08:27:02 +0000
Resent-Message-ID: <handler.76428.B76428.17442736075504 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.17442736075504
          (code B ref 76428); Thu, 10 Apr 2025 08:27:02 +0000
Received: (at 76428) by debbugs.gnu.org; 10 Apr 2025 08:26:47 +0000
Received: from localhost ([127.0.0.1]:43713 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2nFH-0001Qc-7N
	for submit <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:26:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43594)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1u2nFA-0001P8-MI
 for 76428 <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:26:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1u2nF5-00022E-5h; Thu, 10 Apr 2025 04:26:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=5mwQfJVCumTjVfbFi0UM1zIqmBHXgPzutd/2kRH66DQ=; b=d8qYmeAO8KXArdTZn+yl
 U/LZbDGBkNDm6UKNx1wRzZfmoLvVmDX6rC12P/GwRTsarWFwMEThngQXhW56zxw5bxwAiu+IV70Fc
 Y1b0u4nA9byl62XjaSSMnXQPm73YVs97W7K6FlF78g8j+WVTEVM60d4Zx6KpVdVbfQfmeRC09XPy0
 Lep0hvwrzxLY1Bhpr49Ya62VFn4qt4HneczFD8/1Gw+y3PkknsrApeRA5QzpfWDJMQDLbU2B1gYBu
 N+UmzIB8LE+uDlJO8GJ817wWOKor8XKia8WiI6cPgJ9uC0BVtC6xeDzeRxH0Hdsc1mkx73DP6cOXd
 8ZnkE5dCWTj5tA==;
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
In-Reply-To: <87a59hdskx.fsf@HIDDEN> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?="'s
 message of "Wed, 19 Mar 2025 22:05:02 +0800")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
Date: Thu, 10 Apr 2025 10:24:13 +0200
Message-ID: <87a58ov2z6.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: -2.3 (--)
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: -3.3 (---)

Hello,

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

> Hello, Below is the final version of GCD for "Set search paths without
> program wrappers", which means now this GCD start its deliberation
> period (14 days), so team members please reply to
> <76428 <at> debbugs.gnu.org> with opinions.  Thanks!

I just realized we=E2=80=99re already past the end of the deliberation.

I believe only 1 team member deliberated (Florian Pelz: support).
This is below the quorum of 25% of team members, so I believe this GCD
is withdrawn.

Could you update the =E2=80=98status=E2=80=99 and =E2=80=98date=E2=80=99 fi=
elds accordingly in the repo?

It is disappointing that the proposal did not get more attention; we=E2=80=
=99ll
have to assess to what extent this is due to the process itself.

However I would recommend reaching out to more people, perhaps stripping
it down to the essentials, and hopefully it can be resubmitted later
once there=E2=80=99s a broader understanding of the stakes and consequences.

Thanks for all the work,
Ludo=E2=80=99.




Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76428] GCD 004 deliberation
Resent-From: Z572 <zhengjunjie@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Thu, 10 Apr 2025 08:43:02 +0000
Resent-Message-ID: <handler.76428.B76428.174427456023608 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 76428
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Cc: 76428 <at> debbugs.gnu.org, guix-devel@HIDDEN, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@HIDDEN>
Received: via spool by 76428-submit <at> debbugs.gnu.org id=B76428.174427456023608
          (code B ref 76428); Thu, 10 Apr 2025 08:43:02 +0000
Received: (at 76428) by debbugs.gnu.org; 10 Apr 2025 08:42:40 +0000
Received: from localhost ([127.0.0.1]:43762 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u2nUe-00068g-AL
	for submit <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:42:40 -0400
Received: from mail.z572.online ([88.99.160.180]:47638)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <zhengjunjie@HIDDEN>)
 id 1u2nUa-000689-Ss
 for 76428 <at> debbugs.gnu.org; Thu, 10 Apr 2025 04:42:38 -0400
Received: from m (mail1.85362086.com [107.174.64.25])
 by mail.z572.online (OpenSMTPD) with ESMTPSA id bf9c3917
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Thu, 10 Apr 2025 08:48:54 +0000 (UTC)
From: Z572 <zhengjunjie@HIDDEN>
In-Reply-To: <87a58ov2z6.fsf_-_@HIDDEN> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 10 Apr 2025 10:24:13 +0200")
References: <87r03s6mtt.fsf@HIDDEN> <87a59hdskx.fsf@HIDDEN>
 <87a58ov2z6.fsf_-_@HIDDEN>
User-Agent: mu4e 1.12.9; emacs 30.0.92
Date: Thu, 10 Apr 2025 16:42:17 +0800
Message-ID: <871pu04dcm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.9 (/)
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 (/)

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

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hello,
>
> =E5=AE=8B=E6=96=87=E6=AD=A6 <iyzsong@HIDDEN> skribis:
>
>> Hello, Below is the final version of GCD for "Set search paths without
>> program wrappers", which means now this GCD start its deliberation
>> period (14 days), so team members please reply to
>> <76428 <at> debbugs.gnu.org> with opinions.  Thanks!
>
> I just realized we=E2=80=99re already past the end of the deliberation.
>
> I believe only 1 team member deliberated (Florian Pelz: support).
> This is below the quorum of 25% of team members, so I believe this GCD
> is withdrawn.
>
> Could you update the =E2=80=98status=E2=80=99 and =E2=80=98date=E2=80=99 =
fields accordingly in the repo?
>
> It is disappointing that the proposal did not get more attention; we=E2=
=80=99ll
> have to assess to what extent this is due to the process itself.

I wonder if there should be a page on guix.gnu.org showing gcd and
start/end times, otherwise many people will forget about it.

>
> However I would recommend reaching out to more people, perhaps stripping
> it down to the essentials, and hopefully it can be resubmitted later
> once there=E2=80=99s a broader understanding of the stakes and consequenc=
es.
>
> Thanks for all the work,
> Ludo=E2=80=99.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmf3hGkACgkQO1qpk+Gi
3/DM8xAAp4v2QCrdAHsBiTPUYhlLF86JwBSmEwTg8UcO9LhajRGOrYfJR5iDFiIu
2f6JPSu/8Zwx8FwHBG1lnQvxZNYjk6Hjc5sVENTMwPOL3VIZHZ88qFom/nVycXxU
JxTEte1P3dovzCVZlRXz1SuXxe7PfhOVT/CBqi7yfnZPP2tpqECqB5wdyWWGSfq+
xxcRfAXSdVjJq9zOcTrDrE41Y1N0iNg672fdZ3T/4/oId/oHX98mI6V47gfF8bDC
7fYzNYFOOmtYQfafq+XbK55a+SpM4V+ei0cszGnWNdW2QJ640YGbXIl1tscUunQN
Bvjx7mil6rd9N0TlCvcQiwvIoo7XBqrYngmJcbSXPam2SVcydweKPJzd6szIDnR7
0h2blsEOGA5l88ytF2yTj/L+EMs3j34L+nHJQ0eROAd/WmTDLljXCLtg1CFwg+lf
RMVQaIw39AY70HBqsBWtqCBimQ7kTKrf68RKpnO8FDo8uRlkO6ezCXgI1+aD+J14
ejkNw6V0SPOt6Tf20+bXZE+klOh4WVzaW8vu1UpAnxJqFxEGR0D6VTR4k43rinSx
iHmu3v/X4K8EppggsoC+lQInghfhyMJAQJRtydWybvF2QrDcTMaq5K/WjICnKStM
+XKHyeV18tEWVwWn9ZVFVrftEC5pwzTVsaXNM2l8/mrwkOOPxMc=
=AqKe
-----END PGP SIGNATURE-----
--=-=-=--





Last modified: Thu, 10 Apr 2025 08:45:02 UTC

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