-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Open
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
- Version: 14.5.0
- Platform: Win10 x64
- Subsystem: fs
What is the expected behavior?
A similar issue #22577 has been closed 2 years ago, but the issue hasn't been fixed.
Node.js cannot read the stats
of immutable files (files with all permissions denied) on Windows. I'm not talking about the contents, just the stats.
Example:
After you deny all permissions to a file (to protect it from being deleted or modified), the default Windows File Explorer can still read the file's stats (name, size, etc) but Node.js throws EPERM: operation not permitted, lstat
:
> icacls E:\test.txt /deny *S-1-1-0:(F)
This command effectively denies all modification permissions (delete, rename, write) for Everyone (*S-1-1-0
).
What do you see instead?
Windows 10:
> icacls E:\test.txt /deny *S-1-1-0:(D)
> node
> fs.lstatSync('E:\\test.txt')
Uncaught Error: EPERM: operation not permitted, lstat 'E:/test.txt'
at Object.lstatSync (fs.js:1033:3) {
errno: -4048,
syscall: 'lstat',
code: 'EPERM',
path: 'E:/test.txt'
}
Linux ubuntu 20.01:
> sudo chattr +i /home/user/Desktop/test.txt
> node
> fs.lstatSync('/home/user/Desktop/test.txt')
Stats {
dev: 2053,
mode: 33206,
nlink: 1,
uid: 1000,
gid: 1000,
rdev: 0,
blksize: 4096,
ino: 263860,
size: 39881,
blocks: 80,
atimeMs: 1603884853571.3228,
mtimeMs: 1602542159686.156,
ctimeMs: 1603894615058.1975,
birthtimeMs: 1603842167648.6978,
atime: 2020-10-28T11:34:13.571Z,
mtime: 2020-10-12T22:35:59.686Z,
ctime: 2020-10-28T14:16:55.058Z,
birthtime: 2020-10-27T23:42:47.649Z
}
MacOS:
Haven't tested
TobiasFeld22, electrovir, GastonZalba, unional and aminya
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.