Skip to content

[BUG] REGRESSION: v5 fails if a broken symlink is present in the repo #1890

@cmaglie

Description

@cmaglie

Describe the bug

CI fails with this error:

Traceback (most recent call last):
  File "codecov_cli/main.py", line 100, in <module>
  File "codecov_cli/main.py", line 96, in run
  File "click/core.py", line 1161, in __call__
  File "click/core.py", line 1082, in main
  File "click/core.py", line 1697, in invoke
  File "click/core.py", line 1443, in invoke
  File "click/core.py", line 788, in invoke
  File "click/decorators.py", line 33, in new_func
  File "codecov_cli/commands/upload_coverage.py", line 86, in upload_coverage
  File "click/core.py", line 788, in invoke
  File "codecov_cli/services/upload_coverage/__init__.py", line 52, in upload_coverage_logic
  File "codecov_cli/services/upload/__init__.py", line 104, in do_upload_logic
  File "codecov_cli/services/upload/upload_collector.py", line 194, in generate_upload_data
  File "codecov_cli/services/upload/upload_collector.py", line 104, in _produce_file_fixes
  File "codecov_cli/services/upload/upload_collector.py", line 118, in _get_file_fixes
FileNotFoundError: [Errno 2] No such file or directory: 'internal/integrationtest/compile_4/testdata/ValidSketchWithNonInoBrokenSketchFileSymlink/other_file.c'
[PYI-2973:ERROR] Failed to execute script 'main' due to unhandled exception!
==> Failed to run upload-coverage
    Exiting...

the "missing" file is a broken symlink that we use in our integration tests suite:

$ ls -l internal/integrationtest/compile_4/testdata/ValidSketchWithNonInoBrokenSketchFileSymlink/
total 4
lrwxrwxrwx 1 cmaglie cmaglie  6 feb 28 15:58 other_file.c -> broken
-rw-rw-r-- 1 cmaglie cmaglie 31 feb 28 15:58 ValidSketchWithNonInoBrokenSketchFileSymlink.ino

The best fix in our use case is to catch the "No such file or directory" exception and ignore it.

To Reproduce

I think you can reproduce the error by creating a broken link in the Git repository where a test CI is run.
For example, on Linux:

$ ln -s broken link
$ ls -l link
lrwxrwxrwx 1 cmaglie cmaglie 6 ott 29 12:18 link -> broken
$ git add link
$ git commit -m "Added broken link"

and rerun the CI.

Expected behavior

A successful build.

Regression

The error has already been reported and fixed in the past: #1433

Product Area

Code coverage in CI.

Versions

  • CI/CD: GitHub Actions
  • Uploader: codecov-action@v5

Commit and CI link

You can see it here until it lasts: https://github.com/arduino/arduino-cli/actions/runs/18904016674/job/53963368281?pr=3019#step:8:364

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