GNU bug report logs - #76428
[GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.

Previous Next

Package: guix-patches;

Reported by: iyzsong <at> envs.net

Date: Thu, 20 Feb 2025 04:06:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 76428 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Thu, 20 Feb 2025 04:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to iyzsong <at> envs.net:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 20 Feb 2025 04:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: iyzsong <at> envs.net
To: guix-patches <at> gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>
Subject: [GCD PATCH] 003-set-search-paths-without-program-wrappers: Submit.
Date: Thu, 20 Feb 2025 12:08:23 +0800
From: 宋文武 <iyzsong <at> member.fsf.org>

* 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 <at> envs.net>
+sponsors: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+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





Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Thu, 20 Feb 2025 17:26:05 GMT) Full text and rfc822 format available.

Message #8 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: iyzsong <at> envs.net
Cc: 76428 <at> debbugs.gnu.org, 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: bug#76428: [GCD PATCH]
 003-set-search-paths-without-program-wrappers: Submit.
Date: Thu, 20 Feb 2025 14:24:15 +0100
Hi,

On Thu, 20 Feb 2025 at 12:08, iyzsong <at> envs.net 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 “Set search
paths without program wrappers” 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 “-only” instead. :-)

Cheers,
simon


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

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

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




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Fri, 21 Feb 2025 02:28:01 GMT) Full text and rfc822 format available.

Message #11 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: iyzsong <at> envs.net
To: 76428 <at> debbugs.gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>
Subject: [PATCH v2] 004-set-search-paths-without-program-wrappers: Submit.
Date: Fri, 21 Feb 2025 10:30:58 +0800
From: 宋文武 <iyzsong <at> member.fsf.org>

* 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 <at> envs.net>
+sponsors: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+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





Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Fri, 21 Feb 2025 02:28:02 GMT) Full text and rfc822 format available.

Message #14 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 76428 <at> debbugs.gnu.org, 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: bug#76428: [GCD PATCH]
 003-set-search-paths-without-program-wrappers: Submit.
Date: Fri, 21 Feb 2025 10:31:44 +0800
Simon Tournier <zimon.toutoune <at> gmail.com> writes:

> Hi,
>
> On Thu, 20 Feb 2025 at 12:08, iyzsong <at> envs.net 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 “Set search
> paths without program wrappers” 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 “-only” instead. :-)
>

Updated in v2, thank you!




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Fri, 21 Feb 2025 02:39:04 GMT) Full text and rfc822 format available.

Message #17 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: info-guix <at> gnu.org
Cc: 76428 <at> debbugs.gnu.org
Subject: [GCD] Set search paths without program wrappers
Date: Fri, 21 Feb 2025 10:41:50 +0800
[Message part 1 (text/plain, inline)]
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.

[004-set-search-paths-without-program-wrappers.md (text/plain, inline)]
title: Set search paths without program wrappers
id: 004
status: submitted
discussion: https://issues.guix.gnu.org/76428
authors: 宋文武 <iyzsong <at> envs.net>
sponsors: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
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://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>.

Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Fri, 21 Feb 2025 19:24:04 GMT) Full text and rfc822 format available.

Message #20 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: iyzsong <at> envs.net, 76428 <at> debbugs.gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: [bug#76428] [PATCH v2]
 004-set-search-paths-without-program-wrappers: Submit.
Date: Fri, 21 Feb 2025 18:47:06 +0100
嗨 宋文武!

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

Now, the GCD’s submitted \o/, I recommend to push the two first
revisions and then each new revision to a dedicated branch, say
’wip-set-search-paths-without-program-wrapper’ 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 ’main’.

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…
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’s 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/tree/0001-rfc-process.md?id=7da54b980efcd23ce662040b00712bd7fa76982e

(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 <at> gmail.com>
Thu, 20 Feb 2025 18:25:02 +0100
id:87frk8lea9.fsf <at> gmail.com
https://issues.guix.gnu.org/76407
https://issues.guix.gnu.org/msgid/87frk8lea9.fsf <at> gmail.com
https://yhetil.org/guix/87frk8lea9.fsf <at> gmail.com




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Sat, 22 Feb 2025 03:50:03 GMT) Full text and rfc822 format available.

Message #23 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: 宋文武 via "Development of GNU Guix and the GNU System
 distribution." <guix-devel <at> gnu.org>
Cc: 76428 <at> debbugs.gnu.org, Hartmut Goebel <h.goebel <at> crazy-compilers.com>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [GCD] Set search paths without program wrappers
Date: Sat, 22 Feb 2025 11:53:07 +0800
宋文武 via "Development of GNU Guix and the GNU System distribution."
<guix-devel <at> gnu.org> writes:

> Hartmut Goebel <h.goebel <at> crazy-compilers.com> 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=wip-set-search-paths-without-program-wrappers&id=990d1a273018a2782666089de2c9878f02cfe6e6


The lastest version of this GCD can be viewed from:

https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/plain/004-set-search-paths-without-program-wrappers.md?h=wip-set-search-paths-without-program-wrappers


Hope it helps, thanks.




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Sat, 22 Feb 2025 03:53:03 GMT) Full text and rfc822 format available.

Message #26 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 76428 <at> debbugs.gnu.org, 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: [bug#76428] [PATCH v2]
 004-set-search-paths-without-program-wrappers: Submit.
Date: Sat, 22 Feb 2025 11:56:16 +0800
Simon Tournier <zimon.toutoune <at> gmail.com> writes:

> 嗨 宋文武!
>
> More or less copy/pasting [1] what I wrote to Liliana about GCD 003.
>
> Now, the GCD’s submitted \o/, I recommend to push the two first
> revisions and then each new revision to a dedicated branch, say
> ’wip-set-search-paths-without-program-wrapper’ directly to the GCDs
> repository.

Done, thanks.


It now can be view from:

https://git.savannah.gnu.org/cgit/guix/guix-consensus-documents.git/tree/004-set-search-paths-without-program-wrappers.md?h=wip-set-search-paths-without-program-wrappers




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Tue, 25 Feb 2025 16:54:02 GMT) Full text and rfc822 format available.

Message #29 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: iyzsong <at> envs.net
Cc: 76428 <at> debbugs.gnu.org, 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: bug#76428: [GCD PATCH]
 003-set-search-paths-without-program-wrappers: Submit.
Date: Tue, 25 Feb 2025 17:53:00 +0100
Hi 宋文武,

iyzsong <at> envs.net 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/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.

One thought came to mind.

If we are going to provide that sort of metadata along side package
build results, what about providing a ‘package’ sexp similar to those
found in the ‘manifest’ file of profiles (see ‘manifest->gexp’), for
example in ‘etc/guix/package’?

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 ‘guix health’¹ 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’.

¹ https://issues.guix.gnu.org/31444




Information forwarded to guix-patches <at> gnu.org:
bug#76428; Package guix-patches. (Wed, 26 Feb 2025 04:14:02 GMT) Full text and rfc822 format available.

Message #32 received at 76428 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 76428 <at> debbugs.gnu.org, 宋文武 <iyzsong <at> member.fsf.org>
Subject: Re: bug#76428: [GCD PATCH]
 003-set-search-paths-without-program-wrappers: Submit.
Date: Wed, 26 Feb 2025 12:16:38 +0800
Ludovic Courtès <ludo <at> gnu.org> writes:

>> [...]
>> +Those search path configuration files would be created by the package builder,
>> +after the `install` phase, replace usages of `wrap-program` when possible.
>
> One thought came to mind.
>
> If we are going to provide that sort of metadata along side package
> build results, what about providing a ‘package’ sexp similar to those
> found in the ‘manifest’ file of profiles (see ‘manifest->gexp’), for
> example in ‘etc/guix/package’?

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 ‘guix health’¹ 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.




This bug report was last modified 6 days ago.

Previous Next


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