@ai-ecoverse/slicc-kernel 1.196.51 → 1.196.52

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.
@@ -9480,7 +9480,7 @@ var init_version = __esm({
9480
9480
  "src/version.ts"() {
9481
9481
  "use strict";
9482
9482
  init_captured_globals();
9483
- KERNEL_VERSION = true ? "1.196.51" : "0.0.0-dev";
9483
+ KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
9484
9484
  OS_RELEASE = "6.0.0-slicc";
9485
9485
  }
9486
9486
  });
@@ -9479,7 +9479,7 @@ var init_version = __esm({
9479
9479
  "src/version.ts"() {
9480
9480
  "use strict";
9481
9481
  init_captured_globals();
9482
- KERNEL_VERSION = true ? "1.196.51" : "0.0.0-dev";
9482
+ KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
9483
9483
  OS_RELEASE = "6.0.0-slicc";
9484
9484
  }
9485
9485
  });
package/dist/node.js CHANGED
@@ -7874,7 +7874,7 @@ function satisfies(version, range2) {
7874
7874
  }
7875
7875
 
7876
7876
  // src/version.ts
7877
- var KERNEL_VERSION = true ? "1.196.51" : "0.0.0-dev";
7877
+ var KERNEL_VERSION = true ? "1.196.52" : "0.0.0-dev";
7878
7878
  var OS_RELEASE = "6.0.0-slicc";
7879
7879
  function procVersion() {
7880
7880
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -36713,7 +36713,7 @@ var OpfsFs = class {
36713
36713
  if (!missing6(err)) throw err;
36714
36714
  });
36715
36715
  }
36716
- async commitPrivateCopy(from, to, root, intent, copies, emptyBackup) {
36716
+ async commitPrivateCopy(from, to, root, intent, copies, emptyBackup, lock) {
36717
36717
  const { ino, ...owner } = root;
36718
36718
  const entries = await this.meta.get([from, to]);
36719
36719
  let mark = entries[0];
@@ -36726,7 +36726,7 @@ var OpfsFs = class {
36726
36726
  mark
36727
36727
  );
36728
36728
  }
36729
- if (!emptyBackup) await this.releaseSource(intent, from, to, mark.ino);
36729
+ if (!emptyBackup) await this.releaseSource(intent, from, to, mark.ino, lock);
36730
36730
  this.movePending(from, to);
36731
36731
  await this.restamp(to, copies);
36732
36732
  this.changed(from, to);
@@ -36818,13 +36818,18 @@ var OpfsFs = class {
36818
36818
  if (signal) await this.locks.request(key, { signal }, remove);
36819
36819
  else await this.locks.request(key, remove);
36820
36820
  }
36821
- async duplicate(handle, parent, name2, copies, rest2) {
36822
- if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
36823
- await copies.manifest?.record(await copiedEntry(handle, rest2));
36821
+ async duplicate(handle, parent, name2, copies, rest2, vacantOnly = false) {
36822
+ if (handle.kind === "file")
36823
+ return this.copyBytes(handle, parent, name2, { copies, vacantOnly }, rest2);
36824
+ if (vacantOnly && await this.handleExists(parent, name2)) throw fsError("EEXIST", name2);
36824
36825
  const dir = await this.io(parent.getDirectoryHandle(name2, { create: true }));
36825
36826
  this.others++;
36827
+ await this.duplicateContents(handle, dir, copies, rest2, vacantOnly);
36828
+ }
36829
+ async duplicateContents(handle, dir, copies, rest2, vacantOnly = false) {
36830
+ await copies.manifest?.record(await copiedEntry(handle, rest2));
36826
36831
  for await (const child2 of handle.values())
36827
- await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name);
36832
+ await this.duplicate(child2, dir, child2.name, copies, rest2 + "/" + child2.name, vacantOnly);
36828
36833
  }
36829
36834
  hiddenBackups = /* @__PURE__ */ new Set();
36830
36835
  pendingSources = /* @__PURE__ */ new Map();
@@ -36966,6 +36971,49 @@ var OpfsFs = class {
36966
36971
  }
36967
36972
  await this.dropSwapIntent(intent, backup);
36968
36973
  }
36974
+ async vacantLegacyGeneration(from, to, generation) {
36975
+ const [mark, ...parents2] = await (this.meta.fresh ?? this.meta.get).call(this.meta, [
36976
+ from,
36977
+ ...prefixes(parentOf11(to))
36978
+ ]);
36979
+ return mark?.vacated === true && mark.ino === generation && !mark.copyCommit && !parents2.some((p) => p?.vacated || p?.link !== void 0) && (await this.meta.under(to)).length === 0;
36980
+ }
36981
+ async resumeVacantLegacy(intent, rename, generation) {
36982
+ const { from, to, root } = rename;
36983
+ const stage = /^\..+\.[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;
36984
+ if (!root || rename.replace || stage.test(baseOf4(from)) || stage.test(baseOf4(to))) return false;
36985
+ const source = await this.swapEntry(from), parent = await this.swapEntry(parentOf11(to));
36986
+ if (source?.kind !== "directory" || parent?.kind !== "directory") return false;
36987
+ const name2 = baseOf4(to);
36988
+ const target = await this.locked(to, async () => {
36989
+ if (!await this.vacantLegacyGeneration(from, to, generation) || await this.handleExists(parent, name2))
36990
+ return void 0;
36991
+ return parent.getDirectoryHandle(name2, { create: true });
36992
+ });
36993
+ if (!target) return false;
36994
+ for await (const _ of target.keys()) return false;
36995
+ const copies = new Copies(this.meta, intent);
36996
+ await this.meta.remove([manifestRoot(intent)]);
36997
+ try {
36998
+ await this.duplicateContents(source, target, copies, "", true);
36999
+ } catch (err) {
37000
+ if (err.code === "EEXIST") return false;
37001
+ throw err;
37002
+ }
37003
+ await copies.manifest?.flush();
37004
+ if (!await this.vacantLegacyGeneration(from, to, generation) || (await this.root.resolve(source))?.join("/") !== from.slice(1) || (await this.root.resolve(target))?.join("/") !== to.slice(1))
37005
+ return false;
37006
+ await this.commitPrivateCopy(
37007
+ from,
37008
+ to,
37009
+ { ...root, ino: generation },
37010
+ intent,
37011
+ copies,
37012
+ void 0,
37013
+ rename.lock
37014
+ );
37015
+ return true;
37016
+ }
36969
37017
  async resumeCopiedTree(intent, rename) {
36970
37018
  const { from, to, root } = rename;
36971
37019
  const [mark, placed] = await this.meta.get([from, to]);
@@ -36974,16 +37022,16 @@ var OpfsFs = class {
36974
37022
  return this.releaseSource(intent, from, commit.to, mark.ino, rename.lock);
36975
37023
  }
36976
37024
  if (mark?.vacated && mark.ino !== void 0 && mark.ino !== root?.ino) {
36977
- if (!mark.copyCommit)
36978
- return this.releaseSource(
36979
- intent,
36980
- from,
36981
- to,
36982
- mark.ino,
36983
- rename.lock,
36984
- !root || placed?.ino !== root.ino
36985
- );
36986
- return this.retireIntent(intent);
37025
+ if (mark.copyCommit) return this.retireIntent(intent);
37026
+ if (!placed && await this.resumeVacantLegacy(intent, rename, mark.ino)) return;
37027
+ return this.releaseSource(
37028
+ intent,
37029
+ from,
37030
+ to,
37031
+ mark.ino,
37032
+ rename.lock,
37033
+ !root || placed?.ino !== root.ino
37034
+ );
36987
37035
  }
36988
37036
  const left = await this.real(from);
36989
37037
  await this.meta.remove([manifestRoot(intent)]);
@@ -37250,6 +37298,7 @@ var OpfsFs = class {
37250
37298
  async copyBytes(handle, dir, name2, options, rest2) {
37251
37299
  const file = await this.io(handle.getFile());
37252
37300
  await options.copies?.manifest?.record(await copiedEntry(handle, rest2, file));
37301
+ if (options.vacantOnly && await this.handleExists(dir, name2)) throw fsError("EEXIST", name2);
37253
37302
  const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
37254
37303
  const writable3 = await this.io(made2.createWritable());
37255
37304
  try {