Skip to content

Forward-port: Remove erroneous PathSelector optimization + regression test - #12622

Merged
gnodet merged 1 commit into
masterfrom
forward-port/pathselector-false-positive-fix
Jul 30, 2026
Merged

Forward-port: Remove erroneous PathSelector optimization + regression test#12622
gnodet merged 1 commit into
masterfrom
forward-port/pathselector-false-positive-fix

Conversation

@gnodet

@gnodet gnodet commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Forward-port of #12621 from maven-4.0.x to master.

  • Removes the needRelativize optimization in PathSelector that skipped path relativization when all patterns started with **, producing false positives when the base directory path contained a matching segment
  • Adds regression test for the exact false-positive scenario

Cherry-pick applied cleanly with no conflicts.

Original fix by: Martin Desruisseaux (@desruisseaux)

🤖 Generated with Claude Code

…zation

The optimization skipped path relativization when all include/exclude
patterns started with "**". This produced false positives when the base
directory path itself contained a segment matching the pattern (e.g.,
base = "something/target/test-classes" with pattern "**/test-classes/**"
would match every file under the base directory).

Added a regression test for the exact false-positive scenario.

PR: #12621
Original fix by: Martin Desruisseaux (@desruisseaux)
Supersedes: #12617

Closes #12621
@gnodet gnodet added this to the 4.1.0 milestone Jul 29, 2026
@gnodet gnodet added the bug Something isn't working label Jul 29, 2026
@gnodet gnodet self-assigned this Jul 29, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: APPROVE

Clean forward-port of already-merged PR #12621 from maven-4.0.x to master. The diffs are byte-for-byte identical — no conflicts, no modifications.

The fix correctly removes the flawed needRelativize optimization in PathSelector.simplify() that caused false-positive path matching, and the regression test covers both the true-positive and false-positive scenarios. The only remaining shortcut is the INCLUDES_ALL case for zero includes and zero excludes, which is correct.

This is a gnodet-authored PR, so posting as COMMENT instead of APPROVE.


Reviewed via automated review loop · Feedback? Tag @gnodet

@gnodet
gnodet merged commit 612aab0 into master Jul 30, 2026
24 checks passed
@gnodet
gnodet deleted the forward-port/pathselector-false-positive-fix branch July 30, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant