[GRADLE-2902] Possible stack overflow during file copy in Gradle 1.8 Created: 29/Sep/13  Updated: 08/Oct/13  Resolved: 08/Oct/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.9-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Luke Daley
Resolution: Fixed Votes: 0

Known Issue Of:
1.8

 Description   

I have a task includes the following action

project.copy { CopySpec cs ->
cs.from('src/main/conf')
cs.into('build/dist')
cs.includeEmptyDirs = false
}

and which now produces a stackoverflow in this code

at org.gradle.api.internal.file.CompositeFileCollection$1.resolve(CompositeFileCollection.java:88)
at org.gradle.api.internal.file.CompositeFileTree$FilteredFileTree.resolve(CompositeFileTree.java:91)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveNested(DefaultFileCollectionResolveContext.java:143)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:101)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext$FileTreeConverter.convertInto(DefaultFileCollectionResolveContext.java:182)
at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)

This worked in gradle 1.0-1.6

Any idea what is going wrong or how to debug this?



 Comments   
Comment by Gradle Forums [ 29/Sep/13 ]

I'm not able to reproduce this. Can you post a minimal self-contained example that allows to reproduce the issue?

Comment by Gradle Forums [ 29/Sep/13 ]

It looks like it is related to use of GString, put the following in a build.gradle and run it using gradle 1.8

task doIt {
ext {
source = "a"
dest = "b"
}
doLast {
project.copy { CopySpec cs ->
cs.from(source)
cs.into(dest)
}
}
}

result = stackoverflow

If you pass source.toString() and dest.toString() instead and it works fine.
If you use gradle 1.7 instead (and pass the gstring referencess in), it also works fine hence is clearly a regression in 1.8
If you don't use a reference and pass "a" in directly, it also works fine.

Comment by Gradle Forums [ 29/Sep/13 ]

`"a"` and `"b"` aren't GStrings (they don't contain a `$`).

Generated at Wed Jun 30 12:34:33 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.