pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.33k stars 636 forks source link

"File too long" Exception when executing pants compile #7224

Closed alexandrebours closed 4 years ago

alexandrebours commented 5 years ago

OS: Linux Mint 18.3 Sylvia Java: build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12 Pants: 1.11.0rc2

When executing ./pant compile <project>, I'm getting the following error stack: (Note: "Nom de fichier trop long" translates into "Filename too long")

➜  mediarithmics-platform git:(master) JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ ./pants compile virtual-platform/virtual-platform-manager/app

11:19:41 00:00 [main]
               (To run a reporting server: ./pants server)
11:19:42 00:01   [setup]
11:19:42 00:01     [parse]
               Executing tasks in goals: bootstrap -> imports -> unpack-jars -> deferred-sources -> gen -> jvm-platform-validate -> resolve -> compile
11:19:42 00:01   [bootstrap]
11:19:42 00:01     [substitute-aliased-targets]
11:19:42 00:01     [jar-dependency-management]
11:19:42 00:01     [bootstrap-jvm-tools]
11:19:42 00:01     [provide-tools-jar]
11:19:42 00:01   [imports]
11:19:42 00:01     [ivy-imports]
11:19:42 00:01   [unpack-jars]
11:19:42 00:01     [unpack-jars]
11:19:42 00:01   [deferred-sources]
11:19:42 00:01     [deferred-sources]
11:19:42 00:01   [gen]
11:19:42 00:01     [antlr-java]
11:19:42 00:01     [antlr-py]
11:19:42 00:01     [jaxb]
11:19:42 00:01     [protoc]
11:19:42 00:01     [ragel]
11:19:42 00:01     [thrift-java]
11:19:42 00:01     [thrift-py]
11:19:42 00:01     [wire]
11:19:42 00:01     [yaml-template]
11:19:42 00:01     [twirl]
11:19:42 00:01     [controllers]
11:19:43 00:02     [routes]
11:19:43 00:02     [routers]
11:19:43 00:02     [scalapb-gen]
11:19:43 00:02     [jax-ws]
11:19:43 00:02   [jvm-platform-validate]
11:19:43 00:02     [jvm-platform-validate]WARN] No default jvm platform is defined.

11:19:43 00:02   [resolve]
11:19:43 00:02     [ivy]
11:19:43 00:02     [coursier]
11:19:43 00:02   [compile]
11:19:43 00:02     [compile-jvm-prep-command]
11:19:43 00:02       [jvm_prep_command]
11:19:43 00:02     [compile-prep-command]
11:19:43 00:02     [compile]
11:19:43 00:02     [rsc]
11:19:43 00:02     [zinc]
11:19:43 00:02       [cache]                                     
                   No cached artifacts for 37 targets.
                   Invalidated 37 targets.
11:19:43 00:02       [isolation-zinc-pool-bootstrap]        
                   [ 1/37] Compiling 6 zinc sources in 1 target (mediarithmics-public-api/reference-api/src/main/java:java).
                   [ 2/37] Compiling 5 zinc sources in 1 target (mediarithmics-api/common-json-api/src/main/java:java).
                   [ 3/37] Compiling 15 zinc sources in 1 target (mediarithmics-public-api/common-public-api/src/main/scala:scala).
                   [ 4/37] Compiling 1 zinc source in 1 target (types/organisation/src/main/scala:scala).
                   [ 5/37] Compiling 8 zinc sources in 1 target (mediarithmics-public-api/core-api/src/main/java:java).
                   [ 6/37] Compiling 7 zinc sources in 1 target (types/plugin/src/main/scala:scala).
                   [ 7/37] Compiling 2 zinc sources in 1 target (types/adexchange/src/main/scala:scala).
                   [ 8/37] Compiling 25 zinc sources in 1 target (libs/common/src/main/scala:scala).
11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02       [compile]

11:19:43 00:02         [cache] 
                     No cached artifacts for 1 target.
                     Invalidated 1 target.
11:19:43 00:02         [cache].
                       ==== stderr ====
                       Unexpected problem writing target jar /home/abours/dev/mediarithmics-platform/.pants.d/bootstrap/bootstrap-jvm-tools/tool_cache/binary_jars/org.pantsbuild.zinc.bootstrapper.Main-7e594ff1fb53695a1725022a585649ea2a74bcb4-ShadedToolFingerprintStrategy_194c72d51d61.jar: java.io.IOException: Nom de fichier trop long

                       ==== stdout ====

11:19:43 00:02         [cache] 
                     No cached artifacts for 1 target.
                     Invalidated 1 target.
11:19:43 00:02         [cache]
                   compile(mediarithmics-public-api/common-public-api/src/main/scala:scala) failed: jar-tool failed.
                       ==== stderr ====
                       Unexpected problem writing target jar /home/abours/dev/mediarithmics-platform/.pants.d/bootstrap/bootstrap-jvm-tools/tool_cache/binary_jars/org.pantsbuild.zinc.bootstrapper.Main-7e594ff1fb53695a1725022a585649ea2a74bcb4-ShadedToolFingerprintStrategy_194c72d51d61.jar: java.io.IOException: Nom de fichier trop long

                       ==== stdout ====

Hereunder are my partitions and filesystems. My project is located in an encrypted partition.

➜  ~ df -Th                                                                                                                                                                                                                                
Sys. de fichiers          Type     Taille Utilisé Dispo Uti% Monté sur
udev                      devtmpfs    16G       0   16G   0% /dev
tmpfs                     tmpfs      3,2G    9,5M  3,2G   1% /run
/dev/mapper/mint--vg-root ext4       198G     57G  131G  31% /
tmpfs                     tmpfs       16G    1,3G   15G   8% /dev/shm
tmpfs                     tmpfs      5,0M    4,0K  5,0M   1% /run/lock
tmpfs                     tmpfs       16G       0   16G   0% /sys/fs/cgroup
/dev/nvme0n1p1            ext2       472M     68M  380M  16% /boot
cgmfs                     tmpfs      100K       0  100K   0% /run/cgmanager/fs
/dev/sda                  ext4       917G    311G  560G  36% /data
tmpfs                     tmpfs      3,2G     52K  3,2G   1% /run/user/1000
/home/abours/.Private     ecryptfs   198G     57G  131G  31% /home/abours
/dev/sdb1                 vfat        15G    306M   15G   3% /media/abours/5191-AA0C

Additional info on my system limitations:

➜  ~ getconf NAME_MAX /dev/sda
255
➜  ~ getconf PATH_MAX /dev/sda
4096
➜  ~ cat /usr/include/linux/limits.h
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H

#define NR_OPEN         1024

#define NGROUPS_MAX    65536    /* supplemental group IDs are available */
#define ARG_MAX       131072    /* # bytes of args + environ for exec() */
#define LINK_MAX         127    /* # links a file may have */
#define MAX_CANON        255    /* size of the canonical input queue */
#define MAX_INPUT        255    /* size of the type-ahead buffer */
#define NAME_MAX         255    /* # chars in a file name */
#define PATH_MAX        4096    /* # chars in a path name including nul */
#define PIPE_BUF        4096    /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */

#define RTSIG_MAX     32

#endif

Also, note that when I'm trying to create the file with linux, it works without issue on the filename length:

➜  ~ touch /home/abours/dev/mediarithmics-platform/.pants.d/bootstrap/bootstrap-jvm-tools/tool_cache/binary_jars/org.pantsbuild.zinc.bootstrapper.Main-7e594ff1fb53695a1725022a585649ea2a74bcb4-ShadedToolFingerprintStrategy_194c72d51d61.jar
➜  ~ ls /home/abours/dev/mediarithmics-platform/.pants.d/bootstrap/bootstrap-jvm-tools/tool_cache/binary_jars/org.pantsbuild.zinc.bootstrapper.Main-7e594ff1fb53695a1725022a585649ea2a74bcb4-ShadedToolFingerprintStrategy_194c72d51d61.jar
/home/abours/dev/mediarithmics-platform/.pants.d/bootstrap/bootstrap-jvm-tools/tool_cache/binary_jars/org.pantsbuild.zinc.bootstrapper.Main-7e594ff1fb53695a1725022a585649ea2a74bcb4-ShadedToolFingerprintStrategy_194c72d51d61.jar

Thank you for your help!

jsirois commented 5 years ago

Drawing attention to:

...
/home/abours/.Private     ecryptfs   198G     57G  131G  31% /home/abours

So this case does involve an encrypted directory as opposed to partition which should trigger NAME_MAX being lower than expected due to ecryptfs internals using up ~100 bytes of that limit in overhead. This does not jive with the manual touch example in the problem description however.