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

hashfiles() expression function needs to handle symlink loop gracefully #234

Closed
TingluoHuang opened this issue Dec 18, 2019 · 11 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@TingluoHuang
Copy link
Member

When user has symlink loop in the folder they trying to hash, the runner will stuck on finding all files under the folder, the job will hang and user get no idea what's going wrong.

We need to detect the symlink loop, stop the recursion search and continue find other files.

@TingluoHuang TingluoHuang self-assigned this Dec 18, 2019
@TingluoHuang TingluoHuang added the bug Something isn't working label Dec 18, 2019
@joshmgross
Copy link
Member

The user reported issues:
actions/cache#95
actions/cache#132
(Not sure if both are symlink related)

@ericsciple
Copy link
Collaborator

it might be good to leverage the node toolkit to do the glob rather than maintain separate logic in c#

@joshmgross
Copy link
Member

joshmgross commented Dec 18, 2019

@ericsciple Since this is evaluated before the typescript action starts, how would we do that?

@ericsciple
Copy link
Collaborator

invoke node :)

nothing to do with any action. just bundle the required modules and invoke a node script to return a list of files paths

@ericsciple
Copy link
Collaborator

think of it as a command line tool

@TingluoHuang
Copy link
Member Author

+1 on invoke node.
dotnet doesn't support inspect symlink to find its target natively, we have to pinvoke to get the information.

@bryanmacfarlane
Copy link
Member

+1 - think of node / javascript as a good xplat runtime / cli

@dakale
Copy link
Contributor

dakale commented Jan 6, 2020

Im not sure globbing with node solves anything. Youll just get a list of files (some of which may be symlinks) and then when you try to hash them, wont you just follow the link to the target and hit the same issue? Although, there may be existing javascript implementations of things other than glob that could be leveraged

@TingluoHuang
Copy link
Member Author

dotnet doesn't have any api to deal with symlink, it always follow symlinks...

@dakale
Copy link
Contributor

dakale commented Jan 6, 2020

Yea, my follow up was going to be youd need to detect cycles in code (tarjans, or maybe a max stack depth), or with an existing node module, or shell out to a different tool other than node that can do this. Beyond that, I dont know what the correct behavior is for hashing files that contain cyclic links, but it seems like you probably wouldnt be able to

@joshmgross
Copy link
Member

The feature flag that this is behind has rolled out everywhere. Thanks @TingluoHuang!

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

5 participants