[comp.unix.wizards] "tip" leaves device file exclusively open

garyb@abekrd.UUCP (Gary Bartlett) (11/11/88)

We  are  having  a  problem  with "tip" on a  Sun 3/50  running  Sun UNIX 4.2
Release 3.4.  At the  completion  of some calls,  after  trying to disconnect
from the line/modem,  the  command  hangs.  Killing  it with 'intr' or 'quit'
results in the modem  device  being left  exclusively  open,  with the result
that no other process including our regular uucp links can access the device.

If  anyone  knows  anything  about  this  problem,  or  even how to close the
exclusively open device file, it would be much appreciated.

-- 
-------------------------------------------------------------------------------
Gary C. Bartlett               NET: garyb@abekrd.co.uk
Abekas Video Systems Ltd.     UUCP: ...!mcvax!ukc!{reading,pyrltd}!abekrd!garyb
12 Portman Rd,   Reading,    PHONE: +44 734 585421
Berkshire.       RG3 1EA.      FAX: +44 734 597267
United Kingdom.              TELEX: 847579

lee@uhccux.uhcc.hawaii.edu (Greg Lee) (11/19/88)

From article <137@abekrd.UUCP>, by garyb@abekrd.UUCP (Gary Bartlett):
" We  are  having  a  problem  with "tip" on a  Sun 3/50  running  Sun UNIX 4.2
" Release 3.4.  At the  completion  of some calls,  after  trying to disconnect
" from the line/modem,  the  command  hangs.  Killing  it with 'intr' or 'quit'
" results in the modem  device  being left  exclusively  open,  with the result
" that no other process including our regular uucp links can access the device.

I have occasionally had to kill off a tip and, after removing the lock
file been left with the port unusable -- e.g. tip says 'all devices busy'.
I stumbled on this fix: become superuser and dump a character to the
device.  'echo a >/dev/ttyb' or something similar.  (But maybe this
magic is only locally efficacious.)

		Greg, lee@uhccux.uhcc.hawaii.edu

amos@taux02.UUCP (Amos Shapir) (11/21/88)

Check permissions  to /usr/spool/uucp.   tip creates  a lock  file there
(usually LCK.something)  as user uucp,  then does  a setuid to  the user
that  runs it.   In some  versions, it  forgets to  setuid back  to uucp
before  removing the  lock, so  the remove  fails and  the lock  is left
intact.  Sometime  the only solution  is to make the  directory writable
(shudder).
-- 
	Amos Shapir				amos@nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
34 48 E / 32 10 N			(My other cpu is a NS32532)

lai@vedge.UUCP (David Lai) (11/30/88)

In article <318@taux02.UUCP> amos@taux02.UUCP (Amos Shapir) writes:
>Check permissions  to /usr/spool/uucp.   tip creates  a lock  file there
>(usually LCK.something)  as user uucp,  then does  a setuid to  the user
>that  runs it.   In some  versions, it  forgets to  setuid back  to uucp
>before  removing the  lock, so  the remove  fails and  the lock  is left
>intact.  Sometime  the only solution  is to make the  directory writable
>(shudder).
>-- 
>	Amos Shapir				amos@nsc.com
>National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
>Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
>34 48 E / 32 10 N			(My other cpu is a NS32532)

I have a small script I use instead of 'tip' on the sun (which creates
the LCK file as uucp but cant remove it afterwards, it is in the path before
/usr/bin)

tip:
#!/bin/sh
if test "$1" = "fast"; then
	a=cuad
fi
if test "$1" = "slow"; then
	a=cua0
fi
if test "$1" = "slow300"; then
	a=cua0
fi
if test "$1" = "fast" -o "$1" = "slow" -o "$1" = "slow300"; then
	if /usr/lib/uucp/uuchecklock $a; then
		/usr/bin/tip $*
		/usr/lib/uucp/uuunlock $a
	else
		echo "modem" $a "busy"
	fi
else
	/usr/bin/tip $*
fi

/usr/lib/uucp/uuchecklock: (setuid to uucp)
if test -f /usr/spool/uucp/LCK..$1; then
exit 1
else
exit 0
fi

/usr/lib/uucp/uuunlock: (setuid to uucp)
#!/bin/sh
rm -f /usr/spool/uucp/LCK..$1
-- 
	"What is a DJ if he can't scratch?"  - Uncle Jamms Army
The views expressed are those of the author, and not of Visual Edge, nor Usenet.
David Lai (vedge!lai@larry.mcrcim.mcgill.edu || ...watmath!onfcanim!vedge!lai)