Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required setup message contains incorrect path to opam root when using OPAMROOT #4992

Closed
Khady opened this issue Jan 13, 2022 · 4 comments · Fixed by #5212
Closed

Required setup message contains incorrect path to opam root when using OPAMROOT #4992

Khady opened this issue Jan 13, 2022 · 4 comments · Fixed by #5212
Assignees
Labels
Projects
Milestone

Comments

@Khady
Copy link
Contributor

Khady commented Jan 13, 2022

If I set the opam root to be non default, with the OPAMROOT env variable, during opam init the required setup section still points to ~/.opam instead of the content of OPAMROOT

$ export OPAMROOT="/tmp/opam-root"
$ opam init --bare
[ ... ]
<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><><><>

  In normal operation, opam only alters files within ~/.opam.
[ ... ]

opam 2.1.0

@kit-ty-kate
Copy link
Member

The message still holds though. "normal operation" refers to "opam without any environment variable set".
The next line states:

  In normal operation, opam only alters files within ~/.opam.

  However, to best integrate with your system, some environment variables
  should be set.

But I understand the confusion. Maybe we could replace this by:

  In normal operation, opam only alters files within ~/.opam.
  In your particular case, $OPAMROOT has been set to $your-path, thus as long as --root or $OPAMROOT is set, only files within $your-path will be altered.

  However, to best integrate with your system, some environment variables
  should be set.

when $OPAMROOT is set. But it might be a bit verbose.

Maybe we should rethink this message entirely instead. Any ideas?

@Khady Khady changed the title Required setup message contains incorrect path to opam root Required setup message contains incorrect path to opam root when using OPAMROOT Jan 13, 2022
@Khady Khady changed the title Required setup message contains incorrect path to opam root when using OPAMROOT Required setup message contains incorrect path to opam root when using OPAMROOT Jan 13, 2022
@AltGr
Copy link
Member

AltGr commented Jan 14, 2022

Suggestion:

  • if $OPAMROOT is not defined:
In normal operation, opam only alters files within ~/.opam.

as before

  • if it is defined:
In normal operation, opam only alters files within %{opamroot}%.

(verbatim, don't expand the variable)

@dra27
Copy link
Member

dra27 commented Jan 14, 2022

Only problem with that is that it doesn't cover --root. It's reasonable to assume that this only happens to a user who knows about roots (because they have set OPAMROOT or added --root) so it could reasonably be: "opam only alters files within your opam root (~/.opam)" and display the actual value if it's not the default. Referring to the opam root in the message loosely covers the case where you then unset OPAMROOT later.

@dra27 dra27 self-assigned this Jan 14, 2022
@dra27 dra27 added this to To do in Opam 2.2.0 via automation Jan 14, 2022
@dra27
Copy link
Member

dra27 commented Jan 14, 2022

(putting in 2.2 as the Windows shell stuff touches this message anyway, and it's not a big change!)

@dra27 dra27 linked a pull request Aug 8, 2022 that will close this issue
@dra27 dra27 moved this from To do to In progress in Opam 2.2.0 Aug 8, 2022
@dra27 dra27 added this to the 2.2.0~alpha milestone Aug 8, 2022
Opam 2.2.0 automation moved this from In progress to Done Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Opam 2.2.0
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants