patch: Protect tcsh init scripts against home dirs with spaces in them

Jeremy Elson jelson@gmail.com
Mon Nov 2 16:33:00 GMT 2009


Hi,
I'm not sure if this is a cygwin bug or an upstream bug, but I've
found a bug in the latest
cygwin 1.7 beta that prevents tcsh from initializing correctly in home
directories with spaces
in them.  A Windows username with a space (e.g., "John Doe") produces
a home directory
with a space, so this is a pretty common case.

The patch below uses double-quotes to protect a filename with a space
from becoming two
arguments in /etc/profile.d/complete.tcsh.  Most of that script is
already similarly protected
but this one was overlooked.  Starting tcsh without this patch on a
home directory that
contains a space just generates an error of "if: Expression syntax",
and the rest of the init
scripts fail.

Thanks,
Jeremy Elson

--- /etc/profile.d/complete.tcsh~       2009-09-13 00:42:57.289250000 -0700
+++ /etc/profile.d/complete.tcsh        2009-11-02 08:12:26.278608500 -0800
@@ -39,7 +39,7 @@ if ($?_complete) then
     set noglob
     if ( ! $?hosts ) set hosts
     foreach f ("$HOME/.hosts" /usr/local/etc/csh.hosts
"$HOME/.rhosts" /etc/hosts.equiv)
-        if ( -r $f ) then
+        if ( -r "$f" ) then
            set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr
-s " " " " | cut -f 1`)
        endif
     end



More information about the Cygwin-patches mailing list