rsh & tar

Guy Harris guy at auspex.auspex.com
Sat Jun 3 07:58:08 AEST 1989


> I am trying to run the following command on the VAX:
>
>tar -cf - .|rsh drun  tar xf -
>
>I get the error message back:
>
>stty:  operation not support on socket

The problem isn't in the command you're running.  You're probably using
the C shell on the 386i (and the VAX), and the problem is almost
certainly in your ".cshrc" on the 386i.  You probably have an 'stty'
command in your '.cshrc', and it's being run even with a non-interactive
C shell. 

Basically, C shells not fired up with the "-f" flag tend to source your
".cshrc" file; this includes the C shell fired up on an "rsh" if your
login shell on the remote machine is the C shell.  Since a C shell fired
up by the "rsh" has a TCP connection as its standard input and output,
"stty" isn't going to work very well, since it acts on the standard
output in the BSD environment ("/usr/bin/stty") and the standard input
in the S5 environment ("/usr/5bin/stty").  The "ioctl" operations in
question are, in fact, not supported on sockets, and TCP connections are
sockets.

Some versions of the "stty" command were rather rude and didn't inform
you of errors in "ioctl" operations.  The SunOS 4.x one does inform you
of those errors.

Fortunately, the fix is simple.  There are, quite possibly, a whole
*bunch* of operations in your ".cshrc" (e.g., "set history=N") that are
simply not worth doing except in in interactive shells.  What you do is
surround them in your ".cshrc" with:

	if ( $?prompt ) then
		operations....
	endif

and, since in a non-interactive shell "prompt" won't be set, the
operations in question will only be done in interactive shells.  The
"stty" in question is one such operation.  (Why, BTW, are you doing it
in your ".cshrc" at all?  Why not just do it in ".login"?)

This actually should be in 1) the "csh" manual page and/or tutorials on
the C shell, and 2) some list of "frequently asked questions".



More information about the Comp.unix.wizards mailing list