Not working on Linux
Closed this issue · 3 comments
Describe the bug
Running Apply tweaks
causes an error, no tweaks applied after last update.
To Reproduce
Steps to reproduce the behavior:
sudo mtslack
Apply tweaks
Expected behavior
Tweaks being applied without error.
Desktop (please complete the following information):
- OS: Arch Linux
- Version: 4.17.0 64-bit (efde0ef4fee1b59f252255271b676ea15fd33f0f@1627692449)
Additional context
node:fs:582
handleErrorFromBinding(ctx);
^
Error: ENOENT: no such file or directory, open '/usr/lib/slack/resources/app.asar.unpacked/node_modules/@marshallofsound/native-keymap/bin/linux-x64-89/native-keymap.node'
at Object.openSync (node:fs:582:3)
at Object.readFileSync (node:fs:450:35)
at Object.module.exports.readFileSync (/usr/lib/node_modules/mtslack/node_modules/@mallowigi/asar/lib/disk.js:110:17)
at Object.module.exports.extractAll (/usr/lib/node_modules/mtslack/node_modules/@mallowigi/asar/lib/asar.js:200:28)
at Object.exports.apply (/usr/lib/node_modules/mtslack/lib/command.js:205:8)
at Timeout._onTimeout (/usr/lib/node_modules/mtslack/lib/command.js:253:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/usr/lib/slack/resources/app.asar.unpacked/node_modules/@marshallofsound/native-keymap/bin/linux-x64-89/native-keymap.node'
}
For what it's worth, I ran into the same issue, and it seems even electron's own asar
tool fails to unpack the archive. Not sure the underlying reasoning.
I patched disk.js
in asar
to simply skip those files that are failing, and otherwise, the patch seems to be successful. All of the files that fail extraction fit a similar pattern: they're (I believe incorrectly) marked as unpacked
, causing asar
to read them from disk, but there's nothing to be read.
The files that fail seem to possibly be OS-dependent:
node_modules/windows-notification-state/bin/linux-x64-87/windows-notification-state.node
node_modules/macos-notification-state/bin/linux-x64-87/macos-notification-state.node
node_modules/windows-quiet-hours/build/Release/quiethours.node failed
Similar error but different file, Slack 4.18 64-bit (09ff195c456ca1d1f4790e34e6df99ac5ad48009@1636153044), Arch Linux:
/ Processing...
node:fs:585
handleErrorFromBinding(ctx);
^
Error: ENOENT: no such file or directory, open '/usr/lib/slack/resources/app.asar.unpacked/node_modules/windows-active-process/bin/linux-x64-89/windows-active-process.node'
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Object.module.exports.readFileSync (/usr/lib/node_modules/mtslack/node_modules/@mallowigi/asar/lib/disk.js:110:17)
at Object.module.exports.extractAll (/usr/lib/node_modules/mtslack/node_modules/@mallowigi/asar/lib/asar.js:200:28)
at Object.exports.apply (/usr/lib/node_modules/mtslack/lib/command.js:205:8)
at Timeout._onTimeout (/usr/lib/node_modules/mtslack/lib/command.js:253:16)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/usr/lib/slack/resources/app.asar.unpacked/node_modules/windows-active-process/bin/linux-x64-89/windows-active-process.node'
}
I managed to fix it myself by altering the function module.exports.readFileAsync
module.exports.readFileSync = function (filesystem, filename, info) {
let buffer = Buffer.alloc(info.size)
if (info.size <= 0) { return buffer }
if (info.unpacked) {
if (fs.existsSync(path.join(`${filesystem.src}.unpacked`, filename))) // <--- This line added
// it's an unpacked file, copy it.
buffer = fs.readFileSync(path.join(`${filesystem.src}.unpacked`, filename))
......
I'm not working on Linux anymore guys, sorry.
You're welcome to do any PRs if you can fix it.