@ai-ecoverse/slicc-kernel 1.94.2 → 1.94.4

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.
@@ -4245,6 +4245,8 @@ var UserDb = class {
4245
4245
  owners;
4246
4246
  umasks = /* @__PURE__ */ new Map();
4247
4247
  writing = Promise.resolve();
4248
+ stable;
4249
+ commits = 0;
4248
4250
  constructor(fs, owners = false) {
4249
4251
  this.fs = fs;
4250
4252
  this.owners = owners;
@@ -4280,11 +4282,18 @@ var UserDb = class {
4280
4282
  throw err;
4281
4283
  }
4282
4284
  }
4285
+ async texts() {
4286
+ for (; ; ) {
4287
+ if (this.stable) return this.stable;
4288
+ const commits = this.commits;
4289
+ const passwd = await this.read(PASSWD, DEFAULT_PASSWD);
4290
+ const group = await this.read(GROUP, DEFAULT_GROUP);
4291
+ if (this.commits === commits && !this.stable) return [passwd, group];
4292
+ }
4293
+ }
4283
4294
  async tables() {
4284
- return {
4285
- passwd: parsePasswd(await this.read(PASSWD, DEFAULT_PASSWD)),
4286
- group: parseGroup(await this.read(GROUP, DEFAULT_GROUP))
4287
- };
4295
+ const [passwd, group] = await this.texts();
4296
+ return { passwd: parsePasswd(passwd), group: parseGroup(group) };
4288
4297
  }
4289
4298
  async provision(row, umask, shared) {
4290
4299
  const dirs = 511 & ~umask | (shared ? 1024 : 0);
@@ -4303,15 +4312,25 @@ var UserDb = class {
4303
4312
  }
4304
4313
  }
4305
4314
  async commit(passwd, group, then) {
4306
- const before = [await this.read(PASSWD, DEFAULT_PASSWD), await this.read(GROUP, DEFAULT_GROUP)];
4315
+ const before = [
4316
+ await this.read(PASSWD, DEFAULT_PASSWD),
4317
+ await this.read(GROUP, DEFAULT_GROUP)
4318
+ ];
4319
+ this.stable = before;
4320
+ this.commits++;
4307
4321
  try {
4308
4322
  await this.fs.writeFile(GROUP, group);
4309
4323
  await this.fs.writeFile(PASSWD, passwd);
4324
+ this.stable = void 0;
4310
4325
  await then?.();
4311
4326
  } catch (err) {
4327
+ this.stable = before;
4312
4328
  await this.fs.writeFile(GROUP, before[1]);
4313
4329
  await this.fs.writeFile(PASSWD, before[0]);
4314
4330
  throw err;
4331
+ } finally {
4332
+ this.stable = void 0;
4333
+ this.commits++;
4315
4334
  }
4316
4335
  }
4317
4336
  serial(work) {
@@ -11693,7 +11712,7 @@ function mountTable(mounts = []) {
11693
11712
  }
11694
11713
 
11695
11714
  // src/version.ts
11696
- var KERNEL_VERSION = true ? "1.94.2" : "0.0.0-dev";
11715
+ var KERNEL_VERSION = true ? "1.94.4" : "0.0.0-dev";
11697
11716
  var OS_RELEASE = "6.0.0-slicc";
11698
11717
  function procVersion() {
11699
11718
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -12466,7 +12485,7 @@ var KernelLoopback = class {
12466
12485
  if (head.status !== 101) {
12467
12486
  throw errno(
12468
12487
  "EPROTO",
12469
- `the server answered ${head.status} ${head.statusText}, not an upgrade`
12488
+ `the server answered the upgrade with ${head.status}${head.statusText ? ` ${head.statusText}` : ""}`
12470
12489
  );
12471
12490
  }
12472
12491
  const upgraded = fieldTokens(head.headers, "upgrade").includes("websocket") && fieldTokens(head.headers, "connection").includes("upgrade");