Skip to content

fix: extract tool archives as root-owned (TAR_OPTIONS=--no-same-owner) - #20

Merged
azlekov merged 1 commit into
mainfrom
fix/tar-no-same-owner
Sep 30, 2026
Merged

azlekov merged 1 commit into
mainfrom
fix/tar-no-same-owner

Conversation

@azlekov

@azlekov azlekov commented Sep 30, 2026

Copy link
Copy Markdown

Problem

Jobs in this image run as root. GNU tar run as root keeps the owner ids stored in an archive by default. subosito/flutter-action unpacks the Flutter SDK with tar xf into /opt/hostedtoolcache, so the SDK ends up owned by an unknown uid. The Flutter SDK is a git checkout and the flutter tool runs git on every invocation, so git refuses it and every flutter command fails:

fatal: detected dubious ownership in repository at '/opt/hostedtoolcache/flutter/stable-3.47.5-x64/flutter'

GitHub-hosted runners don't hit this because they run as a non-root user, and tar never preserves ownership for non-root.

Fix

ENV TAR_OPTIONS=--no-same-owner, so root extracts files as root. This matches what a non-root runner gets, and it covers every tarball-installed toolchain, not only Flutter.

Reproduced in ubuntu:24.04 (git 2.43.0): extracting an archive owned by uid 1234 as root gives owner=1234 and git fails with dubious ownership. With TAR_OPTIONS=--no-same-owner it gives owner=0 and git works.

Rejected

git config --system safe.directory '*'. git 2.43 has no prefix matching for safe.directory, so the only working value is the wildcard, which turns the ownership check off for every repository.

Rollout

The tool cache is not a volume, so after the new image is deployed the recreated containers start with a clean cache, and the next Flutter job extracts it with the right owner.

🤖 Generated with Claude Code

Jobs run as root, and GNU tar as root keeps the archive's owner ids, so toolchains unpacked into the tool
cache (the Flutter SDK via flutter-action) belong to an unknown uid and git refuses them with 'detected
dubious ownership': every flutter command exits 128. Reproduced on ubuntu 24.04 / git 2.43; with
--no-same-owner the files are root-owned and git works.

Rejected: safe.directory=* in the image's system gitconfig (git 2.43 has no prefix match, so it would
disable the ownership check for every repository).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@azlekov
azlekov merged commit 03940fb into main Sep 30, 2026
12 checks passed
@azlekov
azlekov deleted the fix/tar-no-same-owner branch September 30, 2026 18:10
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