pathname with spaces causes problems for tcsh

Bob McGowan
Tue Mar 21 13:53:00 GMT 2000

I have the CD 1.0 with the same version of tcsh as the original poster. 
If I use double quotes around the path with spaces, there seems to be no
problem.  When I use a backslash to escape the spaces in the pathname, I
also have no problem.

But I did notice that the original poster gave the path name as /c/...
and I am wondering if the problem seen relates to this.  When I used the
//c/dir... format to change to "Multimedia Files" and typed pwd, it
printed out "/cygdrive/c/Multimedia Files" (expected) but "echo $PWD"
printed "/c/Multimedia Files".  This is clearly not correct.  The tests
I mentioned above used pathnames beginning with /cygpath/c/...  When I
repeated the tests using the //c... path name, the following happens:

   pushd "$PWD"  # errors with "no such file or directory"
   pushd $PWD    # errors with "pushd:  Too many arguments."

My only issue is that I cannot reproduce the setenv error mentioned in
the original post, nor can I get it to "work" with $PWD when I use "cd
//c/dir..." to change to the pathname with spaces.

So, spaces can be a problem but once input (through some quoting
mechanism), things should work, since the system now has a single null
terminated string to work with.  The spaces would only be problematic a
second time if they were passed in such a way that the string was
re-parsed by the shell as if it were a complete command line (or at
least an argument list).

Christos Zoulas wrote:
> On Mar 21, 12:52pm, (Earnie Boyd) wrote:
> -- Subject: Re: pathname with spaces causes problems for tcsh
> | Pathnames with spaces are a problem, period.  By the time that pushd got the
> | argument the backslashes had been removed and pushd passed to setenv more than
> | one argument thus the complaint.
> |
> | You'll have to modify the source of tcsh to fix this problem.
> |
> | Earnie.
> |
> | P.S.: This problem would exist on UNIX if the directory contained spaces.
> No it would not. chdir("foo bar") works fine as well as
> setenv/putenv("foo bar", "bar baz"). The problem is in the way
> the interface call to the win32 setenv is implemented.
> christos
> --
> Want to unsubscribe from this list?
> Send a message to

Bob McGowan
Staff Software Quality Engineer
VERITAS Software

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list