From owner-freebsd-hackers Sun Jun 23 10: 1:12 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 B3A3137B401 for ; Sun, 23 Jun 2002 10:01:06 -0700 (PDT) Received: from mammoth.eat.frenchfries.net (da001d0294.lax-ca.osd.concentric.net [64.0.145.39]) by mail.deltanet.com (8.11.6/8.11.6) with ESMTP id g5NGb0O02977 for ; Sun, 23 Jun 2002 09:37:01 -0700 Received: by mammoth.eat.frenchfries.net (Postfix, from userid 1000) id 0D85D5150; Sun, 23 Jun 2002 09:59:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mammoth.eat.frenchfries.net (Postfix) with ESMTP id 09647514C; Sun, 23 Jun 2002 09:59:10 -0700 (PDT) Date: Sun, 23 Jun 2002 09:59:10 -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: <20020623160439.GE81018@over-yonder.net> Message-ID: <20020623094323.F38369-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 [ pulled over to -hackers as well ] On Sun, 23 Jun 2002, Matthew D. Fuller wrote: > On Sun, Jun 23, 2002 at 09:00:52AM -0700 I heard the voice of > Paul Herman, and lo! it spake thus: > > On Sun, 23 Jun 2002, Geoffrey C. Speicher wrote: > > > > How so? I'm not suggesting unlink(2)ing /etc/master.passwd or > > /etc/spwd.db at all. > > No, but pw(8) does; making it not do so would require reasonably > extensive rewriting. Indeed it does do this. However, that seems to be the crux of the problem. The current pw(8) behavior was (probably) not only a convenient way to update files in /etc, but an attempt to narrow (not eliminate) the window for race conditions. If this is fundamentaly flawed, *this* should be fixed, and not have a larger band aid put over it. I can't imagine it would be too extensive of a rewrite. The temp file code could be kept, and in fileupd.c:fileupdate() instead of rename("/etc/master.passwd.new", "/etc/master.passwd"), it just copies the contents of the .new file into the original file (that has the O_EXLOCK.) -Paul. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message