Summary
The SCM-path normalization in ModelInheritanceAssembler has edge-case inaccuracies.
src/main/java/org/apache/maven/plugin/resources/remote/ModelInheritanceAssembler.java:548-616
protected String appendPath(String parentPath, String childPath, String pathAdjustment, boolean appendPaths) {
...
return cleanedPath + resolvePath(uncleanPath);
}
private static String resolvePath(String uncleanPath) {
LinkedList<String> pathElements = new LinkedList<>();
StringTokenizer tokenizer = new StringTokenizer(uncleanPath, "/");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
switch (token) {
case "": break;
case "..":
if (pathElements.isEmpty()) {
// FIXME: somehow report to the user that there are too many '..' elements.
// For now, ignore the extra '..'.
} else {
pathElements.removeLast();
}
break;
default:
pathElements.addLast(token);
break;
}
}
...
}
Problems
- Excess
.. segments are silently ignored (there is a // FIXME acknowledging this) — a parent SCM URL with too many .. yields a path that does not match what the user wrote, with no warning.
- Trailing slashes are dropped:
http://x/repo/ + child becomes http://x/repo/child (arguably fine), but a bare http://x/repo/ (no child) normalizes to http://x/repo, changing the URL.
"" tokens (double slashes //) are silently removed, which can collapse URLs that legitimately contain them.
Impact
Inherited scm connection/url values in supplemental models can be subtly wrong for unusual parent URLs, producing checkout paths that differ from the source repository layout.
Suggested fix
Move to a well-tested path normalizer (e.g. java.nio.file.Paths/URI handling, or plexus-utils PathTool) and decide explicitly how to handle excess .., trailing slashes, and empty segments; emit a warning instead of silently dropping path elements.
Summary
The SCM-path normalization in
ModelInheritanceAssemblerhas edge-case inaccuracies.src/main/java/org/apache/maven/plugin/resources/remote/ModelInheritanceAssembler.java:548-616Problems
..segments are silently ignored (there is a// FIXMEacknowledging this) — a parent SCM URL with too many..yields a path that does not match what the user wrote, with no warning.http://x/repo/+ child becomeshttp://x/repo/child(arguably fine), but a barehttp://x/repo/(no child) normalizes tohttp://x/repo, changing the URL.""tokens (double slashes//) are silently removed, which can collapse URLs that legitimately contain them.Impact
Inherited
scmconnection/url values in supplemental models can be subtly wrong for unusual parent URLs, producing checkout paths that differ from the source repository layout.Suggested fix
Move to a well-tested path normalizer (e.g.
java.nio.file.Paths/URI handling, orplexus-utilsPathTool) and decide explicitly how to handle excess.., trailing slashes, and empty segments; emit a warning instead of silently dropping path elements.