Subject: Re: bug#20255: 'search-paths' should respect both user and system profile.

From: [email-masked] (Ludovic Courtès)
Date: Sat, 21 Nov 2015 21:10:17 +0100

Alex Kost <[email-masked]> skribis:

> Ludovic Courtès (2015-11-21 11:57 +0300) wrote:
>
>> Alex Kost <[email-masked]> skribis:
>>
>>> Ludovic Courtès (2015-11-20 01:32 +0300) wrote:
>>>
>>>> -# Load the system profile's settings.
>>>> +if [ -x /run/current-system/profile/bin/guix ]
>>>> +then
>>>> +  # Crucial variables such as 'MANPATH' or 'INFOPATH' may be missing from the
>>>> +  # profiles' individual 'etc/profile'.  Thus, combine both profiles when
>>>> +  # computing the search paths.
>>>> +  #
>>>> +  # This may take a few hundred milliseconds, but it's OK because this is
>>>> +  # performed for log-in shells only.
>>>> +  eval `/run/current-system/profile/bin/guix package \\
>>>> +          -p /run/current-system/profile             \\
>>>> +          -p \"$HOME/.guix-profile\" --search-paths`
>>>
>>> Sorry, but it's not OK for me.  As a user, I'm *strongly* against
>>> running 'guix' (or any other program) in /etc/profile.
>>
>> Why?  (Honest question.)
>
> At first, because of the slowdown: it may be a few hundred milliseconds
> for you, but it's several seconds for me.

Really?  Can you show the output of:

  time guix package -p /run/current-system/profile \
                    -p ~/.guix-profile --search-paths

?

> But actually, even if it was several milliseconds, I still wouldn't
> like it, as (IMHO) /etc/profile should only set variables, and not run
> external programs.

I don’t buy this “principle”: /etc/profile is a program, and the output
of --search-paths is trusted to contain only environment variable
setting.

In the discussion of this bug, we tried hard to avoid resorting to
invoking a program, but ultimately no other solution came out.

>>> I would really like to have an option to avoid this.  Is it possible?
>>
>> Not that I know of.  Please read <http://bugs.gnu.org/20255>.
>
> What about making some environment variable which will be honored by
> 'operating-system-etc-service' procedure.  So depending on this variable
> that 'eval ...' command will or will not be added to "/etc/profile"
> during 'guix system ...' process.
>
> For example, when I do:
>
>   GUIX_IGNORE_SYSTEM_PROFILE_ENV=1 guix system build my-config.scm
>
> the "etc/profile" of the built system will not contain those 'eval ...'
> lines.  WDYT?

This would be unreasonable.  We’re talking about a basic feature here.
If basic features are broken to the point that we prefer to offer ways
to bypass them, and have a semi-broken system, then there’s a problem,
IMO.

Ludo’.