Subject: problem with SUP (with patch)
To: None <current-users@NetBSD.ORG>
From: Scott Stevens <s.k.stevens@ic.ac.uk>
List: current-users
Date: 07/07/1997 10:44:48
Hi all,

I noticed a strange problem the other day. For speed I run multiple
sups simultaneously one for each of the releases that I'm interested
in. But I noticed that one day a sup of ksrc-pmax was deleting all of
ksrc-arm32. This was making it a little pointless using sup. It turns
out that my /usr/sup/current/last.<release> files were getting
corrupted.

Looking at the code it seems that sup uses a temp file
/usr/sup/current/last.temp *regardless* of the release being
grabbed. So if 2 sups happen to finish at the same time they end up
corrupting each others last.temp...

The fix below makes the temp filename release specific.

Cheers Scott

-- 
Scott Stevens, Network Services Group, Computer Centre, Imperial College
"Stop! I wanna go home, Take off this uniform, And leave the show.
 But I'm waiting in this cell, Because I have to know.
 Have I been guilty all this time ?"                   - Stop, Pink Floyd

*** othersrc/sup/sup.h.orig	Mon Jul  7 10:22:43 1997
--- othersrc/sup/sup.h	Mon Jul  7 10:24:29 1997
***************
*** 145,151 ****
  #define FILEBKDIR	"%s/BACKUP"
  #define FILEBACKUP	"%s/BACKUP/%s"
  #define FILELAST	"sup/%s/last%s"
! #define FILELASTTEMP	"sup/%s/last.temp"
  #define FILELOCK	"sup/%s/lock"	/* also supfilesrv */
  #define FILEREFUSE	"sup/%s/refuse"
  #define FILEWHEN	"sup/%s/when%s"
--- 145,151 ----
  #define FILEBKDIR	"%s/BACKUP"
  #define FILEBACKUP	"%s/BACKUP/%s"
  #define FILELAST	"sup/%s/last%s"
! #define FILELASTTEMP	"sup/%s/last.temp%s"
  #define FILELOCK	"sup/%s/lock"	/* also supfilesrv */
  #define FILEREFUSE	"sup/%s/refuse"
  #define FILEWHEN	"sup/%s/when%s"
*** othersrc/sup/supcmeat.c.orig	Mon Jul  7 10:22:35 1997
--- othersrc/sup/supcmeat.c	Mon Jul  7 10:34:53 1997
***************
*** 1414,1420 ****
  		done (FDONESUCCESS,"Success");
  		(void) requestend ();
  	}
! 	(void) sprintf (tname,FILELASTTEMP,collname);
  	finishfile = fopen (tname,"w");
  	if (finishfile == NULL) {
  		notify ("SUP: Can't record list of all files in %s\n",tname);
--- 1414,1420 ----
  		done (FDONESUCCESS,"Success");
  		(void) requestend ();
  	}
! 	(void) sprintf (tname,FILELASTTEMP,collname,relsufix);
  	finishfile = fopen (tname,"w");
  	if (finishfile == NULL) {
  		notify ("SUP: Can't record list of all files in %s\n",tname);