Skip to content

Commit a35ae9e

Browse files
fix(hack): make the seaweedfs naming audit POSIX sh
hack/seaweedfs-naming-audit.bats sources the audit script at top level, and cozytest.sh sources the converted test file into its own /bin/sh -- dash 0.5.12 on the Ubuntu CI runner. dash has no `pipefail`, so `set -uo pipefail` aborted the runner before the first @test and took the whole file down with it: hack/cozytest.sh: 48: set: Illegal option -o pipefail The bash shebang could not prevent this: `.` executes the file's contents in the caller's shell, so the shebang is only a comment there. The script was already POSIX apart from those two lines -- no arrays, no [[, no local, no bashisms at all -- so the script becomes POSIX sh rather than the runner becoming bash. That keeps the shell under test and the shell at run time the same one, instead of testing under dash while shipping under bash. Dropping `pipefail` changes no behaviour: the script never sets -e and never reads a pipeline's exit status, reporting failure as empty output checked with [ -n ... ]. Verified under dash (ubuntu:24.04): 11/11 tests pass, and the script runs clean against a live cluster, classifying five seaweedfs tenants with the revision-1 scheme and the PV ages agreeing on every MIXED case. shellcheck -s sh reports nothing. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent a38843c commit a35ae9e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎hack/seaweedfs-naming-audit.sh‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22
# SeaweedFS 4.31 rename — fleet audit (READ-ONLY).
33
#
44
# Classifies every SeaweedFS tenant into the three states the chart's naming guard
@@ -45,7 +45,15 @@
4545
# Usage: hack/seaweedfs-naming-audit.sh [namespace...]
4646
# KUBECONFIG=<file> hack/seaweedfs-naming-audit.sh
4747
# Exit: 0 always (audit only). Nothing is mutated.
48-
set -uo pipefail
48+
#
49+
# POSIX sh, deliberately. hack/seaweedfs-naming-audit.bats sources this file, and
50+
# cozytest.sh sources the converted test into its own /bin/sh — which is dash on
51+
# the CI runner. A bash shebang would not save it: `.` runs the file's contents in
52+
# the caller's shell and the shebang is just a comment. Keeping the script POSIX
53+
# is what makes the tested shell and the executed shell the same one; anything
54+
# bash-only here is untested in CI and unavailable at run time. `pipefail` in
55+
# particular is not POSIX and dash 0.5.12 (Ubuntu) rejects it outright.
56+
set -u
4957

5058
# renamed_volume_prefix <release> -- reconstruct the name 4.31 gives the volume
5159
# component of <release>. Mirrors seaweedfs.fullname + seaweedfs.componentName

0 commit comments

Comments
 (0)