[JIRA] [unity3d-plugin] (JENKINS-30396) Incorrect Unity executable path "suffix" for OSX in 1.2 release

3 views
Skip to first unread message

lockarm@yahoo.com (JIRA)

unread,
Sep 10, 2015, 11:52:02 PM9/10/15
to jenkinsc...@googlegroups.com
Dickinson Lo created an issue
 
Jenkins / Bug JENKINS-30396
Incorrect Unity executable path "suffix" for OSX in 1.2 release
Issue Type: Bug Bug
Assignee: lacostej
Components: unity3d-plugin
Created: 11/Sep/15 3:51 AM
Environment: unity3d-plugin version 1.2
jenkins core version 1.619
Priority: Blocker Blocker
Reporter: Dickinson Lo

New version 1.2 seems to have introduced this bug:

====
FATAL: The configured Unity3d installation directory (/Applications/Unity/Unity.app) is not recognized as a Unity3d home directory. Remember that the plugin adds per-platform suffixes and is searching for the executable at /Applications/Unity/Unity.app/Editor/Unity.
====

That is not the correct path to Unity executable on OSX. It is "/Applications/Unity/Unity.app/Contents/MacOS/Unity"

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

flemming@joensson.org (JIRA)

unread,
Sep 11, 2015, 8:06:02 AM9/11/15
to jenkinsc...@googlegroups.com
Flemming Joensson commented on Bug JENKINS-30396
 
Re: Incorrect Unity executable path "suffix" for OSX in 1.2 release

Same here - unable to install and configure 1.2 due to this
The help text is correct for OSx, but the failure indicates that something is wrong.

https://www.dropbox.com/s/22ckebttczejxg8/Screenshot%202015-09-11%2014.04.06.png?dl=0

flemming@joensson.org (JIRA)

unread,
Sep 11, 2015, 8:07:01 AM9/11/15
to jenkinsc...@googlegroups.com
Flemming Joensson edited a comment on Bug JENKINS-30396
Same here - unable to install and configure 1.2 due to this
The help text is correct for OSx, but the failure indicates that something is  wrong  assymmetric between the check and the help .

https://www.dropbox.com/s/22ckebttczejxg8/Screenshot%202015-09-11%2014.04.06.png?dl=0

flemming@joensson.org (JIRA)

unread,
Sep 11, 2015, 9:22:03 AM9/11/15
to jenkinsc...@googlegroups.com

I did a little digging in the code - the problem is in Functions2 - the OS_NAME static is initialized too late.

When everything is static order is important.

class Functions2 {
public static boolean isMac()

{ return IS_OS_MAC; }

public static boolean isLinux()

{ return IS_OS_LINUX; }

private static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
private static final boolean IS_OS_MAC = getOSMatchesName("Mac");

private static final String OS_NAME = System.getProperty("os.name");
////

The first lines get initialized by calling getOSMatchesName

getOSMatchesName in turn calls isOSNameMatch(OS_NAME, osNamePrefix);

But at this point OS_NAME has not yet been initialized so all the checks fail because OS_NAME is null.

So when org.jenkinsci.plugins.unity3d.Unity3dInstallation#checkUnity3dExecutablePath calls org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#check which calls org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#getExeFile that does this check

private static File getExeFile(File unityHome) {
if (Functions.isWindows())

{ return new File(unityHome, "Editor/Unity.exe"); }

else if (Functions2.isMac())

{ return new File(unityHome, "Contents/MacOS/Unity"); }

else

{ // Linux assumed return new File(unityHome, "Editor/Unity"); }

}

You always end up getting the Linux path appended unless the Windows check is true.

Simply moving the OS_NAME initializer up to the first line in Functions2 will fix the problem (for Mac users)

flemming@joensson.org (JIRA)

unread,
Sep 11, 2015, 9:28:01 AM9/11/15
to jenkinsc...@googlegroups.com
Flemming Joensson edited a comment on Bug JENKINS-30396
I did a little digging in the code - the problem is in Functions2 - the OS_NAME static is initialized too late.  

When everything is static order is important.


{code:java}
class Functions2 {
public static boolean isMac() {
return IS_OS_MAC;
}
public static boolean isLinux() {
return IS_OS_LINUX;
}
    private static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
    private static final boolean IS_OS_MAC = getOSMatchesName("Mac");

    private static final String OS_NAME = System.getProperty("os.name");
{code}

////

The
 first  IS_OS_LINUX and IS_OS_MAC  lines get initialized by calling getOSMatchesName


getOSMatchesName in turn calls isOSNameMatch(OS_NAME, osNamePrefix);

But at this point OS_NAME has not yet been initialized so all the checks fail because OS_NAME is null.

So when org.jenkinsci.plugins.unity3d.Unity3dInstallation#checkUnity3dExecutablePath calls org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#check which calls  org.jenkinsci.plugins.unity3d.Unity3dInstallation.Unity3dExecutablePath#getExeFile that does this check


{code:java}
        private static File getExeFile(File unityHome) {
            if (Functions.isWindows()) {
                return new File(unityHome, "Editor/Unity.exe");
            } else if (Functions2.isMac()) {
                return new File(unityHome, "Contents/MacOS/Unity");
            } else { // Linux assumed
                return new File(unityHome, "Editor/Unity");
            }
        }
{code}


You always end up getting the Linux path appended unless the Windows check is true.

Simply moving Suggested Fix:
Move
 the OS_NAME initializer up to the first line in Functions2  will fix  so OS_NAME is  the  problem  first value initialized or drop the field completely and change 

{code:java}

    private static boolean getOSMatchesName
 ( for Mac users String osNamePrefix )  {
        return isOSNameMatch(OS_NAME, osNamePrefix);
    }
{code}

Into this:

{code:java}

    private static boolean getOSMatchesName(String osNamePrefix) {
        return isOSNameMatch(System.getProperty("os.name"), osNamePrefix);
    }
{code}

Both solutions should fix the issue for Mac users

scm_issue_link@java.net (JIRA)

unread,
Sep 11, 2015, 10:15:01 AM9/11/15
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Jerome Lacoste
Path:
src/main/java/org/jenkinsci/plugins/unity3d/Functions2.java
http://jenkins-ci.org/commit/unity3d-plugin/e7c8ad2bf825265a83b13787d2c796ad7c50c2fe
Log:
[FIXED JENKINS-30396] incorrect field initilization order broke Mac/Linux detection

scm_issue_link@java.net (JIRA)

unread,
Sep 11, 2015, 10:15:01 AM9/11/15
to jenkinsc...@googlegroups.com

lacostej@java.net (JIRA)

unread,
Sep 11, 2015, 10:16:02 AM9/11/15
to jenkinsc...@googlegroups.com
lacostej commented on Bug JENKINS-30396
 
Re: Incorrect Unity executable path "suffix" for OSX in 1.2 release

Really sorry about that. I only tested on Linux and didn't do the test on my own server... That will teach me from copy pasting things quickly.

Thanks a lot Flemming for the dig. Pushed a fix, and making a new release right now. Not sure how long it takes for the release to appear online.

flemming@joensson.org (JIRA)

unread,
Sep 11, 2015, 10:23:01 AM9/11/15
to jenkinsc...@googlegroups.com

Sweet - thank you for the quick fix and have a nice weekend

aries.sulit@gmail.com (JIRA)

unread,
Sep 9, 2019, 9:39:02 AM9/9/19
to jenkinsc...@googlegroups.com

HI, Is the fix already been pushed?

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages