2 issues in /usr/libexec/elogind/system-sleep/nvidia.sh

Open Beginner friendly
#60,419 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
shell

Research direction

Start by reading /usr/libexec/elogind/system-sleep/nvidia.sh and compare its sleep hook with the ZZZ hook mentioned in the issue. Confirm how the pre-action argument is passed and whether the five-second wait is needed; done means the hook handles the requested sleep mode and no longer adds the unnecessary delay.

Written by the indexing model from the issue text.

Description

bug

The nvidia package supplies some shell scripts to help with putting the device into sleep mode.

case "$1" in
   pre)
       logger -t nvidia-sleep "Entering $2 mode (invoked by $SYSTEMD_SLEEP_ACTION)"
       /usr/bin/nvidia-sleep.sh "hibernate"
       ret=$?
       if [ $ret -ne 0 ]; then
               logger -t nvidia-sleep "Failed to enter $2 mode (exit code $ret)"
               exit $ret
       fi
       sleep 5
       logger -t nvidia-sleep "Entered $2 mode (invoked by $SYSTEMD_SLEEP_ACTION)"
       ;;

First, the script ignores the argument completely and always passes hibernate, when it could accept suspend via "$2" as well. I'm not sure if it causes issues, but it looks wrong.
Second thing, the unnecessary sleep for 5 seconds slowing the whole thing down for no reason whatsoever. I just removed that line and nothing broke. ZZZ hook doesn't have the wait time, so I don't think it's doing anything, plus it returns if we succeeded anyway.

Dominant language
Shell
Stars
3.4k
Forks
2.8k
Avg merge
2d 4h
Merged PRs (30d)
302

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from void-linux/void-packages

All issues in void-linux/void-packages

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.