Skip to content

[BUG] Using tar on Windows should call $env:WINDIR/System32/tar and not the Git bash provided /usr/bin/tar #205

@cderv

Description

@cderv

Describe the bug

Recent change introduced the use of tar on Windows

Currently, it is calling tar through PowerShell using the program name only, thus relying on PATH resolution.

It happens that /usr/bin/tar is used (probably from Git Bash) and not the Windows internal $env:WINDIR/System32/tar.exe.
This is known to happen on github action (at least encountered in the past)

I encountered this because by modifying temp folder to be {{ runner.temp }} on Windows, it leads to having tar dealing with Windows path name with network drive letter. Only Windows's tar can handle that.

This is the issue I encountered using setup-julia action

$ Run julia-actions/setup-julia@v1.9.5
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "tar xf D:\a\_temp\f585e5f8-9502-4dc6-9544-d8ebf784ca06 --strip-components=1 -C C:\hostedtoolcache\windows\julia\1.10.0\x64"
/usr/bin/tar: Cannot connect to D: resolve failed
Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
  • This shows that /usr/bin/tar is the own throwing the error
  • The error is linked to network drive letter. It happens because in my context, Temp folder is modified to use {{ runner.temp }} which is on D: and it tries to untar on C:.

To Reproduce

I can create a simple example reproducing the Can't connect error but this is not the main issue I would like to report here. I believe any action using 1.9.5 is calling the /usr/bin/tar instead of Window's tar.exe

If you would like a workflow file anyway, I can provide.

Expected behavior

Windows' own tar is used when using tar on Windows, which allows to correctly handle Windows paths.

This change ensures it is, and it solves issue I encountered

diff --git a/dist/index.js b/dist/index.js
index 74d0f94..8acd5f4 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -268,7 +268,7 @@ function installJulia(dest, versionInfo, version, arch) {
                 }
                 else {
                     // This is the more common path. Using .tar.gz is much faster
-                    yield exec.exec('powershell', ['-Command', `tar xf ${juliaDownloadPath} --strip-components=1 -C ${dest}`]);
+                    yield exec.exec('powershell', ['-Command', `& "$env:WINDIR/System32/tar" xf ${juliaDownloadPath} --strip-components=1 -C ${dest}`]);
                 }
                 return dest;
             case 'darwin':

(I modified in Fork in dist by convenience for testing.

Screenshots/Build logs

With current 1.9.5

image

With a fork using Windows' tar

image

Additional context

Nothing more I can think of.

Happy to provide anything more needed. Please do tell me.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions