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

[Merged by Bors] - fix: replace fvm binary on fvm self install #3616

Conversation

EstebanBorai
Copy link
Contributor

@EstebanBorai EstebanBorai commented Oct 20, 2023

Ensures the FVM binary is replaced when running fvm self install

The approach involves making sure FVM where self install is executed is not
the same as fvm which is already installed. Otherwise bus errors will occur by
trying to replace the ongoing process binary.

@EstebanBorai EstebanBorai marked this pull request as ready for review October 20, 2023 23:00
@EstebanBorai EstebanBorai marked this pull request as draft October 20, 2023 23:17
Copy link
Contributor

@digikata digikata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good to add a test for it

@EstebanBorai EstebanBorai force-pushed the 3615-fvm-self-install-should-replace-existing-binary branch from d09f5cb to 752165f Compare October 21, 2023 00:57
@EstebanBorai EstebanBorai marked this pull request as ready for review October 21, 2023 00:59
Comment on lines +69 to +71
// Creates the binaries directory
let bin_dir = fvm_dir.join("bin");
create_dir_all(bin_dir)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking for directories before creating:

 if !fvm_dir.exists() {
   create_dir(&fvm_dir)?;
   tracing::debug!(?fvm_dir, "Created FVM home directory with success");
 }

We can use create_dir_all which not only create parent dirs in a single execution
but it also allows for no-op on already existent dirs.

Comment on lines -40 to +30
Settings::init()?;

Settings::open()?;
Copy link
Contributor Author

@EstebanBorai EstebanBorai Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settings::init creates the Settings file if it doesnt exists, instead Settings::open will attempt to open the settings.toml file, but if it doesnt
exists it creates it (using Settings::init).

@EstebanBorai EstebanBorai force-pushed the 3615-fvm-self-install-should-replace-existing-binary branch 2 times, most recently from ad134bd to 03677a1 Compare October 21, 2023 17:51
@EstebanBorai EstebanBorai force-pushed the 3615-fvm-self-install-should-replace-existing-binary branch from 03677a1 to 1ae5b8f Compare October 21, 2023 17:52
@EstebanBorai
Copy link
Contributor Author

bors r+

bors bot pushed a commit that referenced this pull request Oct 21, 2023
Ensures the FVM binary is replaced when running `fvm self install`

The approach involves making sure FVM where `self install` is executed is not
the same as `fvm` which is already installed. Otherwise `bus` errors will occur by
trying to replace the ongoing process binary.
@bors
Copy link

bors bot commented Oct 21, 2023

Build failed:

@EstebanBorai
Copy link
Contributor Author

bors r+

bors bot pushed a commit that referenced this pull request Oct 21, 2023
Ensures the FVM binary is replaced when running `fvm self install`

The approach involves making sure FVM where `self install` is executed is not
the same as `fvm` which is already installed. Otherwise `bus` errors will occur by
trying to replace the ongoing process binary.
@bors
Copy link

bors bot commented Oct 21, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title fix: replace fvm binary on fvm self install [Merged by Bors] - fix: replace fvm binary on fvm self install Oct 21, 2023
@bors bors bot closed this Oct 21, 2023
@EstebanBorai EstebanBorai mentioned this pull request Oct 22, 2023
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FVM - self install should replace existing binary Fluvio Version Manager
2 participants