This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 176526
Collapse All | Expand All

(-)a/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh (-1 / +1 lines)
Lines 65-71 Link Here
65
USER=${USER:-`logname 2>/dev/null`}
65
USER=${USER:-`logname 2>/dev/null`}
66
USER=${USER:-${USERNAME}}
66
USER=${USER:-${USERNAME}}
67
TMPBASE=${TMPBASE:-/var/tmp}
67
TMPBASE=${TMPBASE:-/var/tmp}
68
TMPDIRBASE=${TMPBASE}/dlight_${USER}
68
TMPDIRBASE=${TMPBASE}/dlight_${USER}/${NB_KEY}
69
mkdir -p "${TMPDIRBASE}"
69
mkdir -p "${TMPDIRBASE}"
70
70
71
echo BITNESS=${BITNESS}
71
echo BITNESS=${BITNESS}
(-)a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java (+17 lines)
Lines 39-44 Link Here
39
package org.netbeans.modules.nativeexecution.support.hostinfo.impl;
39
package org.netbeans.modules.nativeexecution.support.hostinfo.impl;
40
40
41
import java.io.File;
41
import java.io.File;
42
import java.net.InetAddress;
43
import java.net.UnknownHostException;
42
import java.text.DateFormat;
44
import java.text.DateFormat;
43
import java.text.ParseException;
45
import java.text.ParseException;
44
import java.text.SimpleDateFormat;
46
import java.text.SimpleDateFormat;
Lines 217-220 Link Here
217
            this.name = name;
219
            this.name = name;
218
        }
220
        }
219
    }
221
    }
222
223
    /**
224
     * @return unique key of the current NB instance, introduced to fix bug #176526
225
     */
226
    /*package-local*/ static String getNBKey() {
227
        // use NB userdir to prevent local collisions
228
        int hashCode = System.getProperty("netbeans.user", "").hashCode();
229
        try {
230
            // use host name to prevent remote collisions
231
            InetAddress localhost = InetAddress.getLocalHost();
232
            hashCode = 3 * hashCode + 5 * localhost.getHostName().hashCode();
233
        } catch (UnknownHostException ex) {
234
        }
235
        return Integer.toHexString(hashCode);
236
    }
220
}
237
}
(-)a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/UnixHostInfoProvider.java (+5 lines)
Lines 109-114 Link Here
109
109
110
            pb.environment().put("TMPBASE", tmpDirBase); // NOI18N
110
            pb.environment().put("TMPBASE", tmpDirBase); // NOI18N
111
            pb.environment().put("PATH", pb.environment().get("PATH") + File.pathSeparator + "/bin:/usr/bin"); // NOI18N
111
            pb.environment().put("PATH", pb.environment().get("PATH") + File.pathSeparator + "/bin:/usr/bin"); // NOI18N
112
            pb.environment().put("NB_KEY", HostInfoFactory.getNBKey());
112
113
113
            Process hostinfoProcess = pb.start();
114
            Process hostinfoProcess = pb.start();
114
115
Lines 165-170 Link Here
165
                hiOutputStream = echannel.getOutputStream();
166
                hiOutputStream = echannel.getOutputStream();
166
                hiInputStream = echannel.getInputStream();
167
                hiInputStream = echannel.getInputStream();
167
168
169
                // echannel.setEnv() didn't work, so writing this directly
170
                hiOutputStream.write(("NB_KEY=" + HostInfoFactory.getNBKey() + '\n').getBytes()); // NOI18N
171
                hiOutputStream.flush();
172
168
                BufferedReader scriptReader = new BufferedReader(new FileReader(hostinfoScript));
173
                BufferedReader scriptReader = new BufferedReader(new FileReader(hostinfoScript));
169
                String scriptLine = scriptReader.readLine();
174
                String scriptLine = scriptReader.readLine();
170
175
(-)a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/WindowsHostInfoProvider.java (+2 lines)
Lines 110-115 Link Here
110
110
111
            _tmpDirFile = new File(ioTmpDir, "dlight_" + env.get("USERNAME")); // NOI18N
111
            _tmpDirFile = new File(ioTmpDir, "dlight_" + env.get("USERNAME")); // NOI18N
112
112
113
            _tmpDirFile = new File(_tmpDirFile, HostInfoFactory.getNBKey());
114
113
            // create the directory if absent (IZ#174327)
115
            // create the directory if absent (IZ#174327)
114
            _tmpDirFile.mkdirs();
116
            _tmpDirFile.mkdirs();
115
117

Return to bug 176526