Gradience icon indicating copy to clipboard operation
Gradience copied to clipboard

fix: assert write permissions on gnome-shell copy

Open computercam opened this issue 2 years ago • 1 comments

Description

In systems with immutable package stores, the source files used when copying don't have write permissions by default. This creates an error that prevents the files from being removed or altered during the process of the shell theme being built.

Fixed this by creating a copy_function for copytree to set write permissions before performing copying or removing. Additionally I've changed it so that the file is removed if it exists before copying.

Fixes #799

Type of change

  • [x] Bugfix (Change which fixes an issue)
  • [ ] New feature (Change which adds new functionality)
  • [ ] Enhancement (Change which slightly improves existing code)
  • [ ] Breaking change (This change will introduce incompatibility with existing functionality)

Testing

  • [x] I have tested my changes and verified that they work as expected

How to test the changes

Build from source, open the application and go to the theming tab, click "apply" next to "Shell Engine Options. You should get a success message.

For those who are using nixos and want to test this, they can use the following package:

environment.systemPackages = [
  (pkgs.gradience.overrideAttrs {
    version = "0.8.0-beta1";
    src = fetchGit {
      url = "https://github.com/computercam/Gradience.git";
      ref = "nixos-gnome-shell-permissions-issues";
      rev = "881c9ed48b43d46b5d8ca7737f7476bd39134bc7";
      submodules = true;
    };
    propagatedBuildInputs = with pkgs.python3Packages; [
      anyascii
      jinja2
      lxml
      material-color-utilities
      pygobject3
      svglib
      yapsy
      libsass
    ];
  })
];

computercam avatar Aug 16 '23 04:08 computercam

Interesting, if true, this PR could also fix issue #721 and other reports from Matrix chat. For now, I'm putting this PR to draft, as I'll be experimenting with other affected modules later.

tfuxu avatar Aug 16 '23 14:08 tfuxu