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

Self-Hosted Runner using Window's find.exe instead of unix-style find.exe in git bin #786

Open
dskvr opened this issue Nov 3, 2020 · 6 comments
Labels
bug Something isn't working Runner Bug Bug fix scope to the runner

Comments

@dskvr
Copy link

dskvr commented Nov 3, 2020

Describe the bug
Receive the following error when trying to use find

"FIND: Parameter format not correct"

When opening Git Bash and running the same code, it executes as expected.

  • The error only occurs when there's an active job.
  • Other paths are working as expected.
  • Default shell is set explicitly to bash and the step where this code is executed does not override that.

To Reproduce
find . -type f -name *.tar.gz

Expected behavior
For the unix style script to work.

Runner Version and Platform

Runner Version: 2.273.6
OS: Windows 10 (current)

What's not working?

find

I tried to look into how a runner sets up its environment variables but there was no documentation on the subject.

@dskvr dskvr added the bug Something isn't working label Nov 3, 2020
@dskvr dskvr changed the title Runner using Find.exe instead of unix-style find Self-Hosted Runner using Find.exe instead of unix-style find Nov 3, 2020
@TingluoHuang
Copy link
Member

@dskvr can you try the following?

  • where do you set the default shell to bash, can you paste some job log and workflow yaml?
  • try print out %PATH% during the build
  • run where find or which find during the build

@dskvr
Copy link
Author

dskvr commented Nov 3, 2020

Edit: Updated results from correct platform.

Explicitly Set (because other workflows are cmd, maintainer communications)

defaults:
  run:
    shell: bash

The following

    - shell: cmd
      run: ECHO %PATH%
    - run: |
       echo "Path: $PATH"
       echo "Where: $(where find)"
       echo "Which: $(which find)"

Produced

# bash shell in runnner
Run ECHO %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git LFS;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files\Amazon\AWSCLI\bin\;C:\Program Files\7-Zip;C:\Users\***\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\***\AppData\Local\Programs\Python\Python38-32\;C:\Users\***\AppData\Local\Microsoft\WindowsApps;C:\Users\***\AppData\Local\GitHubDesktop\bin
0s
Run echo "Path: $PATH"
Path: /c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/Git LFS:/cmd:/mingw64/bin:/usr/bin:/c/ProgramData/chocolatey/bin:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Microsoft Windows Performance Toolkit:/c/Program Files/Amazon/AWSCLI/bin:/c/Program Files/7-Zip:/c/Users/***/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Users/***/AppData/Local/Programs/Python/Python38-32:/c/Users/***/AppData/Local/Microsoft/WindowsApps:/c/Users/***/AppData/Local/GitHubDesktop/bin
Where: C:\Windows\System32\find.exe
C:\Program Files\Git\usr\bin\find.exe
Which: /c/Windows/system32/find

@TingluoHuang
Copy link
Member

@dskvr what if you open the git-bash and print out $PATH? I assume it modifies the environment.
Sorry, I don't have a windows machine around.

@dskvr
Copy link
Author

dskvr commented Nov 3, 2020

Reminder: find works correctly when directly called from git bash on runner.

# git bash terminal on runner 
$ echo "Path: $PATH"
Path: /c/Users/***/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/***/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/Git LFS:/cmd:/mingw64/bin:/usr/bin:/c/ProgramData/chocolatey/bin:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/Microsoft Windows Performance Toolkit:/c/Program Files/Amazon/AWSCLI/bin:/c/Program Files/7-Zip:/c/Users/***/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Users/***/AppData/Local/Programs/Python/Python38-32:/c/Users/***/AppData/Local/Microsoft/WindowsApps:/c/Users/***/AppData/Local/GitHubDesktop/bin:/usr/bin/vendor_perl:/usr/bin/core_perl

$ echo "Where: $(where find)"
Where: C:\Program Files\Git\usr\bin\find.exe
C:\Windows\System32\find.exe

$ echo "Which: $(which find)"
Which: /usr/bin/find

So it appears that the path is flipped around. Potentially similar to cygwin issue mentioned here?

Sorry, I don't have a windows machine around.

No worries

@dskvr dskvr changed the title Self-Hosted Runner using Find.exe instead of unix-style find Self-Hosted Runner using Window's find.exe instead of unix-style find.exe in git bin Nov 3, 2020
@dskvr
Copy link
Author

dskvr commented Dec 9, 2020

@TingluoHuang Has there been any developments on this? Curious if it's replicable. I spun up a new runner and the same thing is happening. I'm calling the full path directly as a workaround (windows only), but it makes a mess of things in the multi-platform matrix.

@ruvceskistefan ruvceskistefan added the Runner Bug Bug fix scope to the runner label Mar 31, 2022
@virzak
Copy link

virzak commented Aug 28, 2023

I might have had a similar issue with act.

Act on windows picks up wsl bash instead of git bash.

I wrote to GITHUB_PATH and stuff worked for me.

- name: Set path for nektos/act
  if: ${{ runner.os  == 'Windows' && env.ACT }}
  run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH
  shell: '"C:\Program Files\Git\bin\bash.exe" -c {0}'

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

No branches or pull requests

4 participants