Attempting a larger bug fix I - Planning

rjwignar

Roy J. Wignarajah

Posted on December 5, 2023

Attempting a larger bug fix I - Planning

Finding a bug when working on a different Issue

Original Issue

Recently, I was working on updating a CI workflow in Skyrim Community Shaders (CS), a Skyrim shaders mod. The CI workflow in question runs an external GitHub Action, DoozyX/clang-format-lint that lints the entire CS codebase using clang-format. The Issue I was working on involves modifying the CI workflow to lint only modified files. This would prevent clang-format from running on unintended targets and perhaps even speed up the workflow.

The modified workflow

So far, I've been able to modify the workflow, by pairing clang-format-lint with tj-actions/changed-files, another Marketplace action that retrieves all modified files. By pairing these two actions, you can pass a list of modified files to clang-format-lint.

The modified workflow works! Here's a successful workflow run:

Image description

Don't forget to lint shader files

In this workflow run, only a couple C++ source files were modified. The clang-format-lint action should also run on shader files (files with the .hlsl and .hlsli extensions):

Image description

Some of the shader files have whitespaces in their filepaths. What happens when you modify one of these files and then run the workflow?

Image description

Broken filepaths

Some of the filepaths are broken apart. Here are the four original filepaths:

features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli
features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli
src/Features/DistantTreeLighting.cpp
src/Features/DistantTreeLighting.h
Enter fullscreen mode Exit fullscreen mode

Here's what happens when they're passed to the clang-format-lint action:

features/Complex,
Parallax,
Materials/Shaders/ComplexParallaxMaterials/CRPM.hlsli,
features/Complex,
Parallax,
Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli,
src/Features/DistantTreeLighting.cpp,
src/Features/DistantTreeLighting.h
Enter fullscreen mode Exit fullscreen mode

What's the deal?

I found a bug in one of the Marketplace GitHub Actions!
One solution would be to ignore shader files in the clang-format-lint step, as they appear to be the only files that have whitespaces in their filepaths. Alternatively, all directory names could be truncated to remove the whitespaces. However, a discussion with the maintainers showed both of these options were off the table. More importantly, these options are only a workaround, and won't address the bug found in one of these Marketplace actions.

The only solution here is to locate the bug in one of the Marketplace actions. Doing so will allow me to complete my original Pull Request.

The Plan

The bug I found involves how the modified workflow handles filepaths with spaces in them. My modified workflow uses two external GitHub actions:

  • tj-actions/changed-files, and
  • DoozyX/clang-format-lint

The following are my objectives for fixing my observed bug:

  1. Confirm the source of the Issue in one of the external GitHub Actions
  2. File an Issue in the appropriate GitHub Action
  3. Apply the bug fix in the GitHub Action.
  4. Test and confirm the fix
  5. Make a pull request to the GitHub Action
  6. Work with the GitHub Action maintainer(s) on the Pull Request.
  7. If/when the pull request is approved, continue working on my original Issue on Skyrim Community Shaders
  8. Submit a Pull request to fix the original Issue I was working on

Current progress

At this point, I've already done some of the work and identified the bug one in of the external GitHub action. However, I need to collect some more information before filing the issue, so I can properly communicate to the maintainers that the bug is due to this GitHub action and not the other one.

At the same time, I'm also working on a fix for the external GitHub action. Over the next few days I plan to write about my experience filing the issue and making a Pull Request for the external GitHub Action.

💖 💪 🙅 🚩
rjwignar
Roy J. Wignarajah

Posted on December 5, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related