
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
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
participants (2)
-
Phyx
-
Simon Peyton Jones