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

Infinite recursion possibility at Linux implementation #30

Closed
svartalf opened this issue Jun 2, 2019 · 0 comments
Closed

Infinite recursion possibility at Linux implementation #30

svartalf opened this issue Jun 2, 2019 · 0 comments
Assignees
Labels
A-battery Area: battery crate C-bug Something isn't working O-linux Operating system: Linux P-high High priority

Comments

@svartalf
Copy link
Owner

svartalf commented Jun 2, 2019

Reference:

fn energy_full_design(&self) -> Result<&Energy> {
// Based on the `upower` source it seems to impossible not to have any of needed files,
// so fallback to `0 mWh` was removed, error will be propagated instead.
self.energy_full_design.try_borrow_with(|| {
match fs::energy(self.root.join("energy_full_design")) {
Ok(Some(value)) => Ok(value),
Ok(None) => match fs::charge(self.root.join("charge_full_design")) {
Ok(Some(value)) => Ok(value * *self.design_voltage()?),
Ok(None) => Ok(*self.energy_full_design()?),

First of all, upower sources should be checked, since they were used as an knowledge source.
If nothing helpful can be borrowed from them, plain error should be returned there instead of calling the same one function.

@svartalf svartalf added C-bug Something isn't working O-linux Operating system: Linux A-battery Area: battery crate P-high High priority labels Jun 2, 2019
@svartalf svartalf self-assigned this Jun 2, 2019
davidkna pushed a commit to davidkna/rust-battery that referenced this issue Jul 31, 2023
Bumps [akheron/dependabot-cron-action](https://github.com/akheron/dependabot-cron-action) from d020867c009553e279f0200b621459444828a9b0 to 7c8c20dc33be141eb135aaa6280129be3e1ec4cc.
- [Release notes](https://github.com/akheron/dependabot-cron-action/releases)
- [Commits](akheron/dependabot-cron-action@d020867...7c8c20d)

---
updated-dependencies:
- dependency-name: akheron/dependabot-cron-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-battery Area: battery crate C-bug Something isn't working O-linux Operating system: Linux P-high High priority
Projects
None yet
Development

No branches or pull requests

1 participant