Skip to content

fix(tools): skip non-executable files in package::which - #1132

Open
tecnolgd wants to merge 2 commits into
wavefnd:masterfrom
tecnolgd:fix/skip-non-exe-build
Open

tecnolgd wants to merge 2 commits into
wavefnd:masterfrom
tecnolgd:fix/skip-non-exe-build

Conversation

@tecnolgd

Copy link
Copy Markdown
Contributor

Summary

Update package::which in tools/src/package.rs to verify Unix executable permission bits (metadata.mode() & 0o111 != 0) before returning matching files for both direct paths and PATH lookups, and add a unit test covering non-executable vs. executable resolution.

Motivation

Closes #1123. Previously, package::which only checked is_file(), allowing non-executable regular files (e.g., 0644 stubs) earlier in PATH or passed directly to shadow valid executables (0755) later in PATH.

Target and compatibility impact

On Unix targets, package::which now skips non-executable regular files when resolving tools while keeping directory skipping intact. Windows executable suffix resolution (PATHEXT / .exe, .cmd, .bat) and direct-path resolution remain unchanged.

Validation

  • cargo fmt --all --check (passed)
  • cargo test -p wave-tools --lib package::tests::which_skips_non_executable_files_and_preserves_executable_matches (passed)
  • cargo clippy --locked -p wave-tools --no-deps --all-targets --jobs 2 -- -D warnings (verified zero warnings on modified lines; skipped workspace-wide Clippy due to unrelated manual_is_multiple_of and byte_char_slices lints on local Rust 1.97.0)
  • Skipped local Meson suite runs (meson test -C build-tools --suite tooling --suite policy) as Meson is not installed in the local environment; relying on CI for Meson suite validation.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

Signed-off-by: tecnolgd <tecnolgd@proton.me>
Signed-off-by: tecnolgd <tecnolgd@proton.me>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip non-executable files when searching PATH for build tools

1 participant