scala.reflect.io.ZipArchive#ensureDir infinitely recurses in some cases in 2.13.1

Hello team

I think this bug affects Scala 2.12.10 as well?

I am encountering Stackoverflow error when trying to use Scalate 1.9.5 on Scala 2.12.10?

Exception in thread “main” java.lang.StackOverflowError
at scala.reflect.io.ZipArchive$.splitPath(ZipArchive.scala:62)
at scala.reflect.io.ZipArchive$.scala$reflect$io$ZipArchive$$dirName(ZipArchive.scala:58)
at scala.reflect.io.ZipArchive.ensureDir(ZipArchive.scala:114)
at scala.reflect.io.ZipArchive.ensureDir(ZipArchive.scala:114)
at scala.reflect.io.ZipArchive.ensureDir(ZipArchive.scala:114)
at scala.reflect.io.ZipArchive.ensureDir(ZipArchive.scala:114)
at scala.reflect.io.ZipArchive.ensureDir(ZipArchive.scala:114)
etc

Looking at the code this patch wasn’t applied to 2.12.10 branch?

That’s right, fix was only applied to 2.13.x. (The reporter of the bug believed the problem was 2.13-only, but perhaps they were mistaken?)

If you’re correct that the bug exists in 2.12.x as well, I assume a PR that backported the fix to 2.12.x would be accepted. Whether the backport would be straightforward, or tricky, I don’t know.

I suggest we talk on https://github.com/scala/bug/issues/11754 itself, so that the history on this issue is all together there in one place, and also because that’s a likelier place to attract the attention of those who were involved with the fix.