Skip to content

fix: resolve SIGPIPE false negative in installer library detection#2

Merged
logabell merged 1 commit intologabell:mainfrom
asa-degroff:fix/install-pipefail-sigpipe
Mar 8, 2026
Merged

fix: resolve SIGPIPE false negative in installer library detection#2
logabell merged 1 commit intologabell:mainfrom
asa-degroff:fix/install-pipefail-sigpipe

Conversation

@asa-degroff
Copy link
Copy Markdown
Contributor

Summary

  • The installer's have_shared_lib_soname uses ldconfig -p | grep -q to detect system libraries. grep -q exits on first match without consuming remaining input, which sends SIGPIPE to ldconfig -p (exit 141). Under set -o pipefail, the pipeline returns 141 instead of 0, causing the installer to report libraries as missing even when they are installed.
  • Replaced grep -q "$soname" with grep "$soname" >/dev/null 2>&1 so that grep consumes all of ldconfig's output before exiting, avoiding the broken pipe.

Reproduction

# With pipefail, the current check fails despite library being present:
$ bash -c 'set -o pipefail; ldconfig -p 2>/dev/null | grep -q "libayatana-appindicator3.so.1"; echo $?'
141

# Without -q, grep reads all input and exits cleanly:
$ bash -c 'set -o pipefail; ldconfig -p 2>/dev/null | grep "libayatana-appindicator3.so.1" >/dev/null 2>&1; echo $?'
0

Observed on Fedora 43 (glibc 2.41, bash 5.2, ldconfig cache ~1800 entries).

Test plan

  • Run bash -c 'set -euo pipefail; source install.sh' library detection on a system with appindicator installed — should now pass
  • Run full install.sh on a clean Fedora 40+/Ubuntu 24.04+ system

🤖 Generated with Claude Code

`grep -q` exits immediately after the first match without consuming the
rest of its input. When `ldconfig -p` is still writing to the pipe,
this causes SIGPIPE (exit 141). Under the script's `set -o pipefail`,
the pipeline returns 141 instead of 0, making `have_shared_lib_soname`
report libraries as missing even when they are installed.

Replace `grep -q` with `grep ... >/dev/null 2>&1` so grep reads all
input before exiting, avoiding the broken pipe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@logabell logabell merged commit 35054a9 into logabell:main Mar 8, 2026
1 check passed
@logabell
Copy link
Copy Markdown
Owner

logabell commented Mar 8, 2026

@asa-degroff Thank you for the PR, apologies for they delay in implementation. The new release 0.1.14 includes this change.

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.

3 participants