[net.bugs.uucp] Removal of LCK-files

storm@diku.UUCP (Kim Fabricius Storm) (07/12/85)

In article <697@lsuc.UUCP> dave@lsuc.UUCP (David Sherman) writes:
>||Why not just write a simple set-UID program which removes
>||the LCK file and nothing else?
>                            You want this done automatically
>when tip exits. So move tip to /usr/lib and make tip a shell
>file which reads
>	trap '/usr/lib/cleanLCK' 0 1 2 3 9 15
>	/usr/lib/tip $*

The problem with this (and similar) 'solution' is that your /usr/lib/tip may
return immediately because the line is locked, and *OOPS* the lock is removed!

The same effect could just as well be obtained by the script (-:
	/usr/lib/cleanLCK	-- remove the lock if any
	/usr/lib/tip $*		-- then call tip.

dave@lsuc.UUCP (David Sherman) (07/19/85)

In article <1044@diku.UUCP> storm@diku.UUCP (Kim Fabricius Storm) writes:
> In article <697@lsuc.UUCP> dave@lsuc.UUCP (David Sherman) writes:
> >||Why not just write a simple set-UID program which removes
> >||the LCK file and nothing else?
> >                            You want this done automatically
> >when tip exits. So move tip to /usr/lib and make tip a shell
> >file which reads
> >	trap '/usr/lib/cleanLCK' 0 1 2 3 9 15
> >	/usr/lib/tip $*
> 
> The problem with this (and similar) 'solution' is that your /usr/lib/tip may
> return immediately because the line is locked, and *OOPS* the lock is removed!
> 
> The same effect could just as well be obtained by the script (-:
> 	/usr/lib/cleanLCK	-- remove the lock if any
> 	/usr/lib/tip $*		-- then call tip.

Okay, big deal. So make it
	trap '' 2		# make shell file immune to interrupts
	if /usr/lib/tip $*
	then /usr/lib/cleanLCK; fi

This assumes tip is correctly set up to return 0 if it succeeds
in opening the line, and non-zero if it fails due to a lock.
The principle doesn't change; a simple shell file still works.

Anyway, I don't know what all the fuss about locks is. If both
uucp and tip set TIOCEXCL for exclusive use on the line once
they have it open, the lock is superfluous.

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{  ihnp4!utzoo  pesnta  utcs  hcr  decvax!utcsri  }  !lsuc!dave