Virtual-environments: The PATH has changed on Windows, and the Git shell tar is used instead of Windows tar

Created on 28 Feb 2020  路  16Comments  路  Source: actions/virtual-environments

Describe the bug

The PATH has changed on Windows in the last 24 hours.
https://github.com/ruby/setup-ruby/issues/28 has all the details.

Basically, any tar command ran on Windows now uses
C:\Program Files\Git\usr\bin\tar.exe
instead of previously
C:\windows\system32\tar.exe.

That includes actions/tool-cache's extractTar().

The first tar.exe seems mostly broken with Windows-like paths, and gives

"C:\Program Files\Git\usr\bin\tar.exe" xz -C C:\Users\runneradmin\.rubies -f d:\a\_temp\faffe4a1-577f-4d8d-912c-b897e86696ba
tar (child): Cannot connect to d: resolve failed

We can see the PATH changed in
https://github.com/ruby/jruby-dev-builder/runs/470590213?check_suite_focus=true (working)
https://github.com/ruby/jruby-dev-builder/runs/473104647?check_suite_focus=true (failing)
Differences:

--- a/old
+++ b/new
@@ -8,10 +8,12 @@ C:\hostedtoolcache\windows\Boost\1.72.0
 C:\Program Files\dotnet
 C:\mysql-5.7.21-winx64\bin
 C:\Program Files\Java\zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64\bin
+C:\SeleniumWebDrivers\GeckoDriver
 C:\Program Files (x86)\sbt\bin
 C:\Rust\.cargo\bin
 C:\Go1.12.7\bin
 C:\Program Files\Git\bin
+C:\Program Files\Git\usr\bin
 C:\hostedtoolcache\windows\Python\3.7.6\x64\Scripts
 C:\hostedtoolcache\windows\Python\3.7.6\x64
 C:\npm\prefix
@@ -24,10 +26,10 @@ C:\windows\System32\OpenSSH\
 C:\ProgramData\Chocolatey\bin
 C:\Program Files\Docker
 C:\Program Files\PowerShell\6\
-C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
 C:\Program Files\dotnet\
 C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
 C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
+C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
 C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code
 C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager
 C:\Program Files\nodejs\
@@ -39,11 +41,11 @@ C:\Program Files (x86)\sbt\bin
 C:\Program Files (x86)\Subversion\bin
 C:\SeleniumWebDrivers\ChromeDriver\
 C:\SeleniumWebDrivers\EdgeDriver\
-C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.2\bin
+C:\ProgramData\chocolatey\lib\maven\apache-maven-3.6.3\bin
 C:\Program Files\CMake\bin
 C:\Strawberry\c\bin
 C:\Strawberry\perl\site\bin
 C:\Strawberry\perl\bin
 C:\Program Files\OpenSSL\bin
 C:\Users\runneradmin\.dotnet\tools
-C
+C:\Pro

Area for Triage:

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • [ ] macOS 10.15
  • [ ] Ubuntu 16.04 LTS
  • [ ] Ubuntu 18.04 LTS
  • [ ] Windows Server 2016 R2
  • [x] Windows Server 2019

Expected behavior

extractTar() and tar in the default shell should work on Windows with Windows paths (e.g., C:...).

Actual behavior

It breaks as shown above.

Common Tools DeploymenRelease Windows bug

Most helpful comment

@eregon yeah, that makes sense. We've rolled back the changes and will deliver the fixed image next week.

All 16 comments

Gist with the full output for PATH before and after:
https://gist.github.com/eregon/1f1e0d4171cdaa162da0998df5f1f6d2

The last entry, C:\Pro (and C before) look weird.

@eregon it's the result of
https://github.com/actions/virtual-environments/issues/282 and https://github.com/actions/virtual-environments/pull/415
Windows tar.exe can't untar xz archives, unfortunately.

And Git's tar cannot deal with Windows paths with a drive name, which seems an even larger problem as tar no longer work in the default shell.
How should this be solved then?

@eine is it critical for you to use tar instead of 7z?

Another bug of the Git shell tar is, if the archive contains foo.exe and foo, it only extracts one of them and just ignores the other one!
That was extremely confusing in https://github.com/MSP-Greg/ruby-setup-ruby/issues/1
My advice is therefore: never use the Git shell tar.

@eregon yeah, that makes sense. We've rolled back the changes and will deliver the fixed image next week.

@eregon The changes have been delivered. Closing the issue, but feel free to reopen if you have any concerns.
Thank you!

Is there now no tar built-in support? I am getting tar: command not found in bash script sections running on both vs2017 amd macOS-10.15 images.

@ihnorton hmm, both work just fine for me now.

jobs:
  job1:
    runs-on: vs2017-win2016
    steps:
      - uses: actions/checkout@v2
      - name: check tar
        run: |
          tar --version
        shell: bash
  job2:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - name: check tar
        run: |
          tar --version
        shell: bash

My mistake, thanks.

The issue persists in windows-2016, see https://github.com/actions/cache/issues/333. Please reopen.

@Holzhaus , It is expected behavior for windows-2016 image.
WindowsServer 2016 doesn't contain Windows tar. It is distributed by Windows itself and was added only in Windows2019.
So on Windows 2016 there is no any other tar except Git Tar.

So on Windows 2016 there is no any other tar except Git Tar.

@maxim-lobanov, MSYS2's tar is also available on either Windows 2016 or Windows 2019, isn't it?

@eine , as far as I know, actions/cache doesn't work with MSYS tar: https://github.com/actions/toolkit/issues/632

So actions/cache is completely non-functional on windows-2016 because there is no tar.exe that can work with windows paths?

@Holzhaus, I suggest subscribing to actions/toolkit#632.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamsiembida picture adamsiembida  路  3Comments

jayaddison picture jayaddison  路  3Comments

zackijack picture zackijack  路  3Comments

damccorm picture damccorm  路  3Comments

trajano picture trajano  路  3Comments