Skip to content

Infinite recursion in walk() when S3 bucket contains object with key / #953

@SamirAltos

Description

@SamirAltos

We've run into a reproducible issue where calling walk() on an S3 bucket causes infinite recursion if the bucket contains an object with the key /

This happens because:

  • S3 allows an object to be created with the key /
  • ls() returns it as a "directory" (i.e. common prefix /)
  • walk() sees that as a subdirectory and recurses into it
  • But that "subdirectory" is just the bucket root again → leading to infinite recursion
  • This eventually leads to a RecursionError: maximum recursion depth exceeded.

Let us know if this is something you'd consider filtering out at the s3fs level. Happy to provide a test case or additional details!

Thanks for the great library 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions