@biffo/cli 0.304.2 → 0.304.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.
- package/package.json +1 -1
- package/scripts/verify.sh +37 -0
package/package.json
CHANGED
package/scripts/verify.sh
CHANGED
|
@@ -75,6 +75,38 @@
|
|
|
75
75
|
|
|
76
76
|
set -u
|
|
77
77
|
|
|
78
|
+
# Orphaned-scratch backstop (#1930). Every check below that creates a temp
|
|
79
|
+
# dir/file already cleans it up inline on its own pass/fail paths (an
|
|
80
|
+
# explicit `rm -rf`/`rm -f`, sometimes a per-function trap) -- that cleanup is
|
|
81
|
+
# left exactly as it is, as defensive belt-and-braces. What none of them cover
|
|
82
|
+
# is verify.sh itself dying abnormally (SIGTERM from a CI timeout, an
|
|
83
|
+
# interrupted local Ctrl-C, `kill`) partway through one of those functions,
|
|
84
|
+
# before its own inline cleanup line is reached. `gitleaks_tracked_only`'s
|
|
85
|
+
# `_gl_dir` has the largest such window: mirror-copy every tracked file, then
|
|
86
|
+
# a full `gitleaks detect` run, all between the `mktemp -d` and the `rm -rf`
|
|
87
|
+
# that only fires if the function returns normally.
|
|
88
|
+
#
|
|
89
|
+
# That gap is exactly what accumulated hundreds of stale `bt-verify`,
|
|
90
|
+
# `biffo-template-verify`, `dev-check-*` and `tmp.*` scratch dirs in /tmp with
|
|
91
|
+
# no eviction, driving it to 100% inode usage and breaking every `fleet.sh`
|
|
92
|
+
# command that writes a temp file.
|
|
93
|
+
#
|
|
94
|
+
# Idiom matches the other trap-using scripts in this directory
|
|
95
|
+
# (`js-dependency-audit.sh`, `shared-sync.sh`): accumulate every path this run
|
|
96
|
+
# creates in one variable, and let a single EXIT/HUP/INT/TERM trap sweep all
|
|
97
|
+
# of them however the script leaves. Declared here, at the very top, so the
|
|
98
|
+
# trap has a function to call no matter how early an abnormal exit happens.
|
|
99
|
+
_VERIFY_TMP_PATHS=""
|
|
100
|
+
_verify_track_tmp() {
|
|
101
|
+
_VERIFY_TMP_PATHS="$_VERIFY_TMP_PATHS $1"
|
|
102
|
+
}
|
|
103
|
+
_verify_cleanup_tmp() {
|
|
104
|
+
# shellcheck disable=SC2086 -- word-splitting is the point: one or more
|
|
105
|
+
# space-separated paths accumulated over the run.
|
|
106
|
+
[ -n "$_VERIFY_TMP_PATHS" ] && rm -rf $_VERIFY_TMP_PATHS
|
|
107
|
+
}
|
|
108
|
+
trap _verify_cleanup_tmp EXIT HUP INT TERM
|
|
109
|
+
|
|
78
110
|
LIST=""
|
|
79
111
|
[ "${1:-}" = "--list" ] && LIST=1
|
|
80
112
|
|
|
@@ -537,6 +569,7 @@ run_check() {
|
|
|
537
569
|
return 0
|
|
538
570
|
fi
|
|
539
571
|
start=$(date +%s)
|
|
572
|
+
_verify_track_tmp "/tmp/biffo-verify.$$"
|
|
540
573
|
if "$@" >"/tmp/biffo-verify.$$" 2>&1; then
|
|
541
574
|
PASSED="$PASSED $name"
|
|
542
575
|
LAST_CHECK_SECONDS=$(($(date +%s) - start))
|
|
@@ -651,6 +684,7 @@ run_check_js() {
|
|
|
651
684
|
return 0
|
|
652
685
|
fi
|
|
653
686
|
start=$(date +%s)
|
|
687
|
+
_verify_track_tmp "/tmp/biffo-verify.$$"
|
|
654
688
|
if "$@" >"/tmp/biffo-verify.$$" 2>&1; then
|
|
655
689
|
PASSED="$PASSED $name"
|
|
656
690
|
LAST_CHECK_SECONDS=$(($(date +%s) - start))
|
|
@@ -1027,6 +1061,7 @@ pg_xdist_ready() {
|
|
|
1027
1061
|
|
|
1028
1062
|
pg_test_run() {
|
|
1029
1063
|
_out="/tmp/biffo-verify-pg.$$"
|
|
1064
|
+
_verify_track_tmp "$_out"
|
|
1030
1065
|
_pg_started=$(date +%s)
|
|
1031
1066
|
|
|
1032
1067
|
if pg_xdist_ready "$1"; then
|
|
@@ -1287,6 +1322,7 @@ else
|
|
|
1287
1322
|
echo pg_test_run "$_pg_dir" "$_pg_rel"
|
|
1288
1323
|
else
|
|
1289
1324
|
_pg_check_start=$(date +%s)
|
|
1325
|
+
_verify_track_tmp "/tmp/biffo-verify-pg-check.$$"
|
|
1290
1326
|
# shellcheck disable=SC2086
|
|
1291
1327
|
pg_test_run "$_pg_dir" "$_pg_rel" >"/tmp/biffo-verify-pg-check.$$" 2>&1
|
|
1292
1328
|
_pg_check_rc=$?
|
|
@@ -1567,6 +1603,7 @@ fi
|
|
|
1567
1603
|
# existing path-based `.gitleaks.toml` allowlist entries keep working unchanged.
|
|
1568
1604
|
gitleaks_tracked_only() {
|
|
1569
1605
|
_gl_dir=$(mktemp -d "${TMPDIR:-/tmp}/biffo-gitleaks.XXXXXX") || return 1
|
|
1606
|
+
_verify_track_tmp "$_gl_dir"
|
|
1570
1607
|
_gl_root=$(git rev-parse --show-toplevel) || {
|
|
1571
1608
|
rm -rf "$_gl_dir"
|
|
1572
1609
|
return 1
|