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.

Bug 267656

Summary: No Shell found when Msys2 and Mingw-w64 are installed, and path variables set.
Product: cnd Reporter: g.mann
Component: executionAssignee: Alexander Simon <alexvsimon>
Status: RESOLVED FIXED    
Severity: normal CC: g.mann
Priority: P1    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log

Description g.mann 2016-08-20 20:13:40 UTC
Reproducibility: Happens every time

I have installed Msys2, and used Msys2 to install Mingw-w64 and it's toolkit. Netbeans knows where the c++ compiler is, and the make command. When trying to run a simple "Hello World" file, every time 2 windows pop up." Preparing to build on localhost", and "No shell found. Cannot proceed. Please install CYGWIN or Msys." I have also let the system wide path variables of my system to C:\msys64;C:\msys64\usr\bin;C:\msys64\mingw64\bin. I am wondering why NetBeans refuses to compile.
Comment 1 g.mann 2016-08-20 20:13:45 UTC
Created attachment 161732 [details]
IDE log
Comment 2 Alexander Simon 2016-08-22 16:15:29 UTC
It seems the line:

} else if (new File(parent, "msysinfo").exists()) { // NOI18N

in the file "WindowsSupport" does not work for MSYS2
Comment 3 Alexander Simon 2016-08-22 16:47:36 UTC
Investigation.
1. IDE search for MSYS shell in known registry (SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1). It does not work for MSYS2. It use registry key like this:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\{9bf39a76-3994-4d72-82bf-4287efaf4642}
which contains strings:
Comments: MSYS2 64bit
DisplayName: MSYS2 64bit
InstallLocation: C:\msys64
UninstallString: C:\msys64\maintenancetool.exe

2. If IDE did not find shell, IDE try to find shell in paths. IDE check that folder with sh.exe also has a file "msysinfo". It does not work for MSYS2.
It seems IDE should check "msys-2.0.dll" instead.
Or check "../../maintenancetool.exe"
Comment 4 Alexander Simon 2016-09-12 14:54:59 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/21c328919654
Comment 5 g.mann 2016-09-12 15:05:34 UTC
(In reply to Alexander Simon from comment #4)
> fixed, change set:
> http://hg.netbeans.org/cnd-main/rev/21c328919654

Great! When will I be able to download this, or how do I download it?
Comment 6 Alexander Simon 2016-09-12 16:37:39 UTC
(In reply to g.mann from comment #5)
> (In reply to Alexander Simon from comment #4)
> > fixed, change set:
> > http://hg.netbeans.org/cnd-main/rev/21c328919654
> 
> Great! When will I be able to download this, or how do I download it?
It is expected that NetBeans nightly build will add comment with build number with the fix.
Comment 7 Quality Engineering 2016-09-13 02:02:49 UTC
Integrated into 'main-silver', will be available in build *201609130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/21c328919654
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #267656 No Shell found when Msys2 and Mingw-w64 are installed, and path variables set.
Comment 8 Quality Engineering 2016-09-14 02:06:45 UTC
Integrated into 'main-silver', will be available in build *201609140002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/91822f04b83c
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #267656 No Shell found when Msys2 and Mingw-w64 are installed, and path variables set.
- additional fix (IDE think that msys2 is cygwin)
Comment 9 Alexander Pepin 2016-09-14 14:02:45 UTC
additional fix (IDE think that msys2 is cygwin) is verified in RC build. The original issue is not reproducible as it requires a very specific NB/CND installation according to the provided IDE log.
Comment 10 laca 2017-03-23 12:54:45 UTC
I've played with this for a while when got that "No shell found" message.

I found that my path was set before like this:

%PERL%\CORE_PERL;%MINGW_HOME%\BIN;%MSYS_HOME%\BIN;%MSYS_HOME%\LOCAL\BIN;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\INTEL\ICLS CLIENT\;C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH;%SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;...

And this produced "No shell...".

After I changed path to this:

c:\msys64\usr\bin;%PERL%\CORE_PERL;%MINGW_HOME%\BIN;%MSYS_HOME%\BIN;%MSYS_HOME%\LOCAL\BIN;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\INTEL\ICLS CLIENT\;C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH;%SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;...

it started to work. This clearly indicates some path parsing bug since 'c:\msys64\usr\bin' is practically the same as %MSYS_HOME%\BIN on my system (%MSYS_HOME% is 'c:\msys64\usr').

One more difference I noticed was the 'BIN' vs 'bin'. After I changed path to 

%PERL%\CORE_PERL;%MINGW_HOME%\BIN;%MSYS_HOME%\bin;%MSYS_HOME%\LOCAL\BIN;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\INTEL\ICLS CLIENT\;C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH;%SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;...

it started to work again! The case change (BIN->bin) was enough to make it work. 
On Windows it should not be a problem.
Comment 11 Alexander Simon 2017-04-23 11:10:35 UTC
laca,

Please create separate bug with your problem.

Thanks for understanding,
Alexander