mvn build of scala.core fails with error "File name too long" #9

bertvv opened this Issue May 24, 2011 · 8 comments


None yet

7 participants

bertvv commented May 24, 2011

I fetched the latest revision of the repository and tried to do a mvn clean install. The compilation of scala.core failed with error message "File name too long" without more information (which file?). Adding -verbose to the scala compiler options reveiled that the error occurs in ast.ScalaAstVisitor:

[wrote 'ScalaAstVisitor$treeTraverser$$anonfun$org$netbeans$modules$scala$core$ast$ScalaAstVisitor$treeTraverser$$traverse$11' to /home/bert/nbscala/scala.core/target/classes/org/netbeans/modules/scala/core/ast/ScalaAstVisitor$treeTraverser$$anonfun$org$netbeans$modules$scala$core$ast$ScalaAstVisitor$treeTraverser$$traverse$11.class]
error: File name too long
one error found
bertvv commented May 24, 2011

Platform version info:

$ mvn -v
Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_24
Java home: /usr/lib/jvm/java-6-sun-
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-28-generic-pae" arch: "i386" Family: "unix"

It seems you os's filesystem does not support longer file names? That's sad.

bertvv commented May 27, 2011

I did some more research, the bug is in eCryptfs which I use to encrypt my home directory. Sad, indeed...


Closing this issue...

@bertvv bertvv closed this May 27, 2011
scotte commented Jun 23, 2012

It's not so much a bug in ecryptfs as it is a disagreement between ecryptfs and scala. There was a bug in ecryptfs where it did not correctly indicate max file name lengths. As of ubuntu 12.04 and derivatives, that bug is now fixed, but scala ignores that advice and continues to create outrageously long filenames - so now the bug is fully in scala's court.


The ubuntu maintainers agree with @scotte:

Please do create new bugs when an application generates filenames that are too long to be stored in an eCryptfs mount. The application may be able to use the statfs() syscall to check the filename length limits of eCryptfs.

I'm not actually a Scala guy (I just need to compile a Scala project), so I don't know how the tooling space around Scala looks, but it seems odd that this bug is listed on the NetBeans Scala project. Shouldn't the scala compiler configure itself with statfs()?

It's important to note that this really is an error on Scalas part, the hard limit for file name length on an unencrypted ext3 is 254 bytes, which is not massively larger than the 112 byte limit of ecryptfs. If Scala wants to compile on linux systems, it will need to take the max file name size into account.

Markovin commented Oct 1, 2012

Well, I got the same problem as very annoying and with no explanation as the file names have no visible illegal characters and are not too long and not copied or deleted and found good stuff at and also over here. Thanks

mjuhasz commented Oct 28, 2012

In Scala you can use the option "-Xmax-classfile-name " option to limit the maximum filename length for generated classes.

@bblfish bblfish pushed a commit to read-write-web/banana-rdf that referenced this issue May 16, 2014
@perspectivet perspectivet Fix for issue compiling with openjdk7, Fix for problem on ubuntu 12.0…
…4 w/ encrypted homes detailed in discussion here:dcaoyuan/nbscala#9
csaltos commented Feb 6, 2015

The option -Xmax-classfile-name set to 110 safe my Scala builds against filename too long. THANKS !! 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment