Slimbook-Team/slimbookbattery

Slimbook Battery does not launch in multi-user environment.

Opened this issue · 1 comments

Describe the bug
When attempting to launch Slimbook Battery from a different user than who installed it, Slimbook Battery does not launch.
For example, if user A installs slimbook battery and runs it, then user A logs off, user B logs on, and attempts to run slimbook battery, it does not launch. Slimbook Battery only launches from user A.

To Reproduce
Attempt to launch Slimbook Battery from any user other than the one that installed it.
Attempting to run from the terminal yields the following error:

Cannot open log file /var/slimbookbattery.log, using /tmp/slimbookbattery.log
Traceback (most recent call last):
  File "/usr/share/slimbookbattery/src/utils.py", line 21, in get_logger
    fh = logging.FileHandler("/var/log/slimbookbattery.log")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/log/slimbookbattery.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/slimbookbattery/src/slimbookbatterypreferences.py", line 37, in <module>
    import utils
  File "/usr/share/slimbookbattery/src/utils.py", line 40, in <module>
    logger = get_logger("utils.py", True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/slimbookbattery/src/utils.py", line 25, in get_logger
    fh = logging.FileHandler("/tmp/slimbookbattery.log")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/tmp/slimbookbattery.log'

Desktop (please complete the following information):

  • OS: Arch Linux x86_64
  • Version: N/A (updated to latest packages as of June 14, 2024), kernel version 6.9.3-arch1-1
  • Desktop Environment: KDE Plasma 6.0.5

Expected behavior (Optional)
Slimbook battery to launch for users other than the user that installed it.

Screenshots
N/A

Additional context
N/A

edit: added date to "updated to latest packages" for clarity