Hello.
If the PS1 environment variable is set to a value like '$(echo hi)$ ', then the installation instructions for MSYS2 will not work properly. You will get "user shared memory size mismatch detected" errors on the step that updates bash.
This could be a big problem for people who have followed the usual procedure for integrating git with their command prompt, which involves putting '$(__git_ps1)' into PS1. In the wiki, I recommend adding "PS1=" to the beginning of the command that updates bash:
PS1= pacman --needed -S bash pacman pacman-mirrors msys2-runtime
A better solution might be if pacman itself fixed the PS1 for itself and all of its subprocesses.
I don't understand exactly why this is happening, but I would like to. I have seen the Cygwin FAQ about using multiple copies of the DLL here:
https://cygwin.com/faq/faq.html#faq.using.multiple-copies
It seems like after updating msys-2.0.dll, you need to be really careful to avoid starting any other processes that might want to use msys-2.0.dll. However, I don't understand why having '$(echo hi)' inside your PS1 would result in extra processes getting started; echo is a builtin command in Bash.
To reproduce the problem, I used a Windows 8.1 64-bit machine and followed the instructions in the wiki:
http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/
So I downloaded msys2-x86_64-20150202.exe and ran it, installing to the default location (C:\msys64). On the last screen of the installer, I unchecked the "Run MSYS2 64bit now" checkbox, and clicked "Finish". I made sure there are no files on my system like ~/.bash_profile that might run and mess up the environment. Then I ran "MSYS2 Shell" from my Start Menu and had the following interaction with it:
David@tantalum MSYS ~ $ export PS1='$(echo hi)$ ' hi$ pacman -Sy :: Synchronizing package databases... mingw32 229.6 KiB 803K/s 00:00 [######################] 100% mingw32.sig 96.0 B 0.00B/s 00:00 [######################] 100% mingw64 230.1 KiB 331K/s 00:01 [######################] 100% mingw64.sig 96.0 B 0.00B/s 00:00 [######################] 100% msys 123.0 KiB 484K/s 00:00 [######################] 100% msys.sig 96.0 B 0.00B/s 00:00 [######################] 100% hi$ pacman --needed -S bash pacman pacman-mirrors msys2-runtime warning: pacman-mirrors-20141223-1 is up to date -- skipping resolving dependencies... looking for conflicting packages... Packages (3) bash-4.3.033-2 msys2-runtime-2.1.0.16262.ac06895-1 pacman-4.2.0.6106.9b2114c-1 Total Download Size: 7.78 MiB Total Installed Size: 42.72 MiB Net Upgrade Size: 0.64 MiB :: Proceed with installation? [Y/n] :: Retrieving packages ... msys2-runtime-2.1.0... 2.3 MiB 1195K/s 00:02 [######################] 100% bash-4.3.033-2-x86_64 1864.9 KiB 1185K/s 00:02 [######################] 100% pacman-4.2.0.6106.9... 3.7 MiB 1073K/s 00:04 [######################] 100% (3/3) checking keys in keyring [######################] 100% (3/3) checking package integrity [######################] 100% (3/3) loading package files [######################] 100% (3/3) checking for file conflicts [######################] 100% (3/3) checking available disk space [######################] 100% (1/3) upgrading msys2-runtime [######################] 100% (2/3) upgrading bash [######################] 100% (3/3) upgrading pacman [######################] 100% 0 [main] bash 45404 C:\msys64\usr\bin\bash.exe: *** fatal error - user shared memory size mismatch detected - 0x11328/0x8A28. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. Stack trace: Frame Function Args 0000023CBC0 0018006FCCE (0018020B321, 0018020AE59, 00000008A28, 0000023BA20) 0000023CBC0 00180046E22 (0000023CA88, 00000110010, 0018020B12D, 00000000000) 0000023CBC0 00180046E62 (00180263FD5, 00000011328, 00000008A28, 00180254850) 0000023CBC0 00180048429 (001800473A0, 0000023CE00, 001800CAA68, 00000000000) 0000023CBC0 00180121675 (00000000000, 00000000000, 00000000000, 00000000000) 0000023CBC0 00180047415 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 0018004603C (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001800460D4 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001004D2161 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 00100401010 (00000000000, 00000000000, 00000000000, 00100401000) 00000000000 7FFCD6AC13D2 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 7FFCD935E954 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace 0 [main] bash 45868 fork: child -1 - forked process 45404 died unexpectedly, retry 0, exit code 0x100, errno 11 bash: fork: retry: No child processes 0 [main] bash 45548 C:\msys64\usr\bin\bash.exe: *** fatal error - user shared memory size mismatch detected - 0x11328/0x8A28. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. Stack trace: Frame Function Args 0000023CBC0 0018006FCCE (0018020B321, 0018020AE59, 00000008A28, 0000023BA20) 0000023CBC0 00180046E22 (0000023CA88, 00000110010, 0018020B12D, 00000000000) 0000023CBC0 00180046E62 (00180263FD5, 00000011328, 00000008A28, 00180254850) 0000023CBC0 00180048429 (001800473A0, 0000023CE00, 001800CAA68, 00000000000) 0000023CBC0 00180121675 (00000000000, 00000000000, 00000000000, 00000000000) 0000023CBC0 00180047415 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 0018004603C (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001800460D4 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 001004D2161 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 00100401010 (00000000000, 00000000000, 00000000000, 00100401000) 00000000000 7FFCD6AC13D2 (00000000000, 00000000000, 00000000000, 00000000000) 00000000000 7FFCD935E954 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace 1005193 [main] bash 45868 fork: child -1 - forked process 45548 died unexpectedly, retry 0, exit code 0x100, errno 11 bash: fork: retry: No child processes 0 [main] bash 45240 C:\msys64\usr\bin\bash.exe: *** fatal error - user sha
I could not really copy and paste the entire error message because for some reason MinTTY closes after a few seconds.
I should note that I was able to restart the MSYS2 Shell and it seemed to work fine, but I wouldn't trust it very much, of course.
I tested the same procedure without setting PS1 and it worked fine.
--David
Actually, I tried installing MSYS2 on another computer today and it turns out that you need to run a command sequence like this:
The simple "PS1=" prefix didn't work for me (resulting in Cygwin errors), probably because after pacman exited, the Bash shell tried to use PS1.
This was solved in a different way, pacman now upgrades
msys2-runtime
,bash
and some others in isolation from other packages. If we ever get rid of the post-install onfilesystem
, it should work without any fork issues.