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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悶 Directory.glob with recursive patterns (**/*.go) returns duplicates and is very slow #6687

Closed
vito opened this issue Feb 18, 2024 · 0 comments 路 Fixed by #6852
Closed
Assignees

Comments

@vito
Copy link
Contributor

vito commented Feb 18, 2024

What is the issue?

It looks like Buildkit returns weird results when you ReadDir with a glob like **/*.go. It actually seems to find everything recursively, but then trim each result to only have the first path segment. So for a/1.go a/2.go b/3.go it'll return a a b. We then recurse into a twice, which will also have this issue, so it quickly explodes into a huge number of results.

We could work around this issue by deduping, but it would probably be better to fix this upstream in Buildkit. It would be perfect if it just returned all the full paths, which it seems capable of doing. Then we wouldn't need to recurse ourselves. While we're there, maybe we could add support for exclude filters too (edit: interestingly it seems to support ! prefixes for exclusions - maybe we should be phasing out include: ["a"], exclude: ["b"] in favor of globs: ["a", "!b"]?).

cc @jedevc @TomChv for continuity from #5824 (comment)

Dagger version

v0.9.1+ (when the feature was added; not a regression)

Steps to reproduce

{
  git(url:"https://github.com/dagger/dagger") {
    branch(name:"main"){
      tree {
        glob(pattern:"**/dagger.json")
      }
    }
  }
}

Log output

{
  "data": {
    "git": {
      "branch": {
        "tree": {
          "glob": [
            "ci/dagger.json",
            "core/integration/testdata/modules/go/basic/dagger.json",
            "core/integration/testdata/modules/go/broken/dagger.json",
            "core/integration/testdata/modules/go/ifaces/dagger.json",
            "core/integration/testdata/modules/go/ifaces/impl/dagger.json",
            "core/integration/testdata/modules/go/ifaces/test/dagger.json",
            "core/integration/testdata/modules/go/namespacing/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub1/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub2/dagger.json",
            "core/integration/testdata/modules/go/basic/dagger.json",
            "core/integration/testdata/modules/go/broken/dagger.json",
            "core/integration/testdata/modules/go/ifaces/dagger.json",
            "core/integration/testdata/modules/go/ifaces/impl/dagger.json",
            "core/integration/testdata/modules/go/ifaces/test/dagger.json",
            "core/integration/testdata/modules/go/namespacing/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub1/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub2/dagger.json",
            "core/integration/testdata/modules/go/basic/dagger.json",
            "core/integration/testdata/modules/go/broken/dagger.json",
            "core/integration/testdata/modules/go/ifaces/dagger.json",
            "core/integration/testdata/modules/go/ifaces/impl/dagger.json",
            "core/integration/testdata/modules/go/ifaces/test/dagger.json",
            "core/integration/testdata/modules/go/namespacing/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub1/dagger.json",
            "core/integration/testdata/modules/go/namespacing/sub2/dagger.json",
            // you get the idea
@vito vito added the kind/bug Something isn't working label Feb 18, 2024
@jedevc jedevc self-assigned this Feb 19, 2024
@sipsma sipsma added this to the v0.10.x milestone Feb 26, 2024
@gerhard gerhard removed this from the v0.10.x milestone Mar 12, 2024
@samalba samalba removed the kind/bug Something isn't working label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants