Skip to content

Radare2 bindings - Error { repr: Custom(Custom { kind: Other, error: StringError(\"Cannot find binary path\") }) } #1205

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

Closed
XVilka opened this issue Jan 2, 2018 · 7 comments

Comments

@XVilka
Copy link

XVilka commented Jan 2, 2018

The file is https://github.com/radare/radare2/blob/master/libr/include/r_core.h This is my creduce predicate script:

CMD="bindgen --verbose /home/user/data/tmp/r_core.h -o /home/user/data/tmp/r2-api/r_core.rs -- -I/usr/local/include/libr"
OUT=$($CMD 3>&1 1>&2 2>&3)
EXPECT="Error { repr: Custom(Custom { kind: Other, error: StringError(\"Cannot find binary path\") }) }"

if [ "$OUT" == "$EXPECT" ]; then
	exit 0
else
	exit 1
fi

Here is the preprocessed file
__bindgen.i.gz

Sadly creduce cannot reduce this test because of the bug in the creduce itself - I sent them a report, they are checking it.

See also #1154

@emilio
Copy link
Contributor

emilio commented Jan 2, 2018

That error comes from the which crate, and should be non-fatal.

@XVilka
Copy link
Author

XVilka commented Jan 3, 2018

Well, it prevents from the generating the full bindings for this file.

@emilio
Copy link
Contributor

emilio commented Jan 3, 2018

Hmm, it definitely should not.

We write the (unformatted) bindings right after printing the error in:

https://github.com/rust-lang-nursery/rust-bindgen/blob/ac523232d317373aec9c638f6b0451c78f11f892/src/lib.rs#L1693

Does it happen on master? I think you're getting bit by what I fixed in #1112.

@XVilka
Copy link
Author

XVilka commented Jan 3, 2018

r_core.rs.gz
@emilio aha, now it writes the file, but not sure, it looks bad. Ultralong lines without splitting.

@XVilka
Copy link
Author

XVilka commented Jan 3, 2018

@emilio aha, seems that which crate returned an error because of missing rustfmt binary. Fixed it with cargo install rustfmt. Imho the error should clarify which binary is exactly missing. Now have a problem inside rustfmt it seems:

Error { repr: Custom(Custom { kind: Other, error: StringError("Internal rustfmt error") }) }

@fschutt
Copy link

fschutt commented Feb 7, 2018

Ran into this myself. Could you add this to the README or the book, that in order to use the CLI, you need to install rustfmt-nightly (not the regular rustfmt)? A more descriptive error would be appreciated as well. Thanks.

@emilio
Copy link
Contributor

emilio commented Mar 13, 2018

Sorry for missing this one, yeah, this should be added to the docs... I can't do it right now but I'll put it in the queue. PRs welcome if you manage to get to it earlier of course. Sorry!

@emilio emilio closed this as completed in 4697025 Jan 25, 2019
emilio added a commit that referenced this issue Jan 25, 2019
Produce a more useful error message when rustfmt can't be found. Fixes #1205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants