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

Fix bootstrap script for non (ba)sh script #759

Closed
wants to merge 1 commit into from

Conversation

vthemelis
Copy link
Contributor

@vthemelis vthemelis commented Jul 21, 2023

Fixes #758

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Force opam env to give a bash like output.

This allows us to parse the environment variables correctly further down.

opam env also has the option to export the environment as s-exp but I decided to not use it this time as I would realistically add another dependency to the script.

Test Plan

This allows me to run the bootstrap script from my fish session.

Force `opam env` to give a `bash` like output.

This allows us to parse the environment variables correctly further down.

`opam env` also has the option to export the environment as s-exp but I decided to not use it this time as I would realistically add another dependency to the script.
@facebook-github-bot
Copy link
Contributor

Hi @vthemelis!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@WangGithubUser
Copy link
Contributor

@vthemelis I try to improve this at #761 .Could you close this if you think #761 is better?

@vthemelis
Copy link
Contributor Author

vthemelis commented Jul 22, 2023

Hi @WangGithubUser,

Thanks for looking into this.

Why do you think that we need the additional complexity? We don't capture the output of the other commands. Also, if the other commands have side effects these could now be wrong given that they could be executing bash-llike commands on, say, fish.

@WangGithubUser
Copy link
Contributor

WangGithubUser commented Jul 22, 2023

Why do you think that we need the additional complexity? We don't capture the output of the other commands.

We may use commands env init config in the future.Why don't fix them now?And, this diff not only resolved the issue, but also making it easier to fix Opam's command errors.We need to change all the problematic command one by one before, but now we can only change the function get_opam_command.

@vthemelis
Copy link
Contributor Author

But why would you need to change them?

There's a very specific reason we need this argument for the env command and this is because we know how to parse the bash-style output from Python. Ideally we would just get the output of the command as JSON or another serialisation format that's easily parsed from Python. I don't see why we need the to force the shell on any other case.

@WangGithubUser
Copy link
Contributor

WangGithubUser commented Jul 24, 2023

@vthemelis I think, make all the commands outputs same in all cases is better for future.opam may update in future. Make all outputs to be bash-like can make our developer focus more on features rather than considering whether the output will be different. And you can see, #761 's check were all passed, there isn't any side effect. Or there are some hidden efffects? If there are, please tell me.

@stroxler
Copy link
Contributor

I think for now this minimal change makes sense.

@WangGithubUser your change seems reasonable, but it still has some limitations because if new opam commands pop up the problem could reappear. So I think I'd like to try just setting the $SHELL env var instead as a longer-term fix; the opam docs say they will look at the SHELL var when no flag is passed

@facebook-github-bot
Copy link
Contributor

@stroxler has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@grievejia has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@grievejia merged this pull request in b112c7c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap script doesn't work with fish shell
4 participants