CreateLayout: TarWriter on Unix loses unix file permissions, breaking aspire-managed exec bit
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Problem
After switching `tools/CreateLayout` to use `System.Formats.Tar.TarWriter` on macOS (see related issue), bundle extraction succeeded but the CLI then failed at runtime with:
```
Permission denied: /root/.aspire/bundle/managed/aspire-managed
```
`System.Formats.Tar.PaxTarEntry` defaults `Mode` to `0`, which extracts as `0000` (no permissions). Files like `aspire-managed` (and any other executable payload in the bundle) lose their executable bit.
## Impact
Even with the macOS PAX header fix in place, `aspire init` and any other operation that invokes `aspire-managed` from the extracted bundle would fail with a permission-denied error.
## Fix (applied)
Explicitly set `entry.Mode = File.GetUnixFileMode(filePath)` for non-Windows entries in `tools/CreateLayout/Program.cs::CreateArchiveAsync` so the source file's unix permissions are preserved in the tar archive.
Branch: `davidfowl/js-monorepo-dockerfile` — commit `c210d7f6d` (same commit as the PAX fix; both are required for bundle extraction to work end-to-end on macOS hosts).
## Notes
This is a general gotcha when using `System.Formats.Tar.TarWriter` on Unix hosts: the writer does not pick up source file modes by default. Any other place in the codebase that writes tar archives via `TarWriter` should be audited for the same omission.
Contributor guide
Assessment
This issue has not been assessed yet.