From owner-freebsd-hackers Sun Jun 23 13:20:45 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.deltanet.com (mail.deltanet.com [216.237.144.132]) by hub.freebsd.org (Postfix) with ESMTP id ECF6337B401 for ; Sun, 23 Jun 2002 13:20:39 -0700 (PDT) Received: from mammoth.eat.frenchfries.net (da001d0044.lax-ca.osd.concentric.net [64.0.144.45]) by mail.deltanet.com (8.11.6/8.11.6) with ESMTP id g5NJuQO01538 for ; Sun, 23 Jun 2002 12:56:28 -0700 Received: by mammoth.eat.frenchfries.net (Postfix, from userid 1000) id BC9215183; Sun, 23 Jun 2002 13:19:02 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mammoth.eat.frenchfries.net (Postfix) with ESMTP id B9C2F5159; Sun, 23 Jun 2002 13:19:02 -0700 (PDT) Date: Sun, 23 Jun 2002 13:19:02 -0700 (PDT) From: Paul Herman X-X-Sender: pherman@mammoth.eat.frenchfries.net To: "Matthew D. Fuller" Cc: "Geoffrey C. Speicher" , Subject: Re: bug in pw, -STABLE [patch] In-Reply-To: <20020623192457.GJ81018@over-yonder.net> Message-ID: <20020623124243.H38673-100000@mammoth.eat.frenchfries.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 23 Jun 2002, Matthew D. Fuller wrote: > On Sun, Jun 23, 2002 at 11:32:54AM -0700 I heard the voice of > Paul Herman, and lo! it spake thus: > > > > In fact, if you look at fileupdate(), you see that it already gains > > an exclusive lock on the temp file, but not the original > > "/etc/master.passwd" (if you will.) I think this is a bug, because > > the original is getting modified (at least in name space), so that > > should be locked while pw(8) is operating. > > I think that MAY prevent some of the corruption cases. On the other > hand, we're really addressing a broader spectrum of issues here. The was > pw(8) manipulates the passwd database is rather different from how > chpass(1) or vipw(8) do it; this unifies it all (well, starts the > process). Also, looking down, it seems that pw(8) will ALWAYS try to do > a line-by-line copy of the temp file back into the main file, which would > be Bad Bad Bad (tm); I think you might have your infp confused with your outfp. It's not writing to the original "live" file, it's just writing the new temp file. That part of the code is OK. As for the giant lock, it would be like closing down the entire airport after someone finds a knife in the snack bar, and in my opinion an this is an unwise and brutal thing to do. Not to mention stale /var/run/ files that might be lying around... I do appreciate your work, but please don't commit this until the real issue is solved, and the dust settles. There still may be some use for it... plenty of time until the next release cycle. Geoff: Does the patch for fileupd.c in the last mail hinder the file corruption you are seeing? > (I suggest tabstop=4 or even =2; that file is *DEEP*) Yeeeess! :-) -Paul. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message