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

Broken symlink in tree → Traceback #2525

Closed
killermoehre opened this issue Apr 4, 2023 · 0 comments · Fixed by #2538
Closed

Broken symlink in tree → Traceback #2525

killermoehre opened this issue Apr 4, 2023 · 0 comments · Fixed by #2538
Labels
bug Something isn't working

Comments

@killermoehre
Copy link
Contributor

Describe the bug
If you have a symlink in your repository pointing to a non-existent file, MegaLinter fails hard.

Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/run.py", line 15, in <module>
      linter.run()
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/MegaLinter.py", line 142, in run
      self.collect_files()
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/MegaLinter.py", line 637, in collect_files
      linter.collect_files(filtered_files)
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/Linter.py", line [77](https://$github/$orga/$repo/runs/7598908?check_suite_focus=true#step:5:79)6, in collect_files
      self.files = utils.filter_files(
                   ^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/utils.py", line 163, in filter_files
      and not file_contains(
              ^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/site-packages/megalinter-0.1-py3.11.egg/megalinter/utils.py", line 232, in file_contains
      with open(file_name, "r", encoding="utf-8", errors="ignore") as f:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  FileNotFoundError: [Errno 2] No such file or directory: '/github/workspace/kiwi/seed-root/0-global/etc/localtime'

To Reproduce
Steps to reproduce the behaviour:

  1. create a symlink pointing into the abyss.
    ln -s ../i-dont-exists but-i-do-now
  2. git add but-i-do-now
  3. git commit
  4. git push

Expected behaviour
MegaLinter doesn't fail on broken symlinks

@killermoehre killermoehre added the bug Something isn't working label Apr 4, 2023
nvuillam added a commit that referenced this issue Apr 8, 2023
Fixes #2525

Co-authored-by: Silvio Knizek <7925665+killermoehre@users.noreply.github.com>
nvuillam added a commit that referenced this issue Apr 10, 2023
Fixes #2525

Co-authored-by: Silvio Knizek <7925665+killermoehre@users.noreply.github.com>
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