fs.copyFile fails if source is readonly and target is a CIFS volume
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v22.21.1
Platform
Linux a7f6d3be6434 5.15.158-2-pve #1 SMP PVE 5.15.158-2 (2024-07-26T13:11Z) x86_64 Linux
Docker: Alpine release 3.22.2
Subsystem
fs
What steps will reproduce the bug?
Hi,
Copying sample.docx fails with EPERM because the source is read-only and the destination is a CIFS share.
Probably related to:
https://github.com/nodejs/node/issues/37284
https://github.com/libuv/libuv/issues/3117
https://github.com/nodejs/node/issues/44261
How often does it reproduce? Is there a required condition?
100% reproducible
What is the expected behavior? Why is that the expected behavior?
/mnt/smb is a CIFS-mounted volume.
sample.docx is a file with read-only permissions for the user running the below code.
Code
import {copyFile} from "fs/promises";
const src = "./sample.docx";
const dest = "/mnt/smb/sample.docx";
await copyFile(src, dest);
console.log("File copied successfully");
The fs.copyFile should be able to succeed in copying the file as long as the destination folder is writable.
What do you see instead?
Error
node:internal/modules/run_main:123
triggerUncaughtException(
^
[Error: EPERM: operation not permitted, copyfile './sample.docx' -> '/mnt/smb/sample.docx'] {
errno: -1,
code: 'EPERM',
syscall: 'copyfile',
path: './sample.docx',
dest: '/mnt/smb/sample.docx'
}
Additional information
Works with no error
cp ./sample.docx /mnt/smb/sample.docx
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne am fs/promises-Einstiegspunkt copyFile und reproduziere den Fehler unter Linux mit einer schreibgeschützten Quelle und einem beschreibbaren CIFS-Ziel. Vergleiche das Verhalten von Node mit cp und lies anschließend die verknüpften Node.js- und libuv-Issues. Als erledigt gilt die Aufgabe, wenn copyFile unter den angegebenen Berechtigungen ohne den gemeldeten EPERM-Fehler erfolgreich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, linux, node.js
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100