Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error-spam if PATH includes a non-existent drive #1028

Open
benoithudson opened this issue Feb 3, 2025 · 2 comments
Open

error-spam if PATH includes a non-existent drive #1028

benoithudson opened this issue Feb 3, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@benoithudson
Copy link

Description:
My PATH includes a path on the D: drive. I no longer have a D: drive. This causes a bunch of error spam in my build logs.

Action version:
actions/setup-python@v5

Platform:

  • [x ] Windows

Runner type:

  • [x ] Self-hosted

Tools version:
runner 2.321

Repro steps:

  1. PATH includes a drive that doesn't exist. E.g. in my case D:\Program Files\Perforce but there's no D: drive.
  2. Github YML:
        uses: actions/setup-python@v5
        with:
          python-version: "3.10"

Expected behavior:
The script silently looks for powershell in another castle (just like it silently ignores all the other paths that don't have powershell inside).

Actual behavior:

Version 3.10 was not found in the local cache
  Version 3.[10](https://github.com/[REDACTED]) is available for downloading
  Download from "https://github.com/actions/python-versions/releases/download/3.10.[11]([REDACTED])-11114431484/python-3.10.11-win32-x64.zip"
  Extract downloaded archive
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.COM': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.COM'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.EXE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.EXE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.BAT': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.BAT'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.CMD': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.CMD'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.VBS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.VBS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.VBE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.VBE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.JS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.JS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.JSE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.JSE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.WSF': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.WSF'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.WSH': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.WSH'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\pwsh.MSC': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\pwsh.MSC'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.COM': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.COM'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.EXE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.EXE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.BAT': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.BAT'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.CMD': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.CMD'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.VBS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.VBS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.VBE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.VBE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.JS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.JS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.JSE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.JSE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.WSF': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.WSF'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.WSH': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.WSH'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.MSC': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.MSC'
  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'E:\actions-runner\_work\_temp\python-3.10.11-win32-x64.zip' -DestinationPath 'E:\actions-runner\_work\_temp\e46b37f5-3822-4202-b[19]([REDACTED])f-33e8b0077f1e' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('E:\actions-runner\_work\_temp\python-3.10.11-win32-x64.zip', 'E:\actions-runner\_work\_temp\e46b37f5-3822-4[20]([REDACTED])2-b19f-33e8b0077f1e', $true) }"
  Execute installation script
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.COM': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.COM'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.EXE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.EXE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.BAT': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.BAT'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.CMD': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.CMD'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.VBS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.VBS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.VBE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.VBE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.JS': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.JS'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.JSE': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.JSE'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.WSF': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.WSF'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.WSH': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.WSH'
  Unexpected error attempting to determine if executable file exists 'D:\Program Files\Perforce\powershell.MSC': Error: UNKNOWN: unknown error, stat 'D:\Program Files\Perforce\powershell.MSC'
  Check if Python hostedtoolcache folder exist...
  
  Check if current Python version is installed...
  
  Python3.10 (x64) was found in E:\actions-runner\_work\_tool\Python...
  
  Deleting E:\actions-runner\_work\_tool\Python\3.10.11\x64...
  
  Remove registry entries for Python 3.10(x64)...
@benoithudson benoithudson added bug Something isn't working needs triage labels Feb 3, 2025
@priyagupta108
Copy link
Contributor

Hi @benoithudson 👋,
Thank you for your report. We'll investigate the issue and get back to you with the details!

@priyagupta108 priyagupta108 self-assigned this Feb 4, 2025
@priyagupta108
Copy link
Contributor

Hi @benoithudson 👋,
Thank you for your report. We attempted to reproduce the issue but were unable to do so.
The setup-python action uses the extractZip function from the actions/toolkit to extract downloaded ZIP archives. This function relies on PowerShell to handle the extraction and searches for the powershell.exe executable in the system’s PATH environment variable.

However, issues arise when the PATH variable contains references to non-existent directories or drives. These invalid paths can cause confusion and errors, especially when trying to execute programs or scripts that depend on the paths listed in the PATH variable.

Leaving invalid paths in the PATH variable is not ideal. It's best practice to clean up the PATH to prevent unnecessary confusion, save system resources, and avoid potential failures in scenarios where the executable (e.g., PowerShell) cannot be located in any valid paths.

To address this problem, it's crucial to remove invalid or non-existent paths from the PATH variable. There are two main approaches to permanently clean up the PATH:

  • Option 1: Manually Clean the PATH in Windows: You can manually clean the PATH variable using the Environment Variables settings in Windows.

  • Option 2: Automated Cleanup via PowerShell Script: If you prefer an automated method, you can use a PowerShell script to clean up the PATH variable permanently on the system. For more information, you can refer to the official Microsoft documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants