Fix GitHub Actions cache on Windows when the shell is Git bash - #1502
Open
rootkiller6788 wants to merge 1 commit into
Open
Fix GitHub Actions cache on Windows when the shell is Git bash#1502rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
GNU tar, the one Git for Windows puts on PATH when a step runs via
`C:\Program Files\Git\bin\bash.EXE`, treats a drive-lettered absolute path
like `D:\...` as a remote host. So saving and restoring cache tarballs
failed with:
tar error: Cannot connect to D: resolve failed
It also reads the backslashes in the `--files-from` manifest as escape
characters. BSD tar (System32) accepted both forms.
Run tar from the cache temp dir with relative file names, and write the
manifest with forward slashes. Fixes google#1242.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This one's from #1242.
#makeTarballand#extracthand absolute paths straight totar. When a Windows runner has Git for Windows on PATH (e.g. the step shell isC:\Program Files\Git\bin\bash.EXE), GNU tar reads a drive-lettered path likeD:\...as a remote host and dies with:It also treats the backslashes in the
--files-frommanifest as escape characters. BSD tar (the System32 one) accepts both forms, which is why this only bites when GNU tar wins the PATH race.Change is to run tar from inside the cache temp dir with relative file names, and to write the manifest with forward slashes. Both tar flavors are fine with that, and Linux/macOS behavior is unchanged.
Verified on Windows by putting Git's tar on PATH and running the
caches single filegithub-cache-fake test: it fails before this change and passes after.