Reid Madsen created MNG-7500:
--------------------------------

             Summary: Maven fails to load jansi library when /tmp is set to 
"noexec"
                 Key: MNG-7500
                 URL: https://issues.apache.org/jira/browse/MNG-7500
             Project: Maven
          Issue Type: Bug
    Affects Versions: 3.8.6
         Environment: fs@c7cbagent01 :~$ uname -a
Linux c7cbagent01 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 
2022 x86_64 x86_64 x86_64 GNU/Linux 

fs@c7cbagent01 :~$ cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
            Reporter: Reid Madsen


All of our CICD build servers (CentOS 7) are configured with /tmp being set to 
'noexec'.  In that environment when I run maven (v3.8.6) I get the following 
error:
{code:java}
fs@c7cbagent01 :~$ mvn --version
Failed to load native library:jansi-2.4.0-14d515591f448fb6-libjansi.so. The 
native library file at /tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so is not 
executable, make sure that the directory is mounted on a partition without the 
noexec flag, or set the jansi.tmpdir system property to point to a proper 
location.  osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: /tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so: 
/tmp/jansi-2.4.0-14d515591f448fb6-libjansi.so: failed to map segment from 
shared object: Operation not permitted
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/maven
Java version: 1.8.0_332, vendor: Red Hat, Inc., runtime: 
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.62.1.el7.x86_64", arch: "amd64", 
family: "unix" {code}
Host/OS information:
{code:java}
fs@c7cbagent01 :~$ uname -a
Linux c7cbagent01 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 
2022 x86_64 x86_64 x86_64 GNU/Linux 

fs@c7cbagent01 :~$ cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core){code}
Filesystem config for /tmp:
{code:java}
fs@c7cbagent01 :~$ cat /etc/fstab | grep tmp
/dev/mapper/rootvg-tmplv /tmp                    xfs     nodev,nosuid,noexec 0 0
/tmp            /var/tmp        none    bind        0 0
tmpfs            /dev/shm        tmpfs    nodev,nosuid,noexec        0 0 {code}
So, as per instructions in error message, I tried:
{code:java}
fs@c7cbagent01 :~$ mkdir ~/tmp
fs@c7cbagent01 :~$ chmod 777 ~/tmp

fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp --version
<SAME ERROR AS ABOVE>

fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp -Djava.io.tmpdir=~/tmp--version
<SAME ERROR AS ABOVE>

fs@c7cbagent01 :~$ export TMPDIR=~/tmp
fs@c7cbagent01 :~$ mvn -Djansi.tmpdir=~/tmp -Djava.io.tmpdir=~/tmp--version
<SAME ERROR AS ABOVE>{code}
So, pray tell, what do I need to do to work around this issue.

It also appears that setting /tmp as 'noexec' is a common security feature.  
Perhaps maven should establish a location outside of /tmp for the extraction of 
these libraries.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to