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

Turn procfs into a panic-free library #44

Closed
eminence opened this issue Oct 7, 2019 · 2 comments · Fixed by #48
Closed

Turn procfs into a panic-free library #44

eminence opened this issue Oct 7, 2019 · 2 comments · Fixed by #48
Assignees

Comments

@eminence
Copy link
Owner

eminence commented Oct 7, 2019

In the current design of the procfs crate, panics were possible, as assertions and unwraps are common in the code. This was done to help uncover bugs in the library.

As the library has matured a bit, all of the assertions and unwraps should be replaced with Result types. Most functions already return a ProcResult, so this itself isn't a big change to the public API of procfs.

See also #39

@eminence eminence self-assigned this Oct 7, 2019
eminence added a commit that referenced this issue Oct 14, 2019
The `ProcError` error type now gains a new `InternalError` variant which
is designed to cover cases when the procfs library encounters something
unexpected and would otherwise panic.  Every instance of `InternalError`
should be considered a bug that should be reported

Closes #44
@eminence
Copy link
Owner Author

I have a WIP pull request that implements this. If you're interested in getting a peek at the code, please feel free to take a look. I hope to have a new version published on crates.io within 1 or 2 weeks. Please note that this will be a breaking change, so the new version number will be v0.6.x.

@idanski
Copy link
Contributor

idanski commented Oct 15, 2019

Thanks! I'll have a look sometime this week! Cheers!

eminence added a commit that referenced this issue Oct 18, 2019
The `ProcError` error type now gains a new `InternalError` variant which
is designed to cover cases when the procfs library encounters something
unexpected and would otherwise panic.  Every instance of `InternalError`
should be considered a bug that should be reported

Closes #44
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 a pull request may close this issue.

2 participants