Skip to content

fix(cli): Install v3 on old glibc and make the installer POSIX sh - #2927

Merged
BYK merged 3 commits into
mainfrom
fix/installer-v3-fallback-sh-rerun
Dec 5, 2026
Merged

BYK merged 3 commits into
mainfrom
fix/installer-v3-fallback-sh-rerun

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2926.

  • Old glibc (below 2.28). The installer now installs v3 instead of stopping, unless a v4 version or nightly was asked for. A pinned version or nightly still stops with the 3.8.2 pin message. The v3 install hands off to the v3 steps of sentry.io/get-cli (SENTRY_CLI_VERSION=3.8.2), which install to SENTRY_INSTALL_DIR when it is set and to /usr/local/bin otherwise.
  • POSIX sh. packages/cli/install now runs under dash, BusyBox ash, and bash, so curl ... | sh works without bash. Bare Alpine needs only curl, and the installer prints apk add curl when it is missing.
    • Bash keeps the ERR trap, so its error reports still name the failing command, line, and function. Other shells report "Unexpected failure (exit N)" from the EXIT trap.
    • local stays: it is not POSIX, but dash, ash, bash, and zsh have it.
    • The /dev/tty handoff is tried in a subshell first, because a failed exec 3</dev/tty exits dash and ash.
    • pipefail is dropped.

Side effects of the v3 fallback:

  • Users get the sentry-cli command, not sentry.
  • get-cli's v3 steps exit with "sentry-cli is already installed" when sentry-cli is already at the install path.

The planned sentry-cli error shim for v4 installs must not be installed on this path, which installs the real sentry-cli 3.8.2.

Before and after, on CentOS 7:

before: Sentry CLI v4 needs glibc 2.28 or later, and this system has glibc 2.17. To install the last v3 release (sentry-cli) instead, run: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=3.8.2 sh
after:  Sentry CLI v4 needs glibc 2.28 or later, and this system has glibc 2.17. Installing the last v3 release, which runs as sentry-cli, not sentry.
        ...
        Successfully installed sentry-cli 3.8.2

And on Debian, where sh is dash:

before: curl -fsSL https://cli.sentry.dev/install | sh   # syntax error
after:  curl -fsSL https://cli.sentry.dev/install | sh   # installs sentry

via @BYK.

--

View Session [Sentry]

…rom sh

On glibc older than 2.28, install sentry-cli 3.8.2 through the v3 steps
of sentry.io/get-cli, unless a v4 version or nightly was asked for.

When run with sh and bash is available, rerun the installer with bash:
the local file when sh ran one, otherwise a fresh download, since sh may
already have read ahead in a piped script.
@sentry-junior
sentry-junior Bot requested a review from BYK December 5, 2026 04:18
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 5, 2026 4:42am UTC
sentry-local Ready Ready Preview Dec 5, 2026 4:42am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 5, 2026
Linux builds from 4.1.0 no longer link libatomic.

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we shouldn't try to redownload the installer. And if there's no blocker making this compatible with sh, we should just with that path

The installer now runs under dash, BusyBox ash, and bash, so
`curl ... | sh` works without bash and the installer no longer reruns
itself with bash or downloads itself again.

Bash keeps the ERR trap, which names the failing command, line, and
function. Other shells report an unexpected failure from the EXIT trap
with its exit status. `local` stays, since dash, ash, bash, and zsh have
it, with every assignment quoted. pipefail is dropped. The /dev/tty
handoff is probed in a subshell first, because a failed `exec 3<` exits
dash and ash. Without curl, the installer says to install it, naming
`apk add curl` on Alpine.

check-installer-libc.sh runs the installer with the image's sh.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title fix(cli): Install v3 on old glibc and rerun the installer with bash from sh fix(cli): Install v3 on old glibc and make the installer POSIX sh Dec 5, 2026
@sentry-junior

sentry-junior Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

Done in 3473989d1: the installer is POSIX sh now, so there's no rerun with bash and no second download. It runs under dash, BusyBox ash and bash; bare Alpine needs only apk add curl.

Tradeoffs:

  • Bash keeps the ERR trap, so its reports still name the failing command, line and function. Under other shells an unexpected failure is reported from the EXIT trap as "Unexpected failure (exit N)" only.
  • local stays (not POSIX, but dash, ash, bash and zsh have it), with every assignment quoted because dash splits local x=$1.
  • pipefail is dropped.
  • The /dev/tty handoff is tried in a subshell first, since a failed exec 3</dev/tty exits dash and ash.

via @BYK.

@BYK
BYK added this pull request to the merge queue Dec 5, 2026
Merged via the queue into main with commit 03a8679 Dec 5, 2026
53 of 54 checks passed
@BYK
BYK deleted the fix/installer-v3-fallback-sh-rerun branch December 5, 2026 05:19
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Dec 5, 2026
v4 installs only `sentry`. A v3 script that calls `sentry-cli` gets
"command not found". If the script saved a v4 binary as `sentry-cli`, it
runs v4 commands it wasn't written for. Both cases now fail the same
way: a message that says what changed, then exit code 1. It never runs
`sentry`.

Before:
```
$ sentry-cli releases new 1.0
sh: 1: sentry-cli: not found        # exit 127
```
After:
```
$ sentry-cli --version
Error: sentry-cli is now sentry. Sentry CLI v4 renamed the command and changed some commands and flags.
Update your scripts: https://cli.sentry.dev/migrating-from-v3/
Or stay on v3:
  npm:     npm install @sentry/cli@3
  pip:     pip install "sentry-cli<4"
  get-cli: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=3.8.2 sh
# exit 1
```

- **Binary:** `bin.ts` shows the message when the process runs as
`sentry-cli` or `sentry-cli.exe`. It checks `argv0` (the name the binary
was invoked as, which keeps a symlink's name) and the binary's own file
name. Run as `sentry`, nothing changes, and the hidden v3 aliases still
work. The npm package runs under `node`, so the check never fires there.
- **PyPI `sentry-cli`:** the wheels add a `sentry-cli` console script.
pip writes a launcher for it on every platform, `sentry-cli.exe` on
Windows.
- **npm `@sentry/cli` is left out on purpose.** A second bin would break
`npx @sentry/cli …` (npm: "could not determine executable to run") and
`pnpm dlx @sentry/cli …`, which run v4 `sentry` today.
- **get-cli (`install`)** comes in a follow-up, after
getsentry#2927.

The message and exit code live in `src/lib/sentry-cli-rename.ts`.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Af43004685b81a1275821d14a033373dd -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Af43004685b81a1275821d14a033373dd)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Af43004685b81a1275821d14a033373dd/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
BYK added a commit to getsentry/sentry that referenced this pull request Dec 5, 2026
> [!NOTE]
> getsentry/toolkit#2927 is merged and live:
https://cli.sentry.dev/install serves the POSIX sh installer as of CLI
4.2.0, so this is safe to merge. Before that, the bash installer it
served could not run under dash.

getsentry/toolkit#2927 ports the v4 installer to POSIX sh, so get-cli no
longer needs bash for v4. This runs the installer with `sh` and drops
the bash check. `curl -sL https://sentry.io/get-cli/ | sh` then works on
hosts without bash, such as Alpine and slim Debian images.

Pinned v3 installs (`SENTRY_CLI_VERSION` below 4) never needed bash and
are unchanged.

Before, on a host without bash:

```
$ curl -sL https://sentry.io/get-cli/ | sh
error: the Sentry CLI installer needs bash. Install bash, or run: npm install -g sentry
```

After:

```
$ curl -sL https://sentry.io/get-cli/ | sh
...
The Sentry CLI now runs as 'sentry' and replaces 'sentry-cli'.
$ sentry --version
4.2.0
```

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ab28bded1d64c2a093622ba9be2f2d0ea -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Ab28bded1d64c2a093622ba9be2f2d0ea)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ab28bded1d64c2a093622ba9be2f2d0ea/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <126780+BYK@users.noreply.github.com>

This branch was successfully deployed

2 active deployments
Preview – sentry-local — 3473989d Deployed Dec 5, 2026 by vercel[bot]
Preview – cli — 3473989d Deployed Dec 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant