Lower-case the OS family before matching it against the family names (backport of #13152 to maven-4.0.x) - #13154
Merged
Conversation
…pache#13152) * Lower-case the OS family before matching it against the family names The Maven 3 activator lower-cases activation/os/family before handing it to Os.isFamily (0456c7c, "Caplital OS name can not activate profile"), as it does for name and arch. The Maven 4 activator lower-cases name and arch but passes family through untouched. Os.isFamily switches on the family string against lower-case constants such as "winnt", "unix" and "dos"; anything that does not match falls through to the default branch, which is a plain actualOsName.contains(family). Families whose name is a substring of the OS name, like "Mac" on "mac os x", still work by accident, which is why the existing capital-name test did not catch this. The ones that rely on the switch do not: <family>WinNT</family> no longer activates on Windows, and <family>Mac</family> no longer activates on a JDK reporting os.name=darwin. Add the toLowerCase call so the family follows the same rule as the other three fields, and cover the two cases above. * Add negation test for capitalised OS family --------- Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
gnodet-bot
approved these changes
Sep 16, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
Clean backport of #13152. The fix is correct: Os.isFamily() uses all-lowercase constants in its switch (e.g. FAMILY_NT = "winnt", FAMILY_MAC = "mac") and would silently fall through to the default branch for mixed-case input like WinNT, producing wrong matching semantics. Lowercasing with Locale.ENGLISH before the family lookup is the right fix. The ! negation prefix is unaffected since ! is not modified by case conversion. Tests cover positive/negative matches and the negated case (!WinNT) — sufficient coverage.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
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.
Backport of #13152 to the
maven-4.0.xbranch.Cherry-pick of 5d36a54, applied cleanly with no conflicts.