Skip to content

fix(self-update): treat missing quarantine attribute as success#25

Merged
epodivilov merged 1 commit into
mainfrom
update-warning
Jun 22, 2026
Merged

fix(self-update): treat missing quarantine attribute as success#25
epodivilov merged 1 commit into
mainfrom
update-warning

Conversation

@epodivilov

Copy link
Copy Markdown
Owner

Problem

wt self-update prints a scary warning even on a fully successful update:

⚠ Could not remove macOS quarantine attribute (xattr: …/wt: No such xattr: com.apple.quarantine); macOS Gatekeeper may block the new binary until you run xattr -d com.apple.quarantine …/wt manually.

The binary is downloaded over HTTP, so macOS never stamps it with com.apple.quarantine in the first place. xattr -d then exits non-zero with No such xattr, which the code treated as a failure — surfacing a warning that tells the user to re-run a command that would fail the exact same way. The update itself succeeded; the warning is pure noise in the common case.

Fix

Extract the exit-code/stderr interpretation into a pure interpretXattrRemoval(exitCode, stderr) and treat a missing attribute (No such xattr, ENOATTR, attribute not found) as success. Genuine failures (missing xattr, unexpected non-zero exit) still surface the warning.

Tests

Added unit tests for interpretXattrRemoval covering: exit 0, missing-attribute variants → ok, and genuine failures → err (with stderr message / exit-code fallback). Full suite: 519 pass.

`xattr -d com.apple.quarantine` exits non-zero when the attribute is
absent. Because the binary is fetched over HTTP, macOS never stamps it
with the quarantine flag, so removal of a non-existent attribute is the
common case — yet it surfaced a misleading warning telling the user to
re-run a command that would fail the same way.

Extract `interpretXattrRemoval` and treat "No such xattr" (and
ENOATTR / "attribute not found") as success, keeping the warning only
for genuine failures (missing `xattr`, unexpected non-zero exit).
@epodivilov epodivilov merged commit 0638769 into main Jun 22, 2026
1 check passed
@epodivilov epodivilov deleted the update-warning branch June 22, 2026 11:00
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