Skip to content

Commit c82335d

Browse files
CopilotPDowney
andauthored
fix: add explicit realpath error handling and simplify tail failure branch in run-install-step.sh
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/ce151db2-a5fb-4c0f-b712-4f25546a58c1 Co-authored-by: PDowney <[email protected]>
1 parent ac9d741 commit c82335d

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ Changes are organized by date, with the most recent changes listed first.
66

77
## 2026-04-10
88

9+
### 🔧 CI RUN-INSTALL-STEP ERROR HANDLING IMPROVEMENTS
10+
11+
- Added explicit error handling for `realpath` when resolving `ALLOWED_INSTALL_DIR` in `scripts/ci/run-install-step.sh`; the script now exits with a descriptive message if the directory is not found or not resolvable instead of silently failing.
12+
- Added explicit error handling for `realpath` when resolving `ALLOWED_LOG_BASE_DIR`; the script now exits with a descriptive message if the current working directory path cannot be resolved.
13+
- Simplified the `tail` failure branch in the log-display logic: removed the redundant second `tail` read (which would fail for the same reason as the first) and replaced it with a plain exit-code message.
14+
15+
## 2026-04-10
16+
917
### 🐛 VHOST IMPORT LOGGING / EXTRACTION FLOW FIXES
1018

1119
- Removed a duplicate WordPress extraction block in `scripts/functions/vhost/vhost-import.sh` that re-ran archive extraction and wp-config path detection after those steps had already completed.

scripts/ci/run-install-step.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ TIMEOUT_SECONDS="$2"
1212
INSTALL_SCRIPT_PATH="$3"
1313
LOG_PATH="$4"
1414
INTEGER_REGEX='^[0-9]+$'
15-
ALLOWED_INSTALL_DIR="$(realpath "$(pwd)/scripts/ci")"
15+
if ! ALLOWED_INSTALL_DIR="$(realpath "$(pwd)/scripts/ci" 2>/dev/null)"; then
16+
echo "Error: allowed install directory not found or not resolvable: $(pwd)/scripts/ci" >&2
17+
exit 1
18+
fi
1619
CANONICAL_INSTALL_SCRIPT_PATH=""
1720
# `timeout` returns 124 when the wrapped command times out.
1821
TIMEOUT_EXIT_CODE=124
@@ -40,7 +43,10 @@ case "$CANONICAL_INSTALL_SCRIPT_PATH" in
4043
;;
4144
esac
4245

43-
ALLOWED_LOG_BASE_DIR="$(realpath "$(pwd)")"
46+
if ! ALLOWED_LOG_BASE_DIR="$(realpath "$(pwd)" 2>/dev/null)"; then
47+
echo "Error: unable to resolve current working directory path" >&2
48+
exit 1
49+
fi
4450
LOG_PARENT_DIR="$(dirname -- "$LOG_PATH")"
4551
LOG_FILENAME="$(basename -- "$LOG_PATH")"
4652

@@ -129,9 +135,7 @@ if [ "$SCRIPT_EXIT_CODE" -ne 0 ]; then
129135
echo "$TAIL_OUTPUT"
130136
else
131137
echo "Failed to display log file contents: $LOG_PATH"
132-
TAIL_ERROR_OUTPUT="$(tail -50 "$LOG_PATH" 2>&1 >/dev/null || true)"
133-
SANITIZED_TAIL_ERROR="$(printf '%s' "$TAIL_ERROR_OUTPUT" | tr '\n' ' ' | tr -cd '[:print:]\t ')"
134-
echo "tail error: ${SANITIZED_TAIL_ERROR:-unable to read log output}"
138+
echo "tail failed with exit code: $TAIL_EXIT_CODE"
135139
fi
136140

137141
exit 1

0 commit comments

Comments
 (0)