nodejs / copyfile: bad address in system call argument
- Dominant language
- C
- Stars
- 20.5k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi iSH team!
Some of my nodejs apps are failing on iSH because of a bug in system call copyfile (see below).
Could somebody please help in fixing this issue in iSH?
And of course let me know if I can help in any way :-).
Thanks a lot and keep the excellent work with iSH!
Kind regards,
Maurice
** Easy steps to reproduce this bug on iSH v1.3.2 (Build 494)
echo hello >a
apk add nodejs
node -e "require('fs').copyFileSync('a','b')"
** Note
Having a non empty 'a' file is important because copying an empty file actually works
** Results on the defaut iSH alpine v3.14 with default minirootfs v3.14.3
node -e "require('fs').copyFileSync('a','b')"
internal/fs/utils.js:332
throw err;
^
Error: EPERM: operation not permitted, copyfile 'a' -> 'b'
at Object.copyFileSync (fs.js:2062:3)
at [eval]:1:15
at Script.runInThisContext (vm.js:134:12)
at Object.runInThisContext (vm.js:310:38)
at internal/process/execution.js:81:19
at [eval]-wrapper:6:22
at evalScript (internal/process/execution.js:80:60)
at internal/main/eval_string.js:27:3 {
errno: -1,
syscall: 'copyfile',
code: 'EPERM',
path: 'a',
dest: 'b'
}
node -v
v14.21.3
** More expressive results on latest alpine v3.18 with minirootfs v3.18.2
node -e "require('fs').copyFileSync('a','b')"
node:internal/fs/utils:351
throw err;
^
Error: EFAULT: bad address in system call argument, copyfile 'a' -> 'b'
at Object.copyFileSync (node:fs:2980:3)
at [eval]:1:15
at Script.runInThisContext (node:vm:122:12)
at Object.runInThisContext (node:vm:298:38)
at node:internal/process/execution:83:21
at [eval]-wrapper:6:24
at runScript (node:internal/process/execution:82:62)
at evalScript (node:internal/process/execution:104:10)
at node:internal/main/eval_string:50:3 {
errno: -14,
syscall: 'copyfile',
code: 'EFAULT',
path: 'a',
dest: 'b'
}
Node.js v20.3.1
** Results using previous alpine versions
echo hello >a
apk add nodejs
node -e "require('fs').copyFileSync('a','b')"
minirootfs:
- 3.0 to 3.6: no nodejs
- 3.7.3: node v8.9.3 => copyFileSync works
- 3.8.5: node v8.14.0 => copyFileSync works
- 3.9.6: node v10.19.0 => copyFileSync works
- 3.10.9: node v10.24.1 => copyFileSync works (last working version)
- 3.11.0: node v12.22.6 => copyFileSync DOES NOT WORK
- 3.11.13: node v12.22.6 => copyFileSync DOES NOT WORK
- Any other version after => copyFileSync DOES NOT WORK
** Some variations if needed
node -e "require('fs').copyFileSync('a','b')"
node -e "require('fs').copyFile('a','b',console.log)"
node -e "require('fs').promises.copyFile('a','b')"
node -e "require('fs').cpSync('a','b')"
node -e "require('fs').cp('a','b',console.log)"
node -e "require('fs').promises.cp('a','b')"
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.