Skip to content

build(release): repack the Linux tarball with root ownership - #1003

Open
viwe-monai wants to merge 2 commits into
JetBrains:mainfrom
viwe-monai:fix/linux-tarball-ownership
Open

viwe-monai wants to merge 2 commits into
JetBrains:mainfrom
viwe-monai:fix/linux-tarball-ownership

Conversation

@viwe-monai

Copy link
Copy Markdown

Fixes #1002

Problem

thinkrail-desktop-linux-x64.tar.gz keeps the CI runner's UID/GID (1001:1001) on the archive's ./ entry. When the tarball is extracted as root — cd ~/ and tar -zxvf …, the normal flow from the README — GNU tar applies that ownership to the extraction directory itself:

drwxr-xr-x  27 1001 1001  4096 Oct 19 04:36   root

$HOME (or wherever it was unpacked) ends up owned by a UID that doesn't exist on the target host, which breaks SSH key login and any tool that checks home-directory permissions.

Fix

In build-binary/action.yml, after the Linux first-install artifact is staged (resolve-desktop), repack it with --owner=0 --group=0 --numeric-owner so every entry — including ./ — is root-owned and extracting is inert. Only the bun-linux-* targets are touched; the macOS .dmg and Windows .zip paths are unchanged.

The smoke step (smoke:desktop:installer) still runs against the repacked archive afterwards, so the repacked bytes are what gets exercised.

Verification

The repack idiom was exercised directly with GNU tar (including as an unprivileged user, since Actions runners are non-root — tar --owner=0 is honoured at create time):

$ tar -tvzf bad.tar.gz | head -1
drwxr-xr-x root/root         0 ./            # 1001:1001 in CI output

$ tar -xzf bad.tar.gz -C stage
$ tar -czf good.tar.gz --owner=0 --group=0 --numeric-owner -C stage .
$ tar -tvzf good.tar.gz | head -1
drwxr-xr-x 0/0               0 ./

The workflow YAML parses cleanly and the edited run: block passes bash -n.

The Electrobun packaging stamps the CI runner's UID/GID on the archive's
'./' entry, so extracting thinkrail-desktop-linux-x64.tar.gz as root
applies that ownership to the extraction directory itself — downloading
and unpacking in $HOME, the normal place, ends up owned by a UID that
does not exist on the target host and breaks SSH key login (JetBrains#1002).

Repack the Linux first-install archive with --owner=0 --group=0
--numeric-owner so extraction leaves the destination directory alone.

Fixes JetBrains#1002

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved — ready to merge.

Comment thread .github/actions/build-binary/action.yml
The release job now repacks the Linux first-install tarball with root
ownership (fix JetBrains#1002); updater archives are still passed through with
their bytes untouched. Update the handoff contract accordingly.

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes — please address the blocking inline finding.

# directory itself (breaking $HOME permissions for SSH key login,
# #1002). Repack with root ownership so extracting is inert.
stage=$(mktemp -d)
tar -xzf "$path" -C "$stage"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking:
Problem: The new extraction step breaks the existing release-collector fixtures, which contain plain text at the Linux tarball paths. tar -xzf exits 2 in all four Linux collection tests.
Failure scenario: The release-artifact suite now gets 21 passes and four failures (stable/nightly × x64/ARM64), versus 25 passes on the base. The required Unit Tests job runs this suite through bun run test, so the aggregate “CI passed” gate cannot succeed.
Suggested fix: Create real Linux setup tarballs in the fixtures and check their extracted contents instead of the previous text-sentinel equality; retain the updater byte-preservation checks.

This branch has not been deployed

No deployments
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.

Bug report: Linux release tarball changes ownership of the extraction directory (breaks SSH key login when extracted in $HOME)

1 participant