🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #899

Re: ln(1) and System V

#899
From: Geoff Collyer
Date: Sun, 06 Nov 1988 07:47
14 lines
834 bytes
I see a race in Geoff Kuenning's inventive solution to locking with
ln(1) on System V:

>	trap "" 1 2 15
>	touch lock
>	ln lock lock1  ||  exit 1
>	trap "rm -f lock lock1; exit 1" 1 2 15

If the "rm -f lock lock1" runs in one copy of this script just after the
"touch lock" runs in another, then the ln will fail unnecessarily.  The
race can be fixed by simply not removing "lock", since "lock1" is the
real lock.
-- 
Geoff Collyer	utzoo!utstat!geoff, geoff@utstat.toronto.edu
Technical Details
Message-ID: <1988Nov6.074740.25667@utstat.uucp>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!utstat!geoff
References: <1808@desint.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!utstat!geoff
From: geoff@utstat.uucp (Geoff Collyer)
Newsgroups: comp.bugs.sys5,comp.unix.wizards,comp.unix.questions
Subject: Re: ln(1) and System V
Message-ID: <1988Nov6.074740.25667@utstat.uucp>
Date: 6 Nov 88 07:47:40 GMT
References: <1808@desint.UUCP>
Organization: Statistics, U. of Toronto
Lines: 14