gnodet commented on PR #12809:
URL: https://github.com/apache/maven/pull/12809#issuecomment-5445151193

   ### 3.x Applicability
   
   Confirmed: this fix does **not** apply to Maven 3.x. The 
`getEnhancedProperties()` method (where the path comparison mismatch occurs) 
was introduced in Maven 4.x as part of the new `DefaultModelBuilder` in 
`maven-impl`. Maven 3.x uses a different model building implementation that 
doesn't have this code path.
   
   ### Unit Test Added
   
   Added a unit test 
(`testGetEnhancedPropertiesWithNonNormalizedRootDirectory`) that:
   
   1. Creates a project with a `.mvn/` root marker
   2. Builds it to get the `ModelBuilderSessionState` and root `Model`
   3. Adds a marker property to the model that doesn't exist in the POM on disk
   4. Calls `getEnhancedProperties` via reflection with a non-normalized 
`rootDirectory` (containing `/../` segments)
   5. Asserts the marker property is present in the result — proving the 
else-branch was taken (fix recognizes the paths as equal)
   
   **Verified**: test **passes** with the fix and **fails** without it.
   
   Without the fix, `Objects.equals(rootDirectory, 
model.getProjectDirectory())` sees the non-normalized and normalized paths as 
different, incorrectly enters the if-branch, and re-reads the model from disk 
(losing the marker). In a real Maven session where `session.getRootDirectory()` 
consistently returns non-normalized paths, this incorrect branch leads to 
recursive `readFileModel` calls and `StackOverflowError`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to