GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Forward-port: Remove erroneous PathSelector optimization + regression test by gnodet · Pull Request #12622 · apache/maven

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
Remove erroneous PathSelector optimization that skipped path relativi…
a51c84c
…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 commented Jul 29, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet merged commit 612aab0 into master Jul 30, 2026
24 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gnodet gnodet

Labels

bug Something isn't working

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@gnodet
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.