Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Which command should handle broken symlinks #2150

@dhadka

Description

@dhadka

Describe the bug

https://github.com/actions/runner/blob/main/src/Runner.Sdk/Util/WhichUtil.cs should detect and ignore broken symlinks. This should be considered a bug as calling the native which command will detect and ignore the broken symlink.

To Reproduce

See https://github.com/dhadka/repro-broken-symlink/actions/runs/3106185147/jobs/5032737959 for an example. Here I'm creating a broken symlink for pwsh and then trying to run Powershell using shell: pwsh and through bash with run: pwsh -Command ....

shell: pwsh fails because it's using the custom WhichUtil implementation, matches the broken symlink, and fails with An error occurred trying to start process '/usr/local/bin/pwsh' with working directory '/home/runner/work/repro-broken-symlink/repro-broken-symlink'. No such file or directory

run: pwsh -Command ... works fine as it uses the system's which command that ignores the broken symlink.

Expected behavior

If the target of the symlink does not exist, WhichUtil should skip it and locate any other matches on the PATH.

Runner Version and Platform

Latest Version

OS of the machine running the runner? Ubuntu

What's not working?

See repro above.

Job Log Output

See repro above.

Runner and Worker's Diagnostic Logs

N/A

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions