Skip to content
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

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

Open
mjadczak opened this issue Sep 27, 2019 · 1 comment · May be fixed by scala/scala#8447

Comments

@mjadczak
Copy link

commented Sep 27, 2019

It looks like this class was modified in 2.13.1 to use a "path" representation for entries always, instead of going back and forth between "dotted" and "path" representations (see scala/scala#8356). The ensureDir function depends on having a "root" entry already in the dirs map which is passed in - otherwise, it will never terminate, as the dirName function which it calls has a fixed point at "/".

With the "path" representation, the root is always "/", whereas it seems to have been "" in some cases previously. This means that every time we will call this ensureDir functions, we need to make sure that we pass it a map already containing an entry for "/". There seems to have already been an effort to fix some of these cases. Unfortunately, not all were caught.

In our case, we are reflectively compiling scala code at runtime, and are getting a StackOverflowError in this method when resolving one package (javax.swing). I have traced this to this line, which I believe should use "/" as the key, instead of "". I think there is a similar bug at line 250 in that file, in URLZipArchive.

@michelou

This comment has been minimized.

Copy link

commented Sep 28, 2019

I read (where root = new DirEntry("/")):

Line 190 : dirs.put("/", root)
Line 250 : dirs.put("", root)
Line 325 : dirs.put("", root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.