fix(files): discover plugin executables by extension on Windows - #314
Merged
Merged
Conversation
DiscoverExecutablesWithPaths treated a file as executable only when an execute bit was set. Windows has no execute bit and Go reports every file as 0666, so no plugin was ever discovered there and configured plugins were reported as missing. Decide executability per platform behind build tags. Unix keeps the execute-bit check. Windows accepts a file whose extension is listed in PATHEXT (default .COM;.EXE;.BAT;.CMD), the same rule the shell and exec.LookPath apply, and registers it under its name without the extension so a plugin configured as "my-plugin" matches my-plugin.exe on disk. When several candidates share a name the PATHEXT order decides. A filestest package names executable fixtures portably so the existing discovery tests run unchanged on every platform. Fixes #313
The plugin directory section stated the execute-bit rule as universal. Document the Windows rule: extensions listed in PATHEXT are executable, the extension is stripped when matching the configured name, and PATHEXT order breaks ties.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
peteski22
force-pushed
the
fix/windows-permissions
branch
from
September 3, 2026 17:20
0f5f1fd to
457e693
Compare
peteski22
added a commit
that referenced
this pull request
Sep 16, 2026
* fix(files): discover plugin executables by extension on Windows DiscoverExecutablesWithPaths treated a file as executable only when an execute bit was set. Windows has no execute bit and Go reports every file as 0666, so no plugin was ever discovered there and configured plugins were reported as missing. Decide executability per platform behind build tags. Unix keeps the execute-bit check. Windows accepts a file whose extension is listed in PATHEXT (default .COM;.EXE;.BAT;.CMD), the same rule the shell and exec.LookPath apply, and registers it under its name without the extension so a plugin configured as "my-plugin" matches my-plugin.exe on disk. When several candidates share a name the PATHEXT order decides. A filestest package names executable fixtures portably so the existing discovery tests run unchanged on every platform. Fixes #313 * docs(plugins): describe how plugin executables are discovered on Windows The plugin directory section stated the execute-bit rule as universal. Document the Windows rule: extensions listed in PATHEXT are executable, the extension is stripped when matching the configured name, and PATHEXT order breaks ties.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
mcpdnever discovered a plugin on Windows.DiscoverExecutablesWithPathstreated a file as executable only when an execute bit was set. Windows has no execute bit and Go reports every file as 0666, so the plugin directory always appeared empty and every configured plugin was reported as missing (#313).Two commits:
PATHEXT(default.COM;.EXE;.BAT;.CMD), the same rule the shell andexec.LookPathapply, and registers it under its name with the extension removed soname = "my-plugin"matchesmy-plugin.exe. When several candidates share a name,PATHEXTorder decides. Afilestesthelper names fixtures portably so the existing discovery tests run unchanged on every platform, plus Windows-only tests for thePATHEXTrules.ls -l.PR Type
Relevant issues
Fixes #313
Refs #218
How to test
On Windows this turns
internal/files,internal/plugin,internal/configandcmd/config/pluginsgreen; with #309 the whole suite passes on Windows. To see it in action, drop afoo.exeinto a plugin directory and configurename = "foo".Checklist
make lint,make test).AI Usage
AI Model/Tool used: Claude Code (Claude Fable 5.1)
Any additional AI details you'd like to share: The change set was drafted with Claude Code and reviewed commit by commit by the author, with naming, structure and history revised during that review.