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

please remove expects! #131

Closed
int5-grey opened this issue May 24, 2021 · 2 comments
Closed

please remove expects! #131

int5-grey opened this issue May 24, 2021 · 2 comments

Comments

@int5-grey
Copy link
Contributor

This crate is great and id really like to use it, but there's one issue and thats the expects!. Imho a library shouldn't act on global of program state (like terminating it) based on an unexpected condition - it should only do that if the state could lead to undefined behavior - which can occur in things like libc. Here we are expecting procfs to follow a certain standard in terms of layout - which should be pretty reliable - but worst case should cause an API to return an error not a panic. Don't mind helping with this effort - but wanted to get your thoughts.

@eminence
Copy link
Owner

eminence commented May 24, 2021

Hi there.

Can you give an example where procfs will panic? Procfs tries pretty hard to never do that, and will always return an error instead (though I have occasionally found a few panics while fuzzing some of parsers, and there are probably a few such panics still hiding somewhere).

See also #44 (edit: and see this note in the docs)

@int5-grey
Copy link
Contributor Author

@eminence Awesome - didn't see you defined the expect! macro - I just assumed it was this one

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

2 participants