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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a .sqlfluffignore causes SQLFluff to crash if symlinks are present #1646

Closed
CyberShadow opened this issue Oct 14, 2021 · 0 comments · Fixed by #1650
Closed

Creating a .sqlfluffignore causes SQLFluff to crash if symlinks are present #1646

CyberShadow opened this issue Oct 14, 2021 · 0 comments · Fixed by #1650
Labels
bug Something isn't working

Comments

@CyberShadow
Copy link
Contributor

python -m venv venv creates a structure with a symlink pointing to its own directory, which would confuse naive recursive directory iterators.

It looks like SQLFluff does something to that effect when parsing .sqlfluffignore, resulting in a RecursionError:

Traceback (most recent call last):
  File "/home/vladimir/work/extern/sqlfluff/venv/bin/sqlfluff", line 33, in <module>
    sys.exit(load_entry_point('sqlfluff', 'console_scripts', 'sqlfluff')())
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/vladimir/work/extern/sqlfluff/src/sqlfluff/cli/commands.py", line 713, in parse
    for parsed_string in result:
  File "/home/vladimir/work/extern/sqlfluff/src/sqlfluff/core/linter/linter.py", line 860, in parse_path
    for fname in self.paths_from_path(path):
  File "/home/vladimir/work/extern/sqlfluff/src/sqlfluff/core/linter/linter.py", line 739, in paths_from_path
    for m in matches:
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/pathspec.py", line 190, in match_files
    file_map = util.normalize_files(files, separators=separators)
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 392, in normalize_files
    for path in files:
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 170, in iter_tree_files
    for entry in _iter_tree_entries_next(os.path.abspath(root), '', {}, on_error, follow_links):
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 242, in _iter_tree_entries_next
    for entry in _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links):
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 242, in _iter_tree_entries_next
    for entry in _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links):
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 242, in _iter_tree_entries_next
    for entry in _iter_tree_entries_next(root_full, node_rel, memo, on_error, follow_links):
  [Previous line repeated 2 more times]
  File "/home/vladimir/work/extern/sqlfluff/venv/lib/python3.9/site-packages/pathspec/util.py", line 210, in _iter_tree_entries_next
    raise RecursionError(real_path=dir_real, first_path=memo[dir_real], second_path=dir_rel)
pathspec.util.RecursionError: ('/home/vladimir/.../venv', '.../venv', '.../venv/venv')

(SQLFluff ed23bf6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant