-
Notifications
You must be signed in to change notification settings - Fork 449
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
adding a method to patch linux idle check with required libraries. #5354
base: master
Are you sure you want to change the base?
Conversation
client/hostinfo_unix.cpp
Outdated
} | ||
|
||
// Main loop to monitor input events | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will lead to the dead lock of the BOINC Client. Instead, this functions should be called outside and return result as fast as possible.
Please be sure to test your changes before making a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to have an opinion before making any further changes, This code could be added separately, runs in the background while the client is running, and writes the time of being idle to a tmp file, which can be read inside the client at any time.
But I am not sure if you agree with this idea to be added to the code,
Also, as I mentioned it will need permissions to read and execute /dev/input which regular users don't have by default.
So separating it could be a better approach to give the file its own permissions because having such permissions to a whole user is a security risk -keylogging is an example of what could go wrong-.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't get me wrong, but this is a not a good approach: you did some implementation, but you haven't tested it. What is more important - we can't test it as well, because we can't just use your code and run any test, because obviously everything will just hang in an infinite loop.
If you have an idea but don't know how to implement it properly - it's better to describe your idea in detail and ask for advice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right.
I've removed the infinite loop and fixed the stupid logic.
But I also haven't removed any existing code.
I'll push the updates to the pull (when I figure out how).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While on this branch:
git add . && git commit && git push
client/hostinfo_unix.cpp
Outdated
// Use glob to enumerate input devices in /dev/input/ | ||
glob_t globbuf; | ||
if (glob("/dev/input/event*", GLOB_NOSORT, nullptr, &globbuf) != 0) { | ||
std::cerr << "Failed to enumerate input devices. " << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg_printf
should be used instead of the direct std::
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this comment as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be all good now.
1a1fc6c
to
df64010
Compare
It seems I added the includes in the wrong place as android is still trying to include them |
@0x0OZ, Client is failed to build as well, you need to include 'libevdev' here to install it on CI: boinc/.github/workflows/linux.yml Line 53 in eac3e3a
|
@AenBleidd client still fails, |
You need to add this linker flags somewhere to this file: https://github.com/BOINC/boinc/blob/master/configure.ac |
…efficient and optimized.
Like I understand a single word 😅, I'll try to. |
I made it worse with the last change to |
@AenBleidd Linux client now builds successfully, |
Hey @AenBleidd, |
@0x0OZ, it would be nice to fix this build for all other OSs... |
…clude only for linux
Snap fails because libevdev is not being installed for it, it's only installed using apt, android fails because it tries to add the linker |
That's done, everything builds successfully now. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5354 +/- ##
============================================
- Coverage 10.87% 10.87% -0.01%
Complexity 1068 1068
============================================
Files 279 279
Lines 36059 36061 +2
Branches 8335 8335
============================================
Hits 3920 3920
- Misses 31745 31747 +2
Partials 394 394 |
Snap failed, I thought it did not as at first it was skipped and didn't give an error. |
@AenBleidd All success but snap, and I know what's wrong but I don't know what could be done because I can't reproduce the error and it's done in a container... |
I now have more time to work on this, Apart from the dead end for snap that I couldn't reproduce the bug and find a solution but it seems a docker thing? I have seen some issues that the libs installed during init weren't being recognized... This would be a better approach because of the permissions issue. |
And that is why we have this idea: #5226. Since you're already have some experience with that, maybe you could work on this tool? |
Yes, I was thinking of doing that myself, I saw this ticket which gave me some insight. |
@0x0OZ, nice! Thank you very much! In case you have any questions - feel free to reach out to me here or in BOINC Discord: https://discord.gg/wPRafUq |
Fixes # Linux checking being idle, A fix for #1187
Description of the Change
added a method that does the check without really replacing it with the existing poor check to be reviewed and added by a C++ developer.
Alternate Designs
Release Notes
Fixing linux idle check by listening for input events in
/dev/input/*
.If this change is not user-facing or notable enough to be included in release notes you may use the string "N/A" here. -->
To this run correctly, the user running the client has to have read and execute permissions on /dev/input/* files, this can be done using
setfacl