@ai-ecoverse/slicc-kernel 1.146.2 → 1.146.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4059,10 +4059,9 @@ var init_wasi_fds = __esm({
4059
4059
  if (exclusive && !(oflags & OFLAGS.DIRECTORY) && this.madeAtOnce(path, mode)) {
4060
4060
  return this.regular(path, void 0, oflags, rights, fdflags, mode, true);
4061
4061
  }
4062
- if ((exclusive || nofollow) && this.isLink(path)) {
4063
- throw new WasiError(exclusive ? "EEXIST" : "ELOOP");
4064
- }
4065
- const s = this.statOrMissing(path);
4062
+ if (exclusive && !nofollow && this.isLink(path)) throw new WasiError("EEXIST");
4063
+ const s = nofollow ? this.lstatOrMissing(path) : this.statOrMissing(path);
4064
+ if (s?.isSymbolicLink) throw new WasiError(exclusive ? "EEXIST" : "ELOOP");
4066
4065
  if (exclusive && s) throw new WasiError("EEXIST");
4067
4066
  if (s?.escape !== void 0) {
4068
4067
  refuseWrite({ readonly: true }, oflags, rights);
@@ -4081,6 +4080,11 @@ var init_wasi_fds = __esm({
4081
4080
  return this.regular(path, s, oflags, rights, fdflags, mode);
4082
4081
  }
4083
4082
  nofollow = false;
4083
+ inos = /* @__PURE__ */ new WeakMap();
4084
+ otherFile(buffer, st) {
4085
+ const ino = this.inos.get(buffer);
4086
+ return ino !== void 0 && st?.ino !== void 0 && ino !== st.ino;
4087
+ }
4084
4088
  openSpecial(path, oflags, rights, fdflags, exclusive) {
4085
4089
  if (exclusive && namedDevice(path)) throw new WasiError("EEXIST");
4086
4090
  const device2 = deviceOf(path);
@@ -4138,6 +4142,7 @@ var init_wasi_fds = __esm({
4138
4142
  buffer = void 0;
4139
4143
  }
4140
4144
  buffer ??= this.sharing(path, existing);
4145
+ if (buffer && this.nofollow && this.otherFile(buffer, existing)) buffer = void 0;
4141
4146
  const want = wantOf(oflags, rights);
4142
4147
  if (buffer) {
4143
4148
  if (this.fs.owners) this.fs.access?.(path, want, "open");
@@ -4182,6 +4187,7 @@ var init_wasi_fds = __esm({
4182
4187
  const buffer = new FileBuffer(io, path, empty, st.maxFile, ranged, st.version, watch);
4183
4188
  buffer.moved = (missing2) => this.followRenames(missing2);
4184
4189
  buffer.handle = handle;
4190
+ if (st.ino !== void 0) this.inos.set(buffer, st.ino);
4185
4191
  this.buffers.set(path, buffer);
4186
4192
  const id = this.identity(st);
4187
4193
  if (id !== void 0) this.know(buffer, id);
@@ -4264,6 +4270,14 @@ var init_wasi_fds = __esm({
4264
4270
  return false;
4265
4271
  }
4266
4272
  }
4273
+ lstatOrMissing(path) {
4274
+ try {
4275
+ return this.fs.lstat(path);
4276
+ } catch (e) {
4277
+ if (e.code === "ENOENT") return void 0;
4278
+ throw e;
4279
+ }
4280
+ }
4267
4281
  statOrMissing(path) {
4268
4282
  try {
4269
4283
  return this.fs.stat(path);
@@ -7112,7 +7126,7 @@ var KERNEL_VERSION, OS_RELEASE;
7112
7126
  var init_version = __esm({
7113
7127
  "src/version.ts"() {
7114
7128
  "use strict";
7115
- KERNEL_VERSION = true ? "1.146.2" : "0.0.0-dev";
7129
+ KERNEL_VERSION = true ? "1.146.3" : "0.0.0-dev";
7116
7130
  OS_RELEASE = "6.0.0-slicc";
7117
7131
  }
7118
7132
  });