Skip to content

files: executable discovery uses the Unix execute bit, so no plugin is discovered on Windows #311

Description

@peteski22

DiscoverExecutablesWithPaths gates discovery on the Unix execute bit (internal/files/files.go:77):

if info.Mode().IsRegular() && info.Mode().Perm()&0o111 != 0 {

Windows has no execute bit. Go synthesizes permissions from the read-only attribute, so files report 0666 (or 0444), &0o111 is always 0, and no plugin is ever discovered on Windows. Executability on Windows is determined by extension via PATHEXT (.exe, .bat, .cmd, .com).

Confirmed on a Windows machine: five tests fail with "map[]" should have N item(s), but has 0 —
TestManager_discoverPlugins_{WithExecutableFiles, SkipsHiddenFiles, SkipsDirectories, MultipleExecutables, OnlyDiscoverAllowed}. They fail identically on main, so this is pre-existing and not caused by #299.

Fix: split the executability check per platform, following the existing precedent in this same package (internal/files/paths_windows_test.go, //go:build windows):

  • unix: keep the 0o111 permission check
  • windows: match against PATHEXT extensions
  • tests for both

Found while reviewing #299 for cross-platform behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions