Open MIJOTHY opened 1 year ago
Hi @MIJOTHY
Thanks for the very detailed issue, will certainly help when addressing it. I've been a little slack lately in Jabba maintenance as my wife and I welcomed our daughter into the world. Once baby is settled and I can dedicate time to this again I can take a look.
The lines here: https://github.com/Jabba-Team/jabba/blob/ac5cb4fd85156e68455e08c0545c1057aa8b2a71/install.sh#L7-L12 cause the exported
JABBA_HOME
in the installed$JABBA_HOME/jabba.sh
file to potentially resolve to a different location than the installation location. For example, in aDockerfile
likeThe contents of
/root/.jabba/jabba.sh
will beThere is no guarantee that the
jabba.sh
invoker's$HOME
is the same as the installer's$HOME
, as we can see with GitHub Actions which has a$HOME
of/github/home
:It's unclear to me what the purpose of the runtime
$JABBA_HOME
resolution is here: https://github.com/Jabba-Team/jabba/blob/ac5cb4fd85156e68455e08c0545c1057aa8b2a71/install.sh#L9Workaround
This can be worked around by supplying a dummy home to the installation script, such that this check evaluates to false https://github.com/Jabba-Team/jabba/blob/ac5cb4fd85156e68455e08c0545c1057aa8b2a71/install.sh#L7 allowing for the correct setting of
JABBA_HOME_TO_EXPORT
. For example,As
$HOME
is additionally used when creating the shell hooks, this also means you probably want to supply--skip-rc
to the script, and write your own shellhooks.Alternatively, you can patch
$JABBA_HOME/jabba.sh
with the desired export.Possible Fix
I think the core issue here is the defaulting to runtime resolution of
$HOME
, and this default not being overridable without$HOME
manipulations. I would think the sensible default would be to export the location which we know hasjabba.sh
, i.e. expand at install-time (as was done prior to https://github.com/Jabba-Team/jabba/commit/be9eef43585ee384f63ae64ec6e3497f4d614748). If you allowing setting ofJABBA_HOME_TO_EXPORT
by install-script callers, the first part of the script becomes simpler. Instead of https://github.com/Jabba-Team/jabba/blob/ac5cb4fd85156e68455e08c0545c1057aa8b2a71/install.sh#L7C1-L12 you can have something likeIf users want to have this exported home be runtime-user-home-based, they can call the installation script like
JABBA_HOME_TO_EXPORT='$HOME/.jabba'
.Thoughts?