Subject: Re: [bug#48434] [PATCH] guile: allow pre-inst-env inject local paths

From: Sergei Trofimovich <[email-masked]>
Date: Tue, 17 Aug 2021 10:35:39 +0100

On Tue, 17 Aug 2021 09:28:30 +0100
Sergei Trofimovich <[email-masked]> wrote:

> On Mon, 16 Aug 2021 20:52:48 +0200
> Maxime Devos <[email-masked]> wrote:
> 
> > Sergei Trofimovich schreef op ma 16-08-2021 om 18:28 [+0100]:  
> > > On Sat, 15 May 2021 10:52:27 +0100
> > > Sergei Trofimovich <[email-masked]> 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:  
> 
> > The local directory isn't ignored, it's at the end (the effect is about the same though).  
> 
> Reworded to: "because local directory override has too low priority".
> 
> > > > 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?  
> 
> Attached v2 patch that should solve all the above.
> 
> Added two 'guile' flavours:
>     inplace/guile (to be used inplace)
>     store/guile (to be installed to libexec)
> While at it moved 'guix-daemon' to 'inplace/' as well to make it clear that
> tests use inplace variant sometimes. Installation location did not change.
> 
> Also moved scripts/guix to inplace/guix as ./pre-inst-env relies on it to
> be injected to PATH.
> 
> > Also, "guile-launcher.c" is used by 'quiet-quile" in (guix self).  It should probably be
> > verified that "guix pull" still works well.  
> 
> It's a bit hard to test right now as guix-master is slightly broken due to
> missing installed files when installed as a primary package manager, but at
> least fetch part works fine:
> 
> $ guix pull
> Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
> Authenticating channel 'guix', commits 9edb3f6 to f7094f5 (29 new commits)...
> Building from this channel:
>   guix      https://git.savannah.gnu.org/git/guix.git   f7094f5
> Backtrace:
> In ice-9/boot-9.scm:
>    222:29 19 (map1 (((guix store)) ((guix records)) ((guix #)) (#) …))
>    222:29 18 (map1 (((guix records)) ((guix profiles)) ((guix #)) # …))
>    222:29 17 (map1 (((guix profiles)) ((guix discovery)) ((guix …)) …))
>    222:29 16 (map1 (((guix discovery)) ((guix combinators)) ((# …)) …))
>    222:29 15 (map1 (((guix combinators)) ((guix channels)) ((# #)) …))
>    222:29 14 (map1 (((guix channels)) ((guix describe)) ((guix #)) …))
>    222:29 13 (map1 (((guix describe)) ((guix sets)) ((guix ui)) (#) …))
>    222:29 12 (map1 (((guix sets)) ((guix ui)) ((guix diagnostics)) …))
>    222:29 11 (map1 (((guix ui)) ((guix diagnostics)) ((guix #)) (#) …))
>    222:29 10 (map1 (((guix diagnostics)) ((guix modules)) ((# #)) # …))
>    222:29  9 (map1 (((guix modules)) ((guix packages)) ((guix #)) # …))
>    222:29  8 (map1 (((guix packages)) ((guix utils)) ((gnu # #)) # …))
>    222:29  7 (map1 (((guix utils)) ((gnu packages base)) ((gnu …)) …))
>    222:29  6 (map1 (((gnu packages base)) ((gnu packages bash)) (#) …))
>    222:29  5 (map1 (((gnu packages bash)) ((gnu packages hurd)) (#) …))
>    222:29  4 (map1 (((gnu packages hurd)) ((gnu system setuid)) (#) …))
>    222:17  3 (map1 (((gnu system setuid)) ((srfi srfi-1)) ((# #)) # …))
>    3329:6  2 (resolve-interface (gnu system setuid) #:select _ #:hide …)
>   1685:16  1 (raise-exception _ #:continuable? _)
>   1685:16  0 (raise-exception _ #:continuable? _)
> 
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> no code for module (gnu system setuid)

With https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50090 applied 'guix pull'
works successfully on a multi-user foreign distribution.

-- 

  Sergei