-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classpath instrumentation of NIO.2 operations fails for paths in zip archives #25044
Comments
Sorry that you're having trouble with Gradle! We appreciate the effort that went into filing this issue, but we must ask for more information. As stated in our issue template, a minimal reproducible example is a must for us to be able to track down and fix your problem efficiently. Our available resources are severely limited, and we must be sure we are looking at the exact problem you are facing. If we have a reproducer, we may be able also to suggest workarounds or ways to avoid the problem. The ideal way to provide a reproducer is to leverage our reproducer template. You can also use Gradle Project Replicator to reproduce the structure of your project. This issue will be closed after 7 days unless you provide more information. |
@jbartok please find the reproducer here: https://github.com/netvl/gradle-classpath-instrumentation-bug |
Thank you for providing a valid reproducer. The issue is in the backlog of the relevant team and is prioritized by them. |
Is there any chance of this being fixed sooner? Looking at the code and comparing two adjacent methods: gradle/subprojects/core/src/main/java/org/gradle/internal/classpath/Instrumented.java Lines 426 to 429 in eb27e93
gradle/subprojects/core/src/main/java/org/gradle/internal/classpath/Instrumented.java Lines 431 to 434 in eb27e93
it looks like the fix will be a very simple one-liner, since the readString(Path, Charset) instrumented body looks correct.
|
This issue is a good choice for first-time contributors to Gradle, it is actionable and ready for contribution. See CONTRIBUTING.md for more information. |
Hi @mlopatkin, this is my first PR to Gradle, could you help me assign a reviewer? #26117 |
Expected Behavior
Using
Files.readString
API in plugin code when reading non-default file systems should work correctly.Current Behavior
When some code which runs within Gradle (a custom plugin, in most cases) tries to execute
Files.readString
without specifying the charset against aPath
instance created from a zip file system, this method call will fail due to incorrect instrumentation within Gradle:The reason, as it seems, is that the path is attempted to be converted into a
File
instance unconditionally:gradle/subprojects/core/src/main/java/org/gradle/internal/classpath/Instrumented.java
Line 427 in 709020a
This naturally fails for non-local file system paths.
It might be that some other similarly instrumented operations are affected as well.
Context (optional)
Files.readString
and other similar operations are very common in plugins, so it would make sense for it to work without hitches. It seems that this error started to happen relatively recently, probably because Gradle didn't do this kind of instrumentation earlier.Steps to Reproduce
Any way to execute
Files.readString()
against aPath
inside a zip archive while within the instrumented Gradle classpath should demonstrate the issue. In our case, this method was called from within our internal plugin which uses zip file system to read zip archive contents.Gradle version
8.1.1
Build scan URL (optional)
No response
Your Environment (optional)
No response
The text was updated successfully, but these errors were encountered: