Gradience icon indicating copy to clipboard operation
Gradience copied to clipboard

bug: PermissionError when shell themeing on 0.8.0-beta1 nixos

Open Givlucas opened this issue 2 years ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What happened?

When attempting to theme the shell on nixos using 0.8.0-beta 1 I get the following traceback:

Traceback (most recent call last):
  File "/nix/store/a6xacb4nc96y5swab1g5lzf97b4k84ps-gradiencetest-0.8.0-beta3/lib/python3.10/site-packages/gradience/frontend/widgets/shell_theming_group.py", line 115, in on_apply_button_clicked
    ShellTheme().THEME_EXT_NAME, check_enabled=True)
  File "/nix/store/a6xacb4nc96y5swab1g5lzf97b4k84ps-gradiencetest-0.8.0-beta3/lib/python3.10/site-packages/gradience/backend/theming/shell.py", line 95, in __init__
    shutil.rmtree(self.source_dir)
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/shutil.py", line 725, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/shutil.py", line 658, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/nix/store/lwzzgbnj41d657lpxczk6l5f7d5zcnj1-python3-3.10.11/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: '_a11y.scss'

Attached is the nix file I used to build gradience. (in txt because github wouldnt let me attach the .nix

gradience.txt

To Reproduce

  1. Attempt to theme the shell on gradience 0.8.0-beta1

Expected behavior

Theme is applied

Screenshots

No response

OS

Nixos 23.05

DE/WM version

Gnome 44.2

Version

0.8.0-beta1

Installation method

Manual using meson

Enabled system extensions (GNOME specific)

No response

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Givlucas avatar Jul 05 '23 19:07 Givlucas

Welcome on Gradience. 🥳 We really appreciate your contribution. The core team will review your issue as soon as possible. You can also join the Matrix room: https://matrix.to/#/#Gradience-space:envs.net or the Discord server: https://discord.com/invite/4njFDtfGEZ

github-actions[bot] avatar Jul 05 '23 19:07 github-actions[bot]

@Givlucas This is unsupported BUT could you check if there is this file in whereisyourdatadir/gradience/shell/{42,43,44}/

0xMRTT avatar Jul 12 '23 22:07 0xMRTT

Yes there is

Givlucas avatar Jul 16 '23 15:07 Givlucas

@Givlucas here, gradience is trying to remove the cache dir for generating a new theme ((GLib.get_home_dir(), ".cache", "gradience", "gradience-shell", str(self.version_target)), normally GLib.get_home_dir() is set to ~ so could you check if you have write access to ~/.cache/gradience

0xMRTT avatar Jul 16 '23 15:07 0xMRTT

Getting the same error using the same package as OP. The error seems to be that because nixos stores files in an immutable way (removing write permissions to files in the nix store), when the files are copied over (https://github.com/GradienceTeam/Gradience/blob/1d96348fde14e33073aa8b9616465e00ecbd7fed/gradience/backend/theming/shell.py#L98), they're copied over with read only permissions.

I'm 99% certain this can't be fixed in the nixos store as the OS enforces read only permissions. I believe this will have to be fixed by utilizing the copy_function argument of the copytree method of shutil. I will try to get a PR in for this.

computercam avatar Aug 16 '23 02:08 computercam