question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Which command should handle broken symlinks

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nikola-jokiccommented, Oct 3, 2022

Thank you, @dhadka, for reporting this! I applied correct labels and added this issue to the board. ☺️

0reactions
fhammerlcommented, Apr 17, 2023

PR merged

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Find Broken Symlinks in Linux
Method 2: Use symlinks command to find broken symlinks. You can also use a dedicated command named symlinks to for handling dangling links....
Read more >
How can I find broken symlinks
Don't know about other shells. Most comprehensive (imho) command to find broken symlinks without crossing partition bounds. Note, that symlink ...
Read more >
Find And Delete Broken Symlinks In Linux
This brief tutorial explains how to find the broken symlinks and delete them on Linux using 'symlinks' utility and "find" command.
Read more >
Linux Commands – Find Broken Symlinks
1. Overview. In this tutorial, we'll see how to find broken symlinks using the find command in different forms.
Read more >
Broken symbolic links, how to find and remove them from ...
The command normally used to manage links (both harsh and symbolic) is ln. ... For remove the broken symbolic links, we will only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found