diff -r bc7097419dfd dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh --- a/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh Thu Nov 12 17:45:13 2009 +0300 +++ b/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh Thu Nov 12 21:23:35 2009 +0300 @@ -65,7 +65,7 @@ USER=${USER:-`logname 2>/dev/null`} USER=${USER:-${USERNAME}} TMPBASE=${TMPBASE:-/var/tmp} -TMPDIRBASE=${TMPBASE}/dlight_${USER} +TMPDIRBASE=${TMPBASE}/dlight_${USER}/${NB_KEY} mkdir -p "${TMPDIRBASE}" echo BITNESS=${BITNESS} diff -r bc7097419dfd dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java --- a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java Thu Nov 12 17:45:13 2009 +0300 +++ b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/HostInfoFactory.java Thu Nov 12 21:23:35 2009 +0300 @@ -39,6 +39,8 @@ package org.netbeans.modules.nativeexecution.support.hostinfo.impl; import java.io.File; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -217,4 +219,19 @@ this.name = name; } } + + /** + * @return unique key of the current NB instance, introduced to fix bug #176526 + */ + /*package-local*/ static String getNBKey() { + // use NB userdir to prevent local collisions + int hashCode = System.getProperty("netbeans.user", "").hashCode(); + try { + // use host name to prevent remote collisions + InetAddress localhost = InetAddress.getLocalHost(); + hashCode = 3 * hashCode + 5 * localhost.getHostName().hashCode(); + } catch (UnknownHostException ex) { + } + return Integer.toHexString(hashCode); + } } diff -r bc7097419dfd dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/UnixHostInfoProvider.java --- a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/UnixHostInfoProvider.java Thu Nov 12 17:45:13 2009 +0300 +++ b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/UnixHostInfoProvider.java Thu Nov 12 21:23:35 2009 +0300 @@ -109,6 +109,7 @@ pb.environment().put("TMPBASE", tmpDirBase); // NOI18N pb.environment().put("PATH", pb.environment().get("PATH") + File.pathSeparator + "/bin:/usr/bin"); // NOI18N + pb.environment().put("NB_KEY", HostInfoFactory.getNBKey()); Process hostinfoProcess = pb.start(); @@ -165,6 +166,10 @@ hiOutputStream = echannel.getOutputStream(); hiInputStream = echannel.getInputStream(); + // echannel.setEnv() didn't work, so writing this directly + hiOutputStream.write(("NB_KEY=" + HostInfoFactory.getNBKey() + '\n').getBytes()); // NOI18N + hiOutputStream.flush(); + BufferedReader scriptReader = new BufferedReader(new FileReader(hostinfoScript)); String scriptLine = scriptReader.readLine(); diff -r bc7097419dfd dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/WindowsHostInfoProvider.java --- a/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/WindowsHostInfoProvider.java Thu Nov 12 17:45:13 2009 +0300 +++ b/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/support/hostinfo/impl/WindowsHostInfoProvider.java Thu Nov 12 21:23:35 2009 +0300 @@ -110,6 +110,8 @@ _tmpDirFile = new File(ioTmpDir, "dlight_" + env.get("USERNAME")); // NOI18N + _tmpDirFile = new File(_tmpDirFile, HostInfoFactory.getNBKey()); + // create the directory if absent (IZ#174327) _tmpDirFile.mkdirs();