Newsgroups: news.software.b
Path: utzoo!utstat!geoff
From: geoff@utstat.uucp (Geoff Collyer)
Subject: Re: problems with responses from utstat!c-news (really rsh bugs)
Message-ID: <1990Oct24.040934.7747@utstat.uucp>
Date: Wed, 24 Oct 90 04:09:34 GMT
References: <1990Oct20.234846.3679@zoo.toronto.edu> <1990Oct21.090928.10961@utstat.uucp>
 <1990Oct23.034613.16182@mlb.semi.harris.com> <49653@olivea.atc.olivetti.com>
Organization: Statistics, U. of Toronto

Revising the rsh protocol may be painful, but the sooner we do it, the
less painful it will be.  UCB has changed protocols in wide-spread use
before; they changed the talk protocol and of course the telnet
protocol is forever changing.

The suggestion to just echo the exit status fails in the case of a
failing shell built-in (e.g. cd) and is a kludgey workaround which can
be even uglier if stdout must return output other than exit status.
(Jerry Aguirre's suggestion would work to indicate simple success or
failure, except that many shells don't return predictable status from a
pipeline.)  Making this kludge work in the presence of failing shell
built-ins by adding another level of indirection makes the kludge worse
still:

	rsh foo 'sh -c "cd /somewhere; cmd"; echo status $?' |
		tee /tmp/foo.out$$ | sed -n 's/^status //p'

This is awfully circumlocutory for a simple request, which it should be
possible to state as:

	rsh foo "cd /somewhere; cmd"

It turns out that a bug report on this very subject has been filed with
Sun by someone else with respect to SunOS 4.1.
-- 
Geoff Collyer		utzoo!utstat!geoff, geoff@utstat.toronto.edu
