Skip to content

fix(sail): fail archive action on tar errors#110

Merged
ALX99 merged 1 commit into
masterfrom
audit/sail-archive-pipeline-failure-20260722
Jul 23, 2026
Merged

fix(sail): fail archive action on tar errors#110
ALX99 merged 1 commit into
masterfrom
audit/sail-archive-pipeline-failure-20260722

Conversation

@ALX99

@ALX99 ALX99 commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Problem and impact

The Sail archive action pipes tar into zstd while enabling only Bash errexit. Pipeline status therefore comes from zstd, not tar. If an input disappears, is unreadable, or otherwise makes tar fail, zstd can still successfully compress the partial stream. The action then exits 0 and leaves a valid-looking but incomplete or empty .tar.zst file.

Reproduction and observed result

Validated against untouched master commit a7005ced78ddfcb7dc70e17a1fe29b88ecadc667 using the exact current .config/sail/actions/archive in an isolated temporary directory.

mkdir run && cd run
../archive-parent missing
printf 'status=%s\n' "$?"

Observed with GNU Bash 5.2.37, GNU tar 1.35, and zstd 1.5.7:

status=0
tar: missing: Cannot stat: No such file or directory
archive_exists=yes
archive_size=22
archive_listing=<empty>

Expected: a nonzero status and no archive output.

Root cause and fix

set -e does not make a failing non-final pipeline command determine the pipeline status. The fix enables pipefail, so tar failures propagate, and installs a top-level ERR trap that removes the selected output name if either pipeline command fails. The trap is cleared after a successful archive.

Validation commands and results

The same reproduction against the fixed script produced:

status=2
archive_exists=no

A nearby successful case still created an archive containing:

input/
input/file.txt

The following checks passed:

bash -n .config/sail/actions/archive
shellcheck .config/sail/actions/archive   # ShellCheck 0.10.0
git diff --check master...HEAD
git diff --name-status master...HEAD      # M .config/sail/actions/archive
git log --oneline master..HEAD            # exactly one commit

Scope and risk

Only .config/sail/actions/archive changes: three additions and one replacement. Archive naming, timestamp collision behavior, input ordering, tar format, zstd settings, and successful output remain unchanged. No tests, fixtures, temporary harnesses, generated files, dependency changes, credentials, or unrelated edits are committed.

A direct fresh clone was attempted but the sandbox could not resolve github.com; the branch was created from the verified current master SHA through the GitHub integration, and reproduction used the exact connector-fetched parent and committed file contents.

@ALX99
ALX99 marked this pull request as ready for review July 23, 2026 23:48
@ALX99
ALX99 merged commit 1b6bab5 into master Jul 23, 2026
4 checks passed
@ALX99
ALX99 deleted the audit/sail-archive-pipeline-failure-20260722 branch July 23, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant