Select GNU tar for caching if available on hosted runners
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
BSD tar has been problematic for the caching action for several reasons:
-
bsdtardoes not handle recursive directory structures created by junction points - https://github.com/actions/cache/issues/315 -
bsdtardoes not work withzstdcompression, causing the process to hang - https://github.com/actions/cache/issues/301 -
Changing the
PATHwill cause the cache to switch between BSD tar and GNU tar causing compatibility issues on Windows (due to thezstdcompression bug) - https://github.com/actions/cache/issues/465 -
BSD tar on MacOS corrupting executables and
.dylibfiles - https://github.com/actions/cache/issues/460 and https://github.com/actions/cache/issues/403
On hosted runners, tar.exe is available in several locations locations:
- BSD tar -
C:\Windows\System32\tar.exe(Windows 2019 only) - GNU tar -
C:\Program Files\Git\usr\bin\tar.exe - GNU tar -
C:\msys64\usr\bin\tar.exe
Caching correctly selects GNU tar on Windows 2016 runners, since (2) shows up on the PATH. Windows 2019 runners use BSD tar because (1) shows up first on the PATH. (3) does not appear on the system PATH so it is never selected.
Given the problems with bsdtar, it seems we should either ensure GNU tar appears first on the system PATH or improve the lookup logic in the caching module to find GNU tar. Right now, a workaround is to explicitly set the system PATH:
- name: Use GNU Tar from Msys
if: ${{ runner.os == 'Windows' }}
run: |
echo "::add-path::C:\msys64\usr\bin"
Expected behavior
GNU tar is selected if it is available.
Desktop (please complete the following information):
- OS: Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the caching module's tar lookup and how Windows runners resolve tar.exe. Verify the behavior against the listed GNU tar locations and existing Windows cache behavior; done means GNU tar is selected whenever it is available without relying on a PATH workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100