yeoman / configstore

Easily load and persist config without having to think about where and how
BSD 2-Clause "Simplified" License
868 stars 57 forks source link

v5 is not working with SNAP #63

Closed p3x-robot closed 3 months ago

p3x-robot commented 5 years ago
patrikx3@bitang:~$ /snap/bin/p3x-onenote 
A JavaScript error occurred in the main process
Uncaught Exception:
Error: EPERM: operation not permitted, chown '/home/patrikx3/snap/p3x-onenote/21/.config/configstore/p3x-onenote.json.994378042'
    at Object.chownSync (fs.js:1064:3)
    at Function.writeFileSync [as sync] (/snap/p3x-onenote/21/resources/app.asar/node_modules/write-file-atomic/index.js:196:27)
    at Configstore.set all [as all] (/snap/p3x-onenote/21/resources/app.asar/node_modules/configstore/index.js:61:20)
    at Configstore.set (/snap/p3x-onenote/21/resources/app.asar/node_modules/configstore/index.js:91:12)
    at Object.<anonymous> (/snap/p3x-onenote/21/resources/app.asar/src/electron/app.js:56:10)
    at Object.<anonymous> (/snap/p3x-onenote/21/resources/app.asar/src/electron/app.js:111:3)
    at Module._compile (internal/modules/cjs/loader.js:693:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
/usr/share/libdrm/amdgpu.ids: No such file or directory

When I revert to configstore v4 and install on SNAP it works 100%.
With v5 it tries to chown a file, that is not permitted on SNAP.

p3x-robot commented 5 years ago

of course this error is, that you cannot use chown in snap...

p3x-robot commented 5 years ago

https://github.com/npm/write-file-atomic/blame/73c3b6f94ce7d57f63d30d4b7b33f17d4004bf1e/index.js#L196

p3x-robot commented 5 years ago

https://github.com/npm/write-file-atomic/issues/49

p3x-robot commented 5 years ago

https://github.com/yeoman/configstore/blame/764ac63d17de9e3d322c1c42180a8d5bec85391a/index.js#L14

that line would work like this:

const writeFileOptions = {mode: 0o0600, chown: false};

actually it is still not work, as if it is chown : false it will build the chown setting, there is no way to disable chown right now

sindresorhus commented 4 years ago

I think this could be fixed by switching to use https://github.com/fabiospampinato/atomically

fregante commented 3 months ago

The linked issue has been closed (https://github.com/npm/write-file-atomic/issues/49) and this issue can likely be closed too.