electron / electron/forge

Ensure that the generated files have read/write permissions

Open
#2,190 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Preflight Checklist

* [x] I have read the [contribution documentation](https://github.com/electron-userland/electron-forge/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
* [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Issue Details

* **Electron Forge Version:**
* 6.0.0-beta.54
* **Electron Version:**
* Not important
* **Operating System:**
* NixOS

### Expected Behavior

I have packaged `@electron/cli` into Nixpkgs: https://github.com/NixOS/nixpkgs/pull/115230.

Everything works, except for the permissions of the generated files. Problem is described here: https://github.com/NixOS/nixpkgs/pull/115230#issuecomment-791889974

Basically running:

```
electron-forge init --template=typescript-webpack
```

Works fine when `electron-forge` is from NPM.

But when it is packaged inside Nixpkgs, the copied files have only read permissions, not read write permissions.

It appears that `electron-forge` needs read write permissions to change somethings in those files.

However the command that generates those files is not ensuring that the generated files have read write permissions.

One theory is that it just copying generated files from a template. In that case, in nixpkgs, everything in the store is read-only/immutable, thus if it copies those files, those files will not have write permissions.

The fix to this is to ensure that `electron-forge` when generating the template files, to actually set its umask when creating new files, or when copying files to ensure that the copied files have the expected permission set.

### To Reproduce

Get Nix/Nixpkgs and try to do this: https://github.com/NixOS/nixpkgs/pull/115230#issuecomment-791889974

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.