eclipse-tycho / tycho

Tycho project repository (tycho)
https://tycho.eclipseprojects.io
Eclipse Public License 2.0
161 stars 188 forks source link

forceContextQualifier has been broken since Tycho 4.0.5 #3809

Open orionll opened 2 months ago

orionll commented 2 months ago

There is an infinite recursion in AbstractTychoMapping.modelHasProperty if Tycho build is called with -DforceContextQualifier. Steps to reproduce:

The bug was introduced in this commit by @laeubi: #3320.

If you run mvn with -X, you will notice many lines like these:

[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles is groupId: com.vogella.tycho, artifactId: com.vogella.tycho.root, relativePath: ..\pom.xml
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\.polyglot.META-INF
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
[DEBUG] Generate aggregator pom for C:\Projects\TreeAge\tycho-example\bundles\pom.tycho
[DEBUG] Adding module com.vogella.logging.config
[DEBUG] Adding module com.vogella.tycho.p2.ui
[DEBUG] Adding module com.vogella.tycho.platform
[DEBUG] Adding module com.vogella.tycho.platform.linux
[DEBUG] Adding module com.vogella.tycho.plugin1
[DEBUG] Adding module com.vogella.tycho.rcp
[DEBUG] Derived parent for path C:\Projects\TreeAge\tycho-example\bundles\com.vogella.logging.config\META-INF\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\..\.polyglot.pom.tycho\.. is groupId: com.vogella.tycho, artifactId: bundles, relativePath: ..\.polyglot.pom.tycho
[DEBUG] C:\Projects\TreeAge\tycho-example\bundles\.polyglot.pom.tycho
...
Bananeweizen commented 1 month ago

I cannot reproduce. The example builds fine for me with all versions from 4.0.5 to 5.0.0-SNAPSHOT using your command line. Windows 10, Java 21.

That being said, I'm not sure whether the mentioned commit is the one to blame. Given that we see a recursion from a relative path pointing to itself again and again, this might also be related to 5782054dec37208b544c7220fe09785e3c7d65ca, where the file and path handling was refactored. You may want to experiment locally with reverting parts of that, or with adding some more "toRealPath()" calls to avoid the repeated relative paths.