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

[BUG-FIX] Fixed bug related to recurring sudo prompt for functions that even don't require it #531

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

rootCircle
Copy link
Contributor

The set_override function is always called irrespective of the force flag is called or not. This in turn, required root checks for every flag calls, even for auto-cpufreq --version.

To fix it, now set_override method is now called only if force flag is invoked.
Also root_check is moved from core.py to the main file, to ensure consistency with previous usage of root_check in the code used earlier.

Here are the specific code changes made:

In auto_cpufreq/core.py:

  • Line 96: Removed the root_check call from the set_override function. This was intended to be done to comply with code template, i.e. to use root_check in the main file.

In bin/auto-cpufreq:

  • Line 45: Added a root_check call before calling set_override in main program. Also, set_override is only called if force option is invoked, saving us from precious extra overheads.

Fixes #530

@rootCircle
Copy link
Contributor Author

@niksingh710

set_override method is now called only if force flag is invoked.

Here are the specific code changes made:

In auto_cpufreq/core.py:
- Line 96: Removed the root_check call from the set_override function.
           This was intended to be done to comply with code template,
           i.e., to use root_check in the main file.

In bin/auto-cpufreq:
- Line 45: Added a root_check call before calling set_override in main program.
           Also, set_override is only called if force option is invoked, saving
           us from precious extra overheads.

Fixes AdnanHodzic#530
@AdnanHodzic
Copy link
Owner

Great stuff @rootCircle, I love clean solutions like this one!

I saw your and @niksingh710 conversation in #530 just didn't get a chance to add anything in the discussion. Also, just as a reminder if you're interested I'm still looking for contributors to this project :)

I think this problem was plaguing other PR's like @shadeyg56 #486 and other PR's which I just never got to look into, so thank you for your contribution and you'll be credited for your work as part of upcoming release.

@rootCircle
Copy link
Contributor Author

Great stuff @rootCircle, I love clean solutions like this one!

Thanks :-)

Also, just as a reminder if you're interested I'm still looking for contributors to this project :)

I'm definitely interested. However, my exams are approaching, so I won't be able to contribute for a week or two. But I would love to be a part of this project later on.

While my knowledge of applied stacks is somewhat limited at the moment, but I believe this opportunity will provide me ample chances to learn and enhance it in general. Having taken my initial steps into the open-source community, I am filled with excitement. I can't wait to dive deeper and contribute to this project! 😃

@AdnanHodzic
Copy link
Owner

No worries & take your time, and once you have time just take a look at some guide lines here :)

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 this pull request may close these issues.

autocpufreq --version requires sudo now?
2 participants