Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

Linux archives store the engine as root; install.sh extracts without changing owners (#94)

Lars Talian5acd24a0d99f
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 15f2cbc..f2e8a7e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -41,7 +41,9 @@ jobs:
if: runner.os != 'Windows'
run: |
mkdir -p dist
- tar -czf dist/reason-network-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release reason-network
+ # On Linux, owned by root (0:0), not the runner's user: tar run as root otherwise tries to give the file to that
+ # user. (The macOS archives are replaced by signed ones, and the runners' bsdtar may not take these flags.)
+ tar ${{ runner.os == 'Linux' && '--owner=0 --group=0 --numeric-owner' || '' }} -czf dist/reason-network-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release reason-network
cd dist && shasum -a 256 reason-network-${{ matrix.target }}.tar.gz > reason-network-${{ matrix.target }}.tar.gz.sha256
- name: Package (Windows)
if: runner.os == 'Windows'
diff --git a/install.sh b/install.sh
index b9d355b..9768509 100755
--- a/install.sh
+++ b/install.sh
@@ -69,7 +69,9 @@ else
got="$(sha256sum "$tmp/reason-network.tar.gz" | cut -d' ' -f1)"
fi
[ -n "$want" ] && [ "$want" = "$got" ] || die "checksum mismatch; not installing"
-tar -xzf "$tmp/reason-network.tar.gz" -C "$tmp"
+# As whoever runs this owns it, not as the archive says (releases up to v0.12.3 say 1001): as root, tar otherwise gives it
+# to that owner, which a restricted root (in a user namespace) can't.
+tar --no-same-owner -xzf "$tmp/reason-network.tar.gz" -C "$tmp"
"$tmp/reason-network" --version >/dev/null 2>&1 || die "the downloaded binary doesn't run here; not installing"
# macOS knows a program by its code signature when it asks whether it may reach the local network. A build signed by
# a developer team keeps that answer across updates; an unsigned one is a new program every time. So a signed