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

Moving a compiled binary to a clean OS would throw cannot install provided ErrorHook #90

Open
xphoniex opened this issue Dec 14, 2022 · 8 comments

Comments

@xphoniex
Copy link

I'm compiling binaries from this project, and it's working fine on the dev machine. However, when I move the binaries to a clean linux os, running the bins returns this error:

$ cast
Error: cannot install provided ErrorHook, a hook has already been installed

Location:
cli/src/handler.rs:70:13

and the line in question is:

eyre::set_hook(Box::new(move |_| Box::new(Handler)))?;

There's also a related issue where people have ran into the same problem on Win 10.

What is causing this?

@xphoniex
Copy link
Author

Polite reminder @yaahc

@yaahc
Copy link
Collaborator

yaahc commented Dec 23, 2022

Thank you, I'm sorry for the long delay, I'll make sure to resolve this asap (probably after the new year).

@davidcornu
Copy link

I've been watching this thread as I recently ran into the same error message after introducing a seemingly unrelated change on a project and finally figured out what was going on. I'm documenting it here in case it can be useful to others.

When the auto-install feature is enabled (which it is by default), if an error handler is needed but one isn't configured yet, eyre will install a default one: https://github.com/yaahc/eyre/blob/c32a8d0b6799ef4c862df1034202f9d6e5a5f400/src/lib.rs#L600-L603

What happened in my case was that I introduced some code that triggered and logged an eyre::Report before the code that setup the error handler, which meant that by the time it was executed the default handler was already in place. This led to a lot of confusion on my part as I wasn't aware of the default handler behaviour and assumed I was somehow trying to set up a handler twice.

This is quite similar to your description @xphoniex, as in my case the new code I introduced was actually checking for the presence of a file that exists on some systems but not others.

Hope this helps.

@mpeyfuss
Copy link

I was able to solve this exact issue by ensuring that git and libusb are installed on the new machine where the compiled binaries are moved to. Hopefully this helps for your issue.

@xphoniex
Copy link
Author

xphoniex commented Mar 14, 2024

Sorry, a bit confusing, is this a typo, or does commit 615d16c actually resolve this issue @dbanty ?

Edit: I think that commit refers to this issue, might wanna re-open this @ten3roberts

@dbanty
Copy link
Contributor

dbanty commented Mar 14, 2024

Hmm, looks like pulling color-eyre into the workspace also pulled in the commit history, which means commits that referenced closing issues for color-eyre now retroactively closed issues for eyre 😱. What a fun problem 😅

@ten3roberts
Copy link
Contributor

Thank you for putting this to my attention.

Not only is it closing issues, but closing unrelated issues just because they have the same issue number, grr.

I'll go through any other closed issues and see if there are any more to reopen (and fix 😝 )

@ten3roberts ten3roberts reopened this Mar 15, 2024
@ten3roberts
Copy link
Contributor

As stated in the issue, it is the auto install being a footgun, which imho is an anti feature.

Tracing does not do anything by default as this easily leads to unexpected behavior.

We've run into a similar issue with the compile probes, and want to give all this a stir up and remove the probes and instead opting for cargo cfg flags to enable nightly behavior as they are prone to silently breaking or misleading behavior.

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

No branches or pull requests

6 participants