@feigi/fleet-ctl 3.29.7 → 3.29.8
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.
- package/package.json +1 -1
- package/scripts/derive-testcmd.sh +24 -11
- package/scripts/recipe-prove.mjs +8 -6
package/package.json
CHANGED
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
# Exit status: 0 the command is printed; 1 a refusal about the cache, the
|
|
48
48
|
# repository or the arguments; 3 a tool this script needs to read the cache
|
|
49
49
|
# (git, node, mktemp, cat) could not be started, mktemp could not create its
|
|
50
|
-
# temp file, git did not run to an answer,
|
|
51
|
-
#
|
|
50
|
+
# temp file, git did not run to an answer, node died mid-read, or node exited
|
|
51
|
+
# non-zero with no reason and a status other than 2, its only verdict on the
|
|
52
|
+
# cache, so nothing was read and the cache's usability is unknown.
|
|
52
53
|
set -eu
|
|
53
54
|
|
|
54
55
|
# Byte semantics for every construct below that reads a string by bytes:
|
|
@@ -98,10 +99,10 @@ die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 1; }
|
|
|
98
99
|
# A refusal about the environment, not the cache: a tool this script needs to
|
|
99
100
|
# read the cache (git, the interpreter, mktemp, cat) could not be started,
|
|
100
101
|
# mktemp could not create its temp file, git did not run to an answer, or the
|
|
101
|
-
# interpreter died mid-read, so nothing was read
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
# difference.
|
|
102
|
+
# interpreter died mid-read or failed without a reason, so nothing was read
|
|
103
|
+
# and the cache's usability is unknown. Exit 3,
|
|
104
|
+
# where every refusal about the cache, the repository or the arguments is
|
|
105
|
+
# exit 1. A consumer that only tests for non-zero sees no difference.
|
|
105
106
|
unrunnable() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 3; }
|
|
106
107
|
|
|
107
108
|
# Named once: every refusal that sends the caller to re-derive names the same
|
|
@@ -229,6 +230,8 @@ process.stdout.write(open + value + close);
|
|
|
229
230
|
# node's own refusal of the cache is exit 2 (an uncaught fault is exit 1), the
|
|
230
231
|
# reason on stderr either way; a status of 126 or above is the shell failing to
|
|
231
232
|
# run node or the system killing it mid-read, which says nothing about the cache.
|
|
233
|
+
# Only status 2 is node's verdict on the cache: every check above refuses
|
|
234
|
+
# through `bad`, so any other status is a fault outside those checks.
|
|
232
235
|
if [ "$rc" -ge 126 ]; then
|
|
233
236
|
unrunnable "node did not finish reading the Recipe cache (exit $rc), so its usability is unknown"
|
|
234
237
|
fi
|
|
@@ -244,16 +247,26 @@ fi
|
|
|
244
247
|
# which `set -u` then trips on) fails the substitution, and the `||` names that
|
|
245
248
|
# in the reason instead of aborting on the shell's own error, which under dash
|
|
246
249
|
# would also be an exit outside 0/1/3. A stderr that was read back but held
|
|
247
|
-
# nothing, only newlines, or only blanks (spaces, tabs, CRs)
|
|
248
|
-
# status instead of a reason that reads as blank
|
|
249
|
-
#
|
|
250
|
-
#
|
|
250
|
+
# nothing, only newlines, or only blanks (spaces, tabs, CRs) is no reason: with
|
|
251
|
+
# status 2 it names the exit status instead of a reason that reads as blank;
|
|
252
|
+
# with any other status node failed and said nothing about the cache, so its
|
|
253
|
+
# usability is unknown and that is exit 3.
|
|
254
|
+
# The blank set is spelled out, not a `[:space:]` class: this script's locale
|
|
255
|
+
# inventory stays what the pin comment above says it is. The `.` guards the
|
|
256
|
+
# newline that `$(…)` would strip.
|
|
251
257
|
if [ "$rc" -ne 0 ]; then
|
|
252
258
|
reason=$({ while IFS= read -r line || [ -n "$line" ]; do printf '%s\n' "$line"; done <"$errf"; } 2>/dev/null) ||
|
|
253
259
|
reason="(node's reason could not be read back from $errf)"
|
|
254
260
|
blank=$(printf ' \t\r\n.')
|
|
255
261
|
blank=${blank%.}
|
|
256
|
-
case $reason in
|
|
262
|
+
case $reason in
|
|
263
|
+
*[!"$blank"]*) ;;
|
|
264
|
+
*)
|
|
265
|
+
[ "$rc" -eq 2 ] ||
|
|
266
|
+
unrunnable "node exited $rc without a reason, so its usability is unknown — an environment fault, not a verdict on the cache"
|
|
267
|
+
reason="(node gave no reason, exit $rc)"
|
|
268
|
+
;;
|
|
269
|
+
esac
|
|
257
270
|
die "the Recipe cache at $cache is unusable: $reason — $derive"
|
|
258
271
|
fi
|
|
259
272
|
carriedmsg="node's stdout carried more than the framed Recipe value — expected exactly the value between '$open' and '$close', got '$framed'. The cache at $cache passed validation; the extra output comes from how node is launched here (a version-manager or proxy shim, a preload), and is refused rather than cut out of the command"
|
package/scripts/recipe-prove.mjs
CHANGED
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
// included, or that git started and could not run; the reader's `sh`,
|
|
64
64
|
// `node`, `mktemp` or `cat` could not be started, its `mktemp` could
|
|
65
65
|
// not create its temp file, its `sh` was killed by a signal, or its
|
|
66
|
-
// `node` died mid-read
|
|
67
|
-
//
|
|
68
|
-
// written). The log
|
|
69
|
-
// removed.
|
|
66
|
+
// `node` died mid-read or exited without a reason and a status other
|
|
67
|
+
// than 2 — a `cat` that ran and failed stays the reader's refusal,
|
|
68
|
+
// exit 1; the cache or its temp file could not be written). The log
|
|
69
|
+
// directory under $TMPDIR is removed.
|
|
70
70
|
|
|
71
71
|
import { spawnSync } from "node:child_process";
|
|
72
72
|
import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -120,7 +120,8 @@ const notProven = (message) => new Refusal(1, message);
|
|
|
120
120
|
|
|
121
121
|
// The exit status derive-testcmd.sh uses for a refusal about its own
|
|
122
122
|
// environment — a tool it needs would not start, git did not run to an answer,
|
|
123
|
-
// or node died mid-read
|
|
123
|
+
// or node died mid-read or failed without a reason —
|
|
124
|
+
// where every refusal about the cache is 1.
|
|
124
125
|
const READER_COULD_NOT_RUN = 3;
|
|
125
126
|
|
|
126
127
|
function parseArgs(argv) {
|
|
@@ -300,7 +301,8 @@ function prove(o, wt, logs) {
|
|
|
300
301
|
// status and reached no verdict; a reader that exits READER_COULD_NOT_RUN
|
|
301
302
|
// could not start its git, `node`, `mktemp` or `cat`, could not create its
|
|
302
303
|
// temp file, saw git end on any status but git's own 128, or lost its `node`
|
|
303
|
-
// mid-read
|
|
304
|
+
// mid-read or saw it exit without a reason on a status other than 2; and the
|
|
305
|
+
// reader reads a git that ends on 128 as no repository at
|
|
304
306
|
// all, so its refusal is a verdict on what was proven only while git still
|
|
305
307
|
// runs. `git --version` is the probe for that exit-1 refusal: a working git
|
|
306
308
|
// always passes it, so a git that cannot be started fails it, and so does one
|