Saturday, December 09, 2006

 

Cygwin shell hangs upon upgrade

I just updated my cygwin installation and it stopped working: on startup any cygwin shell hangs.

Quick Internet search revealed nothing, so a little research of my own was in order...

It appears that cygwin shell startup files insist that file /bin/sh be a copy of /bin/bash. This logic is coded into file /etc/profile.d/00bash.sh :

# Get here if missing, broken, ash, or old bash, so an update is needed.
# Use copy, not hard or symlink, since symlinks won't work from Windows cmd
# and a hardlink to a running shell can't be broken. Try in-place copy
# first, but fall back to --remove-destination in case /bin/sh has different
# ACLs than /bin/bash. Record the attempt in /var/log/setup.log.full.
echo "`date '+%Y/%m/%d %T'` /etc/profile.d/00bash.sh:" "Attempting to update /bin/sh.exe" >> /var/log/setup.log.full 2>&1
{ /bin/cp -fpuv /bin/bash.exe /bin/sh.exe ||
/bin/cp -puv --remove-destination /bin/bash.exe /bin/sh.exe
} >> /var/log/setup.log.full 2>&1

On the other hand, cygwin upgrade only changes /bin/bash and not /bin/sh, thus triggering the above code (and more) to execute, and this was apparently causing hang (I didn't look into where exactly).

Therefore, it this happens to you, reboot your machine, and immediately afterwards, before any cygwin applications can initiate, do this (or similar depending on where your cygwin installation is)

copy /B c:\cygwin\bin\bash.exe c:\cygwin\bin\sh.exe

Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?