Skip to content

Commit c30c28c

Browse files
madeyeclaude
andcommitted
Fix SIGPIPE in dpkg-deb content checks
With set -o pipefail, grep -q exits immediately on first match, causing dpkg-deb to receive SIGPIPE and return non-zero. This made the pipeline fail even when the pattern was found. The effect was position-dependent: patterns matching early entries (usr/bin/) always failed, while later entries (usr/share/man/) sometimes succeeded because dpkg-deb finished writing before grep exited. Fix by using grep >/dev/null instead of grep -q, which keeps reading the pipe until dpkg-deb finishes naturally. Also remove debug output from previous commits. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5545f74 commit c30c28c

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

tests/test_deb_build.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ check_fail() {
4040
# Verifies that at least one file matching PATTERN exists in the .deb
4141
check_file_in_deb() {
4242
local deb="$1" pattern="$2" desc="$3"
43-
if dpkg-deb -c "$deb" | grep -qE "$pattern"; then
43+
# Avoid grep -q: with pipefail, early grep exit causes SIGPIPE on dpkg-deb
44+
if dpkg-deb -c "$deb" | grep -E "$pattern" >/dev/null; then
4445
check_pass "$desc"
4546
else
4647
check_fail "$desc"
@@ -123,12 +124,6 @@ if [ "$FAIL_COUNT" -gt 0 ]; then
123124
fi
124125

125126
# Main package: binaries
126-
echo " DEBUG: DEB_MAIN=$DEB_MAIN"
127-
ls -la "$DEB_MAIN" || true
128-
echo " DEBUG: dpkg-deb --info:"
129-
dpkg-deb --info "$DEB_MAIN" 2>&1 | head -10 || true
130-
echo " DEBUG: dpkg-deb -c (stderr+stdout) first 30 lines:"
131-
dpkg-deb -c "$DEB_MAIN" 2>&1 | head -30 || true
132127
for bin in ss-local ss-server ss-redir ss-tunnel ss-manager; do
133128
check_file_in_deb "$DEB_MAIN" "usr/bin/${bin}" "$bin binary in main package"
134129
done

0 commit comments

Comments
 (0)