Subject: tcsh problems with Cygwin on 64-bit Windows Server 2008
From: [email-masked] (Freddy Jensen)
To: [email-masked]
Cc: [email-masked]
Date: Mon, 5 Jan 2009 11:50:48 -0800
List-Id: <cygwin.cygwin.com>

I just finished setting up my new 64-bit Windows Server 2008 machine.
One of the final things was to install cygwin on the machine so I
could get all the Unix functionality. However, I ran into a problem
when launching the tcsh shell. I got this error:

"Badly placed ()'s",  and the shell stopped reading the startup file.

I have tracked this down to one element of the PATH environment variables,
namely this one: /cygdrive/c/Program Files ( x86 ) /Microsoft ...."

What happens is that on 64 bit WinServ-2008 the installers for various
programs put native 64-bit applications into C:\Program Files\... and
32-bit applications into C:\Program Files ( x86 ) \... and the installers
then add the path into the environment variables for the user.

When you start a CMD window then the DOS command inherits all the env
vars, including the PATH variable and then when you launch the tcsh
it first reads this file:

/etc/profile.d/lapack.csh

Inside that file there is a loop that evaluates each
path element and it finally chokes on

"/cygdrive/c/Program Files ( x86 ) /Microsoft ...."

because the parens have special meaning to tcsh unless
they are escaped. In my opinion it is a bug in cygwin's
/etc/profile.d/lapack.csh profile script.

Work-around:

After a little fiddling I found out how to work around this problem
without having to modify the cygwin file: /etc/profile.d/lapack.csh:

The only thing that lapack.csh does is to add /usr/lib/lapack to the
path if it is not already there. 

So instead of hacking up /etc/profile.d/lapack.csh I just added this
line to my tcsh batch startup file:

set PATH=

Of course, then I have to make sure that all the other required
paths get added back in so that the tcsh can function correctly.
So basically my Cygwin-tcsh.bat script looks like this now:

---------------------------------------------------------------------
@echo off

C:
chdir C:\cygwin\bin

set HOME=//picard2/jensen

rem Clear PATH to prevent tcsh from choking on "Program Files (x86)"
rem in the file: c:\cygwin\etc\profile.d\lapack.csh

set PATH=

tcsh -i
---------------------------------------------------------------------

where "picard2" is my samba server that connect me to my Unix home dir.

Then in my $HOME/.cshrc file I set up the path like this:

 set path =                     \
 ( $HOME/bin                    \      My own shell scripts
   $HOME/bin/ix86win32          \      My own win and batch scripts
   /usr/local/bin               \      Part of cygwin installation
   /usr/bin                     \      Part of cygwin installation
   /bin                         \      Part of cygwin installation
   /usr/X11R6/bin               \      Part of cygwin installation
   /usr/sbin                    \      Part of cygwin installation
   /sbin                        \      Part of cygwin installation
   /usr/lib/lapack              \      Part of cygwin installation
   /cygdrive/c/Windows/system32 \      Cmd batch scripts for WinServ-08
   /cygdrive/c/Windows          \      Cmd batch scripts for WinServ-08
   /cygdrive/c/WINDOWS/system32 \      Cmd batch scripts for Windows-XP
   /cygdrive/c/WINDOWS          \      Cmd batch scripts for Windows-XP
   /cygdrive/c/Programs/Sysinternals ) Where I installed the Sysinternals Suite

Notice that the comments after each backslash are not present
in my .cshrc, otherwise the '\' wouldn't work correctly.

Of course, long term, it would be desirable to have a better
solution that is less of a hack. I am open for suggestions.

Thanks

--
Freddy Jensen, Sr. Computer Scientist, Adobe Systems Incorporated
345 Park Avenue, San Jose, CA 95110-2704, USA, Ph: (408) 536-2869
Email: [email-masked], URL: http://www.adobe.com
--

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/