Subject: bug#56076: guix shell -P behavior is surprising with persistent home

From: Maxime Devos <[email-masked]>
Date: Mon, 27 Jun 2022 10:37:21 +0200

> > Having to add openssl looks like a bug,
> 
> It is, but it’s a reasonable solution for the problem at hand.

I don't think it is.  The point of a package manager or distribution is
to automatically install dependencies where required -- in case of
Guix, dependencies can be considered in a more general sense to include
search paths and not only store items.  Having to search #guix or the
ML for work-arounds defeats the point.

My patch <https://issues.guix.gnu.org/55297> could be considered a
work-around, but at least it's automatic for the users, users don't
need to remember random Guix bug facts.

Ludovic Courtès schreef op ma 27-06-2022 om 09:55 [+0200]:
> That’s a bit of a hack to work around this venerable bug:
> 
>   https://issues.guix.gnu.org/22138
> 
> :-)

Maybe yes, but there's no progress there, so work-arounds are needed,
and I consider my <https://issues.guix.gnu.org/55297> to be less of a
hack than ‘add random packages’ (at least 55297 is automatic for the
user, the user doesn't have to remember random packages).  And even if
we do 55297 now, it's still possible to do 22138 later if deemed
proper.

And the patch there is fragile (e.g., if you have gcc:lib in the
references, you automatically get $LIBRARY_PATH TOO, if you have a
cross-gcc:lib, you'd get a $CROSS_LIBRARY_PATH (untested), it's also
not really lexical (+) -- wrap-program boundaries aren't respected.  It
could also easily go wrong in case of static linking (because then
references disappear).  So I consider 22138 not be be a bug/working
patch but a source of more bugs and 55297 to be a proper fix (*).

(*) Except for $GUIX_LOCPATH, but that could be made magical in the
same sense of $PATH.

(+) E.g., suppose that pkg-config and a cross-pkg-config are somewhere
in the references for whatever reason, but only a single one is in the
(propagated) native-inputs.  They both ahave a $PKG_CONFIG_PATH search
path.  However, they are different search paths (one is native-inputs,
other is inputs), so we would get in trouble when "guix shell -D
package" is extended with a --target option or such to make a cross-
compilation environment.

Greetings,
Maxime.