Skip to content

Get-ChildItem will recurse indefinititely for recursive symlinks #1875

Closed

Description

Steps to reproduce

gci -r /sys

Expected behavior

gci reaches its terminus, and then ceases

Actual behavior

Because of these recursive symlinks,

PS /> ls -la /sys/bus/cpu/devices/cpu0/
lrwxrwxrwx.  1 root root    0 Aug 18 16:12 node0 -> ../../node/node0
PS /> ls -la /sys/bus/cpu/devices/cpu0/node0/
lrwxrwxrwx. 1 root root    0 Aug 18 16:12 cpu0 -> ../../cpu/cpu0

gci eventually runs into something like this:


    Directory: /sys/bus/cpu/devices/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/nod
    e0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0/node0/cpu0


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       08/18/2016     16:13                cache

It has shown no sign of stopping.

Linux's equivalent ls -lR /sys will cease, as it will not descend into already visited nodes.

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.9
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Activity

  1. modified the milestone: on Sep 29, 2016
  2. added
    Up-for-Grabs
    on Sep 29, 2016
  3. added
    Issue-Bug
    on Sep 29, 2016
  4. andyleejordan commented on Sep 29, 2016

    @andyleejordan
    Member

    This is being resolved in #2252.

  5. DHowett-MSFT commented on Sep 29, 2016

    @DHowett-MSFT

    Alas, #2252's description contains

    Does not fix more complicated symlink loops, as in sys.

  6. removed this from the 6.0.0-alpha.13 milestone on Nov 17, 2016
  7. removed
    Up-for-Grabs
    on Mar 28, 2017
  8. 4 remaining items

  9. mklement0 commented on Jun 7, 2017

    @mklement0
    Contributor

    Given that jeffbi, the current assignee, has already done work in this area, I think he's the better choice, if he's up for it.

    We should also get buy-in for #3951 first (I do believe it's an essential feature) - or is the fact of it being labeled "Issue-Enhancement" by Steve Lee (@SteveL-MSFT) an indication that the team agrees it should be done?

  10. iSazonov commented on Jun 7, 2017

    @iSazonov
    Collaborator

    Michael Klement (@mklement0) Ask about the approve there :-)

  11. jeffbi commented on Jun 7, 2017

    @jeffbi

    I'm happy to continue working on this once the desired behavior is defined, including the mechanism for opting in.

  12. SteveL-MSFT commented on Jun 7, 2017

    @SteveL-MSFT
    Member

    Michael Klement (@mklement0) Issue-Enhancement doesn't imply it must be done (for 6.0.0 anyways), just that it's a new capability (since we were ok with the breaking change, that becomes the norm)

  13. mklement0 commented on Jun 7, 2017

    @mklement0
    Contributor

    Thanks, Steve Lee (@SteveL-MSFT).

    Generally, what is it that tells us whether something will be implemented?

  14. iSazonov commented on Jun 8, 2017

    @iSazonov
    Collaborator

    "Won't fix" label is " will be NOT implemented" 😄

  15. SteveL-MSFT commented on Jun 8, 2017

    @SteveL-MSFT
    Member

    Michael Klement (@mklement0) the only way to determine if there is a good chance that something will be implemented is that it's assigned to someone. for the 6.0.0 release anything with a 6.0.0-highpriority means we've triaged it and believe it's a must have before we can declare a 6.0.0 release candidate, the other 6.0.0-* milestones are ones we use internally for triage purposes and don't imply will be fixed. if there's any issue you believe is must have for 6.0.0 (rather than a release after 6.0.0), call my attention to it (also good to include Joey Aiello (@joeyaiello)). thanks!

  16. added
    Up-for-Grabs
    on Aug 1, 2017
  17. added this to the milestone on Aug 1, 2017
  18. rjmholt commented on Apr 10, 2018

    @rjmholt
    Collaborator

    Given that #4020 is merged, is this still an issue?

  19. added
    Resolution-Fixed
    and removed
    Up-for-Grabs
    on Apr 10, 2018
  20. SteveL-MSFT commented on Apr 10, 2018

    @SteveL-MSFT
    Member

    Did a simple test of creating a symlink within a folder to itself and across two different folders and it doesn't recurse infinitely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-FixedWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions