void-linux / void-linux/void-packages

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.

bug
Dominant language
Shell
Stars
3.4k
Forks
2.8k
Avg merge
2d 5h
Merged PRs (30d)
299

Description

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.

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.