[comp.windows.x] Xview cmdtool problem...

dave@SAM.CS.OLEMISS.EDU (10/16/90)

I have successfully compiled and installed the XView 2.0 package.
However, I have a problem with cmdtool which I feel like someone
has seen before and knows how to fix.  It  probably has to do with
my configuration.

When cmdtool is invoked from a normal xterm session, it runs fine.
But when it is invoked from the OLWM menu or via xdm, it shows the
window, forks the /bin/csh, but never displays the prompt.  Also,
xdm reports the following error in xdm-errors:

	ttysw-TIOCSPGRP: Interrupted system call

Anyone know what my problem is??

Thanks.

dave

mic@EMX.UTEXAS.EDU (Mic Kaczmarczik) (10/17/90)

In article <9010160524.AA22235@CS.OleMiss.Edu> dave@SAM.CS.OLEMISS.EDU writes:
>
>I have successfully compiled and installed the XView 2.0 package.
>However, I have a problem with cmdtool which I feel like someone
>has seen before and knows how to fix.  It  probably has to do with
>my configuration.
>
>When cmdtool is invoked from a normal xterm session, it runs fine.
>But when it is invoked from the OLWM menu or via xdm, it shows the
>window, forks the /bin/csh, but never displays the prompt.  Also,
>xdm reports the following error in xdm-errors:
>
>	ttysw-TIOCSPGRP: Interrupted system call
>
>Anyone know what my problem is??
>
>Thanks.
>
>dave

I saw this one when I was setting up our Sun-2's to work as X
terminals with xdm, but didn't have a solution for it till I actually
read the SunOS 4.1 release notes last night. (I assume you're running
SunOS 4.1). 

As I understand it, the problem is that when the XView tty subwindow
package sets up a controlling terminal for the window, it tries to
dissociate itself from the current controlling terminal.  The way it
does this (which worked in older versions of SunOS) doesn't work with
the new POSIX session group support found in 4.1.  The explanation in
the release notes is pretty thorough about what ways work and what
ways don't.

The release notes also mentioned a new program called ``setsid'',
which can be used to set a session id for programs that have this
problem.  Using it, I can get cmdtool and shelltool to work from OLWM
and xdm session scripts.  The extremely simple wrapper script and
README file I wrote for installation on our systems is enclosed below. 

Cheers,

--mic--

---------------------------Cut and serve------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README cmdtool.sh
# Wrapped by mic@emx.utexas.edu on Tue Oct 16 12:44:24 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(993 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XDescription:
X
XIf you want to run cmdtool or shelltool via rsh(1) or from xdm(X11),
Xyou need to establish a controlling terminal for the program to dissociate
Xthe tty subwindow from.  Otherwise, the program reports TIOCSPGRP errors,
Xand the doesn't see any keyboard input.
X
XThe shell script in this directory uses setsid(8V) to establish a terminal
Xsession ID for cmdtool/shelltool, which seems to do the trick.  At least
Xnow I can invoke shelltool from my window manager when logging in via
Xxdm.
X
XInstallation:
X
XInstalling this hack requires that you move the cmdtool binary somewhere
Xother than $OPENWINHOME/bin/xview.  I put it in the subdirectory .bin for
Xconvenience.
X
X	cp cmdtool.sh $OPENWINHOME/bin/xview	# copy the wrapper
X	mkdir $OPENWINHOME/bin/xview/.bin	# create area for real binary
X	cd $OPENWINHOME/bin/xview/.bin		# go there
X	mv ../cmdtool .				# save real cmdtool
X	mv ../cmdtool.sh cmdtool		# replace it with cmdtool.sh
X	ln -s cmdtool shelltool			# remake symlink for shelltool
END_OF_FILE
if test 993 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'cmdtool.sh' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmdtool.sh'\"
else
echo shar: Extracting \"'cmdtool.sh'\" \(339 characters\)
sed "s/^X//" >'cmdtool.sh' <<'END_OF_FILE'
X#!/bin/sh
X#
X# @(#)cmdtool.sh	1.2 10/16/90 (cc.utexas.edu) /tmp_mnt/usr/share/src/public/sun/fixes/remote-cmdtool/SCCS/s.cmdtool.sh
X#
X# Wrapper for cmdtool and shelltool that establishes a session leader for
X# the process.  See setsid(8V) for details.
X#
Xexec /usr/etc/setsid -b ${OPENWINHOME-/usr/openwin}/bin/xview/.bin/`basename $0` "$@"
END_OF_FILE
if test 339 -ne `wc -c <'cmdtool.sh'`; then
    echo shar: \"'cmdtool.sh'\" unpacked with wrong size!
fi
# end of 'cmdtool.sh'
fi
echo shar: End of shell archive.
exit 0


Mic Kaczmarczik                  gripe@{emx,ix1,ccwf} (Unix consulting, 1-0251)
Unix / VMS / Cyber Services                 ...!cs.utexas.edu!ut-emx!mic (UUCP)
UT Austin Computation Center                      mic@emx.utexas.edu (Internet)
                                                            mic@utaivc (BITNET)