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

View: New views
2 Messages — Rating Filter:   Alert me  

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

by Jeremy Elson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Corinna Vinschen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov  2 08:32, Jeremy Elson wrote:
> 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

Very wrong mailing list.  See http://cygwin.com/lists.html

This is an upstream bug which has been fixed long ago.  The
/etc/defaults/etc/profile.d/complete.tcsh of tcsh in the 1.7 distro does
not have the bug.  Just replace your /etc/profile.d/complete.tcsh with
that one.


Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat