unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#48434] [PATCH] guile: allow pre-inst-env inject local paths
@ 2021-05-15  9:52 Sergei Trofimovich
  2021-08-16 17:28 ` Sergei Trofimovich
  0 siblings, 1 reply; 9+ messages in thread
From: Sergei Trofimovich @ 2021-05-15  9:52 UTC (permalink / raw)
  To: 48434; +Cc: Ludovic Courtès, Sergei Trofimovich

I observed the problem when tried to run 'guix refresh' from local git checkout:

    $ strace -f ./pre-inst-env guix refresh -u re2c |& fgrep re2c.scm
    ...
    [pid 3014757] openat(AT_FDCWD, "/usr/share/guile/site/3.0/gnu/packages/re2c.scm.qilB0R",
        O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)

Attempt to /usr/share happens because local directory override is ignored:

    $ ./pre-inst-env guile -c '(display (search-path %load-path "gnu/packages/re2c.scm")) (newline) (display %load-path) (newline)'
    /usr/share/guile/site/3.0/gnu/packages/re2c.scm
    (/usr/share/guile/3.0 \
     /usr/share/guile/site/3.0 \
     /usr/share/guile/site \
     /usr/share/guile \
     /home/slyfox/dev/git/guix \
     /home/slyfox/dev/git/guix)

It happens because ./guile ignores GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH
unconditionally.

The change keeps GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH for ./pre-inst-env.

* gnu/packages/aux-files/guile-launcher.c (main): don't ignore
GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH in GUIX_UNINSTALLED=1 mode.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 gnu/packages/aux-files/guile-launcher.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/aux-files/guile-launcher.c b/gnu/packages/aux-files/guile-launcher.c
index 47ba069de1..bed63353a9 100644
--- a/gnu/packages/aux-files/guile-launcher.c
+++ b/gnu/packages/aux-files/guile-launcher.c
@@ -73,14 +73,19 @@ main (int argc, char **argv)
        which is always preferable over the C locale.  */
     setlocale (LC_ALL, "en_US.utf8");
 
-  const char *str;
-  str = getenv ("GUILE_LOAD_PATH");
-  load_path = str != NULL ? strdup (str) : NULL;
-  str = getenv ("GUILE_LOAD_COMPILED_PATH");
-  load_compiled_path = str ? strdup (str) : NULL;
+  /* Allow ./pre-inst-env to inject local paths. That way local sources
+     are preferred for most operations.  */
+  if (getenv ("GUIX_UNINSTALLED") == NULL)
+    {
+      const char *str;
+      str = getenv ("GUILE_LOAD_PATH");
+      load_path = str != NULL ? strdup (str) : NULL;
+      str = getenv ("GUILE_LOAD_COMPILED_PATH");
+      load_compiled_path = str ? strdup (str) : NULL;
 
-  unsetenv ("GUILE_LOAD_PATH");
-  unsetenv ("GUILE_LOAD_COMPILED_PATH");
+      unsetenv ("GUILE_LOAD_PATH");
+      unsetenv ("GUILE_LOAD_COMPILED_PATH");
+    }
 
   /* XXX: Do not let GMP allocate via libgc as this can lead to memory
      corruption in GnuTLS/Nettle since Nettle also uses GMP:
-- 
2.31.1





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

end of thread, other threads:[~2021-08-17 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-15  9:52 [bug#48434] [PATCH] guile: allow pre-inst-env inject local paths Sergei Trofimovich
2021-08-16 17:28 ` Sergei Trofimovich
2021-08-16 18:52   ` Maxime Devos
2021-08-17  8:28     ` Sergei Trofimovich
2021-08-17  9:35       ` Sergei Trofimovich
2021-08-17 10:24       ` Maxime Devos
2021-08-17 12:15         ` Sergei Trofimovich
2021-08-17 13:59           ` Maxime Devos
2021-08-17 17:42             ` Sergei Trofimovich

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

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

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