From owner-freebsd-current Thu Apr 19 8: 4:56 2001 Delivered-To: freebsd-current@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 158CA37B505 for ; Thu, 19 Apr 2001 08:04:48 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f3JF3qA22297; Thu, 19 Apr 2001 18:03:52 +0300 (EEST) (envelope-from ru) Date: Thu, 19 Apr 2001 18:03:52 +0300 From: Ruslan Ermilov To: Bruce Evans Cc: current@FreeBSD.ORG Subject: Atomic install(1) by default (was: Re: groff breaks "make -j N buildworld") Message-ID: <20010419180352.C13567@sunbay.com> Mail-Followup-To: Bruce Evans , current@FreeBSD.ORG References: <20010419171841Z.matusita@jp.FreeBSD.org> <20010419175353.A13567@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010419175353.A13567@sunbay.com>; from ru@FreeBSD.org on Thu, Apr 19, 2001 at 05:53:53PM +0300 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Apr 19, 2001 at 05:53:53PM +0300, Ruslan Ermilov wrote: > On Thu, Apr 19, 2001 at 11:12:24PM +1000, Bruce Evans wrote: > [...] > > > IIRC, it is assumed that "make -jX install (where X > 1)" _doesn't_ work. > > > I've heard why, but I've forgotten :-) > > > > Right. One case where it doesn't work is installing /bin/sh with the > > default install flags. /bin/sh gets clobbered, so anything that attempts > > to use it concurrently doesn't work. In particular, a concurrent > > sub-make may fail. This problem is avoided for some very important > > install targets like ld.so by adding -C to INSTALLFLAGS to give an > > atomic installation. Atomic installation (but not -C) should be the > > default. > > > This one seems like an easy task, and this is suspicious... How about > the attached patch? I have tested it lightly, and haven't found any > problems. Will the `make -j32 installworld' of -CURRENT be enough > test to commit this and remove -B from Makefile.inc1? > Damn, forgot to attach the patch. Here it goes... -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: xinstall.c =================================================================== RCS file: /home/ncvs/src/usr.bin/xinstall/xinstall.c,v retrieving revision 1.40 diff -u -p -r1.40 xinstall.c --- xinstall.c 2000/10/08 09:17:56 1.40 +++ xinstall.c 2001/04/19 14:38:41 @@ -53,11 +53,6 @@ static const char rcsid[] = * attribute changes and don't clear the dump flag. (I think inode * ctimes are not updated for null attribute changes, but this is a * bug.) - * o independent of -C, if a copy must be made, then copy to a tmpfile, - * set all attributes except the immutable flags, then rename, then - * set the immutable flags. It's annoying that the immutable flags - * defeat the atomicicity of rename - it seems that there must be - * a window where the target is not immutable. */ #include @@ -347,7 +342,7 @@ install(from_name, to_name, fset, flags) devnull = 1; } - if (docompare) { + if (docopy) { old_to_name = to_name; /* * Make a new temporary file in the same file system @@ -409,7 +404,7 @@ install(from_name, to_name, fset, flags) * It may be possible to better optimize the !dostrip case, however. * For further study. */ - if (docompare) { + if (docopy) { struct stat old_sb, new_sb, timestamp_sb; int old_fd; struct utimbuf utb; @@ -423,7 +418,7 @@ install(from_name, to_name, fset, flags) if (old_sb.st_flags & NOCHANGEBITS) (void)fchflags(old_fd, old_sb.st_flags & ~NOCHANGEBITS); fstat(to_fd, &new_sb); - if (compare(old_fd, old_to_name, to_fd, to_name, &old_sb, + if (!docompare || compare(old_fd, old_to_name, to_fd, to_name, &old_sb, &new_sb)) { different: if (debug != 0) --zhXaljGHf11kAtnf-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message