fonttools / fontbakery

🧁 A font quality assurance tool for everyone
https://fontbakery.readthedocs.io
Apache License 2.0
534 stars 99 forks source link

`com.google.fonts/check/repo/{fb_report,zip_files}`: no such file or directory error #4700

Closed RickyDaMa closed 1 month ago

RickyDaMa commented 1 month ago

Internet cookie goes to @dscorbett for correctly predicting a race condition a colleague and I just spent most of the day debugging:

Another part of the problem is that git_rootdir temporarily changes the working directory, so checks that depend on the fonts’ paths can fail if the fonts are specified with relative paths. Instead of changing the working directory, it should use git -C.

Originally posted by @dscorbett in https://github.com/fonttools/fontbakery/issues/4638#issuecomment-2079967794

The checks mentioned in the issue title error, with the only conceivable explanation being the check being executed from the wrong working directory. The directory assuredly exists (when relative to the correct CWD), the error only occurs with --auto-jobs, and I couldn't reproduce it on my local machine or a different CI runner

Stack trace, for what it's worth:

File ".../venv_bakery/lib/python3.11/site-packages/fontbakery/checkrunner.py", line 213, in _run_check
    subresults = list(subresults)
                 ^^^^^^^^^^^^^^^^
File ".../venv_bakery/lib/python3.11/site-packages/fontbakery/checks/googlefonts/repo.py", line 25, in com_google_fonts_check_repo_fb_report
    for f in filenames_ending_in(".json", family_directory)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../venv_bakery/lib/python3.11/site-packages/fontbakery/utils.py", line 480, in filenames_ending_in
    for f in os.listdir(root):
             ^^^^^^^^^^^^^^^^

I'll put a PR together with the suggested fix tomorrow