Skip to content

Commit 985dddb

Browse files
ChrisChris Thompson
Chris
and
Chris Thompson
authored
fix: default mode for symlinks should be 0o120000 not 0o666
Co-authored-by: Chris Thompson <chris@refinerylabs.io>
1 parent 9bc45eb commit 985dddb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/CacheFS.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ module.exports = class CacheFS {
228228
ino = oldStat.ino;
229229
} catch (err) {}
230230
if (mode == null) {
231-
mode = 0o666;
231+
mode = 0o120000;
232232
}
233233
if (ino == null) {
234234
ino = this.autoinc();

src/__tests__/fs.spec.js

+13
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,19 @@ describe("fs module", () => {
390390
});
391391
});
392392
});
393+
it("lstat for symlink creates correct mode", done => {
394+
fs.mkdir("/symlink", () => {
395+
fs.writeFile("/symlink/a.txt", "hello", () => {
396+
fs.symlink("/symlink/a.txt", "/symlink/b.txt", () => {
397+
fs.lstat("/symlink/b.txt", (err, stat) => {
398+
expect(err).toBe(null)
399+
expect(stat.mode).toBe(0o120000)
400+
done();
401+
});
402+
});
403+
});
404+
});
405+
});
393406
it("lstat doesn't follow symlinks", done => {
394407
fs.mkdir("/symlink", () => {
395408
fs.mkdir("/symlink/lstat", () => {

0 commit comments

Comments
 (0)