Tamar I've noticed that "sh" (which is invoked at lot by make etc) takes AGES to start up. At least I think it's 'sh' that is causing the delay. I think it's c:/msys64/usr/bin/sh.exe
From searching the web (eg https://www2.cs.duke.edu/csl/docs/unix_course/intro-60.html) it seems likely that it executes c:/msys64/etc/profile first. And If I put an 'echo' at the start and end of that file, they do seem to take place with a significant gap between them. I have not started sprinkling more echos, but does that ring any bells? Can I replace 'sh' with c:/msys64/usr/bin/bash.exe, which seems to be faster? (My evnt variable SHELL already points to bash.exe. ) And if so, how would I do that? An environment variable. Physically copy bash.exe to sh.exe? Or what? Thanks Simon
Hi Simon, Hmm I'm not sure about replacing sh with bash. I think bash has some Non-POSIX extensions that may affect the behavior of valid posix scripts. Is bash --login slow as well? How about once sh or bash starts, are commands still slow then? I assume your computer is domain joined and you may be hitting a very long standing issue with certain domain joined machines https://github.com/Alexpux/MSYS2-packages/issues/138#issuecomment-70813762 The solution seems to be to cache the user info locally instead of it having to query the domain controller everytime. See solution 2 here https://gist.github.com/k-takata/9b8d143f0f3fef5abdab for instructions Does that help the problem? I believe you had a similar problem last time setting up a new machine. At that time magit was also slow. Kind regards, Tamar On Mon, Apr 2, 2018, 23:23 Simon Peyton Jones <simonpj@microsoft.com> wrote:
Tamar
I’ve noticed that “sh” (which is invoked at lot by make etc) takes AGES to start up. At least I think it’s ‘sh’ that is causing the delay.
I think it’s c:/msys64/usr/bin/sh.exe
From searching the web (eg https://www2.cs.duke.edu/csl/docs/unix_course/intro-60.html) it seems likely that it executes c:/msys64/etc/profile first.
And If I put an ‘echo’ at the start and end of that file, they do seem to take place with a significant gap between them.
I have not started sprinkling more echos, but does that ring any bells?
Can I replace ‘sh’ with c:/msys64/usr/bin/bash.exe, which seems to be faster? (My evnt variable SHELL already points to bash.exe. ) And if so, how would I do that? An environment variable. Physically copy bash.exe to sh.exe? Or what?
Thanks
Simon
The solution seems to be to cache the user info locally instead of it having to query the domain controller everytime. Ah yes: here’s a better expressed post: http://bjg.io/guide/cygwin-ad/ I did the following * commented out the “db” part for passwd and group in c:/msys64/etc/nsswitch.conf, to give this: # Begin /etc/nsswitch.conf passwd: files #db group: files #db db_enum: cache builtin db_home: windows db_shell: cygwin desc db_gecos: cygwin desc # End /etc/nsswitch.conf * Note that I also set db_home to ‘windows’, so that it gets my windows home directory. I think an explicit path would also be OK * However I discovered that having just “files” for “passwd” in nsswitch.conf means that ssh looks in c:/msys64/etc/passwd to find the home directory for .ssh, totally ignoring the $HOME environment variable, and ignoring the db_home setting. * But there IS no /etc/passwd file! So I created one mkpasswd -c > /etc/passwd mkgroup -c > /etc/group And then I manually edited /etc/passwd to put in the correct home directory. What a saga! Is it faster now? Hard to tell. Simon From: Phyx <lonetiger@gmail.com> Sent: 03 April 2018 07:00 To: Simon Peyton Jones <simonpj@microsoft.com> Cc: ghc-devs@haskell.org Subject: Re: More windows Hi Simon, Hmm I'm not sure about replacing sh with bash. I think bash has some Non-POSIX extensions that may affect the behavior of valid posix scripts. Is bash --login slow as well? How about once sh or bash starts, are commands still slow then? I assume your computer is domain joined and you may be hitting a very long standing issue with certain domain joined machines https://github.com/Alexpux/MSYS2-packages/issues/138#issuecomment-70813762<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAlexpux%2FMSYS2-packages%2Fissues%2F138%23issuecomment-70813762&data=02%7C01%7Csimonpj%40microsoft.com%7C185492e20be9494ebdf008d599282bcd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636583320164876915&sdata=MYHQSKqds%2FJXXEkX1jXF2psZmZntrrgtBqEUXtfGQBs%3D&reserved=0> The solution seems to be to cache the user info locally instead of it having to query the domain controller everytime. See solution 2 here https://gist.github.com/k-takata/9b8d143f0f3fef5abdab<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fk-takata%2F9b8d143f0f3fef5abdab&data=02%7C01%7Csimonpj%40microsoft.com%7C185492e20be9494ebdf008d599282bcd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636583320164876915&sdata=Qb1BMV9NoSijP%2F%2F5e4ZNNJ%2FGHhMrGksFTM6eVRL4dQQ%3D&reserved=0> for instructions Does that help the problem? I believe you had a similar problem last time setting up a new machine. At that time magit was also slow. Kind regards, Tamar On Mon, Apr 2, 2018, 23:23 Simon Peyton Jones <simonpj@microsoft.com<mailto:simonpj@microsoft.com>> wrote: Tamar I’ve noticed that “sh” (which is invoked at lot by make etc) takes AGES to start up. At least I think it’s ‘sh’ that is causing the delay. I think it’s c:/msys64/usr/bin/sh.exe From searching the web (eg https://www2.cs.duke.edu/csl/docs/unix_course/intro-60.html<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww2.cs.duke.edu%2Fcsl%2Fdocs%2Funix_course%2Fintro-60.html&data=02%7C01%7Csimonpj%40microsoft.com%7C185492e20be9494ebdf008d599282bcd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636583320164876915&sdata=74ecRU4VAdzlHW1Tjul6VEqdxsEsnd7xBSYnMoYsqfg%3D&reserved=0>) it seems likely that it executes c:/msys64/etc/profile first. And If I put an ‘echo’ at the start and end of that file, they do seem to take place with a significant gap between them. I have not started sprinkling more echos, but does that ring any bells? Can I replace ‘sh’ with c:/msys64/usr/bin/bash.exe, which seems to be faster? (My evnt variable SHELL already points to bash.exe. ) And if so, how would I do that? An environment variable. Physically copy bash.exe to sh.exe? Or what? Thanks Simon
participants (2)
-
Phyx -
Simon Peyton Jones