unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Sergei Trofimovich <slyich@gmail.com>, 48434@debbugs.gnu.org
Subject: [bug#48434] [PATCH] guile: allow pre-inst-env inject local paths
Date: Mon, 16 Aug 2021 20:52:48 +0200	[thread overview]
Message-ID: <430b0e953bf76a13ff2290004d3e7ac1f0bdef7c.camel@telenet.be> (raw)
In-Reply-To: <20210816182822.654d3e1f@zn3>

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

Sergei Trofimovich schreef op ma 16-08-2021 om 18:28 [+0100]:
> On Sat, 15 May 2021 10:52:27 +0100
> Sergei Trofimovich <slyfox@gentoo.org> wrote:
> 
> > 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)

         ^ here's the checkout in the load path

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

The local directory isn't ignored, it's at the end (the effect is about the same though).

> > 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.

Could you do something like

#define GUIX_UNINSTALLED 1
#if GUIX_UNINSTALLED
new behaviour
#else
OLD BEHAVIOUR
#endif

and change "Makefile.am" to compile two variants of "guile",
one with "DGUIX_UNINSTALLED=1" which goes into libexec, and another
with "DGUIX_UNINSTALLED=0" named "$CHECKOUT/guile" which isn't installed
anywhere but will be added to PATH by "pre-inst-env", or something like that?

I've a bit of an aversion towards using $..._UNINSTALLED environment variables,
as it leads to difficult situations like ‘what should happen if I /gnu/store/.../bin/guix
is run with GUIX_UNINSTALLED set to 1’:

  (a): Reset "GUILE_LOAD{,_COMPILED}_PATH" because we're running directly from the store
  (b): Don't reset "GUILE_LOAD_{,_COMPILED}_PATH" because GUIX_UNINSTALLED is set to 1.

As a comparison, GUIX_UNINSTALLED, the preprocessor variable, is like a ‘lexical variable’,
and GUIX_UNINSTALLED, the environment variable, is like a
‘parameter object’/‘dynamically bound variable’ (see, e.g., 6.11.12 Parameters in the Guile
manual).  I tend to prefer the former, except for dynamic things like LC_ALL, $[...]_PATH
(when used by "guile", "gcc" -- applications typically shouldn't depend on $GUILE_LOAD_PATH,
if they do, they need 'wrap-program' or the like’).

Also, "guile-launcher.c" is used by 'quiet-quile" in (guix self).  It should probably be
verified that "guix pull" still works well.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2021-08-16 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=430b0e953bf76a13ff2290004d3e7ac1f0bdef7c.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=48434@debbugs.gnu.org \
    --cc=slyich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).