[net.games.rogue] HACK bug ?

dan@rna.UUCP (Dan Ts'o) (01/08/85)

Hi,
	Our hack (on 4.2BSD) leaves a lot of alock* files around in
/usr/games/lib/hack/tmp. Is this normal ?
	Thanks.

					Cheers,
					Dan Ts'o
					Dept. Neurobiology
					Rockefeller Univ.
					1230 York Ave.
					NY, NY 10021
					212-570-7671
					...cmcl2!rna!dan

aeb@turing.UUCP (01/10/85)

> Hack leaves lots of alock* files in .../tmp - is this a bug?

Well, maybe. What happens is that hack creates temporary files
called ?lock* (say alock, alock.1, alock.2, ..., block, ...)
and when you finish playing these are removed automatically.
Of course, when something goes wrong (Hack dumps core, your system
crashes) then these temporaries never get removed. When such files
are several days old (so that it is very unlikely that you are
throwing away somebody else's game) you may just remove them.

Saved games are in .../tmp/save/yourname .
-- 
      Andries Brouwer -- CWI, Amsterdam -- {philabs,decvax}!mcvax!aeb

robert@gitpyr.UUCP (Robert Viduya) (01/12/85)

> > Hack leaves lots of alock* files in .../tmp - is this a bug?
> 
> Well, maybe. What happens is that hack creates temporary files
> called ?lock* (say alock, alock.1, alock.2, ..., block, ...)
> and when you finish playing these are removed automatically.
> Of course, when something goes wrong (Hack dumps core, your system
> crashes) then these temporaries never get removed. When such files
> are several days old (so that it is very unlikely that you are
> throwing away somebody else's game) you may just remove them.
> 
>
One way to guarantee you aren't throwing away someone else's game is to
look in the files themselves.  Hack creates a set of lock files for each
player playing.  Each player is assigned a lowercase letter starting from
'a' to 'z' (actually, I haven't tested it all the way to 'z', our limit
is six players max at one time).  Hack uses this letter as the first part
of the set of lock files.  This means that the first player on gets assigned
lock files alock, alock.1, alock.2, and etc; the second player gets assigned
lock files block, block.1, block.2, and etc; and so on.  The first files in
the series's (alock, block, clock,...) contain the process id of the game
that they belong to.  All the other files in the series's contain the levels
(alock.1 contains level 1, alock.2 contains level 2); this is how Hack remembers
the levels for each player.  What you want to do is look at the files that
contain the process ids (alock, block, clock....).  Use ps(1) to find out
if the games are still running and if they're not, go ahead and delete that
set of files.   Note that the process id's are stored in binary and that you'll
either have to write a program to print them out as characters or pick them
apart with od(1).

				robert
-- 
Robert Viduya
    Office of Computing Services
    Georgia Institute of Technology, Atlanta GA 30332
    Phone:  (404) 894-4669

...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert
...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert