GradienceTeam / Gradience

Change the look of Adwaita, with ease
https://gradienceteam.github.io
GNU General Public License v3.0
1.3k stars 52 forks source link

bug: permission problems to wrong directories #721

Open lutzseverino opened 1 year ago

lutzseverino commented 1 year ago

Is there an existing issue for this?

What happened?

Might be related to #710.

Gradience is trying (and failing) to write to the internal config folder found at /home/lutzseverino/.var/app/com.github.GradienceTeam.Gradience/config/gtk-4.0/gtk.css (in my case, of course).

Upon clicking "Apply", an error is thrown.

Traceback (most recent call last):
  File "/app/lib/python3.10/site-packages/gradience/frontend/main.py", line 614, in apply_color_scheme
    PresetUtils().apply_preset("gtk4", self.preset)
  File "/app/lib/python3.10/site-packages/gradience/backend/theming/preset_utils.py", line 280, in apply_preset
    with open(
PermissionError: [Errno 13] Permission denied: '/home/lutzseverino/.var/app/com.github.GradienceTeam.Gradience/config/gtk-4.0/gtk.css'

Troubleshooting

  1. Creating the files under that directory manually doesn't seem to do anything.
  2. Adding "All system files" permissions (flatseal) doesn't do anything.
  3. "All user files" has the same effect.
  4. Adding the folder (even the incorrect one) as an override also doesn't do anything.

I can't seem to find a single way to even fix Gradience permission problem, even if it's trying to write to the incorrect folder.

To Reproduce

  1. Set preset
  2. Apply

Expected behavior

Themes are applied, and the user files are modified.

Screenshots

No response

OS

Fedora Linux 37 (Workstation Edition)

DE/WM version

i3wm 4.22

Version

0.4.0

Installation method

Flatpak from Flathub

Enabled system extensions (GNOME specific)

No response

Additional context

No response

Code of Conduct

github-actions[bot] commented 1 year ago

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

daudix commented 1 year ago

Hi, thank you for taking time and opening bug report!

If you have "Custom accent colors" extension installed make sure to disable it, this extension always causes this issue

lutzseverino commented 1 year ago

No extensions are installed.

It seems like the permissions of my .config/gtk-X.0/gtk.css files were incorrect, which is very odd. I'm unaware if that permission change could've been made by Gradience. It could be because I edited those files myself recently, and now they were read-only.

Fixing the permissions of those files seems to restore Gradience's ability to edit them. Maybe a warning could be in place, if permissions are incorrect, prompting the user to fix them instead of trying to edit the internal directory would be a solution for this edge case.

daudix commented 1 year ago

The permissions are correct in most cases, I'm using fedora and there are no permission issues, but yeah, maybe we should add a dialog for fixing permissions

tfuxu commented 1 year ago

@lutzseverino What file permissions you had when you couldn't apply a preset? Did file owner changed, or was it just set to read-only?

It may be because of shutil.copyfile() function that we use in some areas (including preset functions), which doesn't copy ACLs.

lutzseverino commented 1 year ago

owner was unchanged, but it was read-only, and group and others were set to none.

tfuxu commented 1 year ago

owner was unchanged, but it was read-only, and group and others were set to none.

Exactly what I thought, it doesn't copy any permissions and sets default chmod perms (which are read-only for owner and nothing for group and others). I'll try to find some alternatives for copyfile(). Thanks for the report

lutzseverino commented 1 year ago

No problem, glad I could spot something myself.