Windows tar cannot overwrite read-only files
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
C:\Windows\System32\tar.exe fails when an archive extraction needs to overwrite existing files with the read-only attribute. This creates problems in the cache action: https://github.com/actions/cache/issues/198
To Reproduce
Trigger this GitHub workflow two times:
on: push
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: List read-only files
run: Get-ChildItem .git -Recurse -Attributes ReadOnly
- uses: actions/cache@v2
with:
key: break-me
path: .git
The cache action fails on the second run, with tar reporting "Can't unlink already-existing object" errors referring to the read-only files.
Expected behavior
On the second run, the cache action should restore from the key with no errors.
Additional context
The system tar is selected in preference to GNU tar, which works as expected when --force-local option is used. GNU tar is installed in the Windows virtual environment as part of the Git toolkit and its full path name is "C:\Program Files\Git\usr\bin\tar.exe".
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 with packages/cache/src/internal/tar.ts, especially the system-tar preference, then reproduce the provided Windows workflow twice on windows-latest. Compare the system tar and GNU tar behavior described in the issue; done means the second cache restore completes without "Can't unlink already-existing object" errors when read-only files are present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github-actions, typescript
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100