Skip to content

Absolute path source with circular symlink finds no files #3815

Open
@ashtuchkin

Description

@ashtuchkin

GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)

https://github.com/ashtuchkin/buf-bug-repro

Commands

docker run -v .:/cloud --workdir=/cloud bufbuild/buf lint /cloud/cloud_protos/example/example.proto

Output

Failure: Module "path: ".", includes: "cloud_protos"" had no .proto files

Expected Output

No lint failures

Anything else?

It works if a relative path is provided (buf lint cloud_protos/example/example.proto) or if I use --disable-symlinks.

There are 2 problems:

  1. Error on absolute path. This is annoying because vscode-buf plugin is using absolute paths when I'm editing files + recent version 0.7 started to open Output panel and focus it on each error, so I can't edit the proto files in peace - it always steals the focus and shows this error.
  2. Why does buf even traverses directories outside of includes dirs in the modules? I've run it under strace and see it traverses not only the whole repo (including .git, .venv, node_modules etc), but also a lot of /home/<user>/.cache directories symlinked from it. In total, it's > 200000 files that are not relevant to the linting, which just makes buf slow (~8 seconds for each lint in my case).

Circular symlink is not a theoretical issue - it's what bazel creates in a standard setup, via bazel-<repo> symlink. With bazel it's 2 levels, but the error is reproducible with just one level: /cloud/bazel-cloud/cloud_protos -> /cloud/cloud_protos, see in the repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions