Skip to content

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

Closed

Description

@TingluoHuang

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.

Activity

  1. self-assigned this
    on Dec 18, 2019
  2. added
    bug
    on Dec 18, 2019
  3. joshmgross commented on Dec 18, 2019

    @joshmgross
    Contributor

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

  4. ericsciple commented on Dec 18, 2019

    @ericsciple
    Collaborator

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

  5. joshmgross commented on Dec 18, 2019

    @joshmgross
    Contributor

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

  6. ericsciple commented on Dec 18, 2019

    @ericsciple
    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

  7. ericsciple commented on Dec 18, 2019

    @ericsciple
    Collaborator

    think of it as a command line tool

  8. TingluoHuang commented on Dec 18, 2019

    @TingluoHuang
    MemberAuthor

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

  9. bryanmacfarlane commented on Dec 18, 2019

    @bryanmacfarlane
    Contributor

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

  10. dakale commented on Jan 6, 2020

    @dakale
    Contributor

    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

  11. TingluoHuang commented on Jan 6, 2020

    @TingluoHuang
    MemberAuthor

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

  12. dakale commented on Jan 6, 2020

    @dakale
    Contributor

    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

  13. joshmgross commented on Apr 2, 2020

    @joshmgross
    Contributor

    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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions