@attraccess/plugin-wago 0.1.0-nightly.1107.1 → 0.1.0-nightly.1114.1

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7087,15 +7087,33 @@ wago_probe_privileges`;
7087
7087
  // backend/runtime/supervisor.ts
7088
7088
  function wagoRuntimeSupervisorLaunchShell() {
7089
7089
  return `${wagoShellStat()}
7090
+ # A live supervisor publishes ready into every supervisor-start.* that lacks it.
7091
+ # Removing a request in place races that: rm unlinks ready, the supervisor
7092
+ # writes it again, and rmdir fails with "Directory not empty". Move the request
7093
+ # out of that name first. Writers address it by its old path, so they now fail
7094
+ # instead of refilling the directory that is being removed. The destination is
7095
+ # reserved before the request exists: a same-directory rename and removal need
7096
+ # no new inode, so a full configuration filesystem cannot strand the request.
7097
+ retire_runtime_supervisor_request() {
7098
+ mv "$supervisor_launch" "$supervisor_retired/request" || return 1
7099
+ rm -rf "$supervisor_retired"
7100
+ }
7090
7101
  launch_runtime_supervisor() {
7091
7102
  supervisor_failure_stage=prerequisites
7092
7103
  command -v nohup >/dev/null && command -v sleep >/dev/null || return 1
7093
7104
  test -f "$hook" && test ! -L "$hook" &&
7094
7105
  test "$(stat -c '%u:%g:%a:%h' "$hook")" = 0:0:700:1 || return 1
7095
- supervisor_launch=$(mktemp -d "$config/supervisor-start.XXXXXX") || return 1
7106
+ supervisor_retired=$(mktemp -d "$config/supervisor-retired.XXXXXX") || return 1
7107
+ if ! supervisor_launch=$(mktemp -d "$config/supervisor-start.XXXXXX"); then
7108
+ rm -rf "$supervisor_retired"
7109
+ return 1
7110
+ fi
7096
7111
  # Caller rollback must never run without its transaction lock. Retain its
7097
7112
  # traps privately and restore them only after reacquiring that same lock.
7098
- trap > "$supervisor_launch/traps" || return 1
7113
+ if ! trap > "$supervisor_launch/traps"; then
7114
+ retire_runtime_supervisor_request
7115
+ return 1
7116
+ fi
7099
7117
  trap - EXIT
7100
7118
  supervisor_interrupted=0
7101
7119
  # Defer a catchable interruption until rollback can again own install.lock.
@@ -7132,7 +7150,7 @@ launch_runtime_supervisor() {
7132
7150
  supervisor_wait_remaining=300
7133
7151
  if ! { test -f "$config/install.lock" && test ! -L "$config/install.lock" &&
7134
7152
  test "$(stat -c '%u:%g:%a:%h' "$config/install.lock")" = 0:0:600:1; }; then
7135
- rm -rf "$supervisor_launch"
7153
+ retire_runtime_supervisor_request
7136
7154
  trap - EXIT HUP INT TERM
7137
7155
  echo 'Runtime supervisor handoff lock unverified; recovery required' >&2
7138
7156
  exit 75
@@ -7140,7 +7158,7 @@ launch_runtime_supervisor() {
7140
7158
  exec 9<>"$config/install.lock"
7141
7159
  until flock -n 9; do
7142
7160
  if test "$supervisor_wait_remaining" -le 0 || ! sleep 2; then
7143
- rm -rf "$supervisor_launch"
7161
+ retire_runtime_supervisor_request
7144
7162
  # Leave recovery ownership intact. Neither the caller nor its outer boot
7145
7163
  # wrapper may roll back a different transaction while this lock is held.
7146
7164
  trap - EXIT HUP INT TERM
@@ -7168,7 +7186,7 @@ launch_runtime_supervisor() {
7168
7186
  (exec 8<>"$config/supervisor.lock"; ! flock -n 8); then supervisor_live=1; fi ;;
7169
7187
  esac
7170
7188
  fi
7171
- rm -rf "$supervisor_launch" || return 1
7189
+ retire_runtime_supervisor_request || return 1
7172
7190
  test "$supervisor_live" = 1
7173
7191
  }
7174
7192
  launch_runtime_supervisor || fail "Runtime supervisor launch unverified: $supervisor_failure_stage"`;
@@ -8315,7 +8333,11 @@ received=0
8315
8333
  while test "$received" -lt "$limit"; do
8316
8334
  chunk=$((limit - received))
8317
8335
  if test "$chunk" -gt 65536; then chunk=65536; fi
8318
- dd bs="$chunk" count=1 >> "$file" 2>/dev/null || exit 1
8336
+ # dd writes into a pipe, never into the file: some dd builds (uutils on newer
8337
+ # Ubuntu) truncate a regular-file stdout, which would undo an append redirect.
8338
+ # dd's own status comes back on fd 3 because there is no pipefail.
8339
+ dd_status=$( { { dd bs="$chunk" count=1 2>/dev/null; echo "$?" >&3; } | cat >> "$file"; } 3>&1 ) || exit 1
8340
+ test "$dd_status" = 0 || exit 1
8319
8341
  # The outer filesystem guard already positively identified this stat ABI.
8320
8342
  # One metadata process per input block avoids the guarded capture pipeline
8321
8343
  # (and its byte-at-a-time dd) on every short SSH pipe read. This is our own
@@ -10126,7 +10148,7 @@ async function processOutput(command, args, input, signal, environment = {}, fil
10126
10148
  if (errorBytes > 16384) stop();
10127
10149
  else errors.push(chunk);
10128
10150
  });
10129
- child.stdin.on("error", () => stop());
10151
+ child.stdin.on("error", () => void 0);
10130
10152
  let stream;
10131
10153
  child.stdin.write(input, () => {
10132
10154
  if (file && !failed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attraccess/plugin-wago",
3
- "version": "0.1.0-nightly.1107.1",
3
+ "version": "0.1.0-nightly.1114.1",
4
4
  "description": "Attraccess integration for WAGO CC100 controllers. Operational control only: not a safety function, and not yet qualified for physical use.",
5
5
  "keywords": [
6
6
  "attraccess-plugin",