Skip to content

Commit 9ca6eea

Browse files
author
Matthew Valancy
committed
fix: replace bash string substitution with POSIX tr command
Replaced with tr-based sanitization for POSIX sh compatibility. This fixes 'Bad substitution' error on systems using dash or older sh implementations.
1 parent 801ee54 commit 9ca6eea

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

scripts/test-installation-simple.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ test_distro() {
5656
local image=$1
5757
local name=$2
5858
local pkg_mgr=$3
59-
59+
60+
# Create sanitized name for filenames (POSIX-compliant)
61+
local name_sanitized=$(printf '%s' "$name" | tr ' ' '_')
62+
6063
TOTAL=$((TOTAL + 1))
6164
echo "${CYAN}${NC} Testing $name ($image)..."
62-
65+
6366
# Create test directory
6467
local test_dir="/tmp/graphdone-test-$TIMESTAMP"
6568
mkdir -p "$test_dir"
@@ -86,9 +89,9 @@ EOF
8689
if docker run --rm \
8790
-v "$test_dir:/test:ro" \
8891
"$image" \
89-
sh /test/test.sh > "$REPORT_DIR/${name// /_}.log" 2>&1; then
90-
91-
if grep -q "INSTALLATION_SCRIPT_TEST: SUCCESS" "$REPORT_DIR/${name// /_}.log"; then
92+
sh /test/test.sh > "$REPORT_DIR/$name_sanitized.log" 2>&1; then
93+
94+
if grep -q "INSTALLATION_SCRIPT_TEST: SUCCESS" "$REPORT_DIR/$name_sanitized.log"; then
9295
echo "${GREEN}${NC} $name - PASSED"
9396
PASSED=$((PASSED + 1))
9497
TEST_RESULTS="${TEST_RESULTS}PASS|$name

0 commit comments

Comments
 (0)