Skip to content

Cache action shouldn't use first tar on the path #125

@wch

Description

@wch

The save and restore steps use the first tar on the path:

const tarPath = await io.which("tar", true);

This can cause problems if another step modifies the path so that a different version of tar is found first. For example, in this workflow, I installed R and Rtools, which added C:/Rtools/bin to the path. There is a copy of tar.exe in there, as well as gzip.exe. However, when actions/cache tries to use tar, it errors out saying it can't find gzip. I'm not sure why exactly that error happens, since gzip is in the same directory. But it seems to me that actions/cache shouldn't even try to use that copy of tar in the first place -- it should always use the same copy of tar, no matter what other steps are used in the workflow.

Here's the error:

Post job cleanup.
C:\Rtools\bin\tar.exe -cz --force-local -f d:/a/_temp/96241c04-a852-4c66-8b28-aae83ff432c1/cache.tgz -C d:/a/_temp/Library .
tar (child): gzip: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
/Rtools/bin/tar: d\:/a/_temp/96241c04-a852-4c66-8b28-aae83ff432c1/cache.tgz: Cannot write: Broken pipe
/Rtools/bin/tar: Child returned status 2
/Rtools/bin/tar: Error is not recoverable: exiting now
[warning]The process 'C:\Rtools\bin\tar.exe' failed with exit code 2

https://github.com/wch/gha/commit/b407b89c2865433ae99dc88f39830437cbd01887/checks?check_suite_id=346434710#step:22:8

Metadata

Metadata

Assignees

Labels

area:compressionduplicateThis issue or pull request already existswontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions