From owner-freebsd-hackers Tue Dec 4 22:58:31 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from snipe.prod.itd.earthlink.net (snipe.mail.pas.earthlink.net [207.217.120.62]) by hub.freebsd.org (Postfix) with ESMTP id F144937B405; Tue, 4 Dec 2001 22:58:28 -0800 (PST) Received: from dialup-209.244.107.135.dial1.sanjose1.level3.net ([209.244.107.135] helo=blossom.cjclark.org) by snipe.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16BW0h-0007im-00; Tue, 04 Dec 2001 22:58:27 -0800 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id fB56wE742569; Tue, 4 Dec 2001 22:58:14 -0800 (PST) (envelope-from cjc) Date: Tue, 4 Dec 2001 22:58:14 -0800 From: "Crist J . Clark" To: Greg Black Cc: Matthew Dillon , Ian Dowse , Bernd Walter , Mark Hannon , bugs-followup@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: bin/32261: dump creates a dump file much larger than sum of dumped files Message-ID: <20011204225814.E40864@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <200112041339.aa05506@salmon.maths.tcd.ie> <200112041957.fB4Jv1j20226@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from gjb@gbch.net on Wed, Dec 05, 2001 at 06:02:49AM +1000 X-URL: http://people.freebsd.org/~cjc/ 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 Wed, Dec 05, 2001 at 06:02:49AM +1000, Greg Black wrote: > Matthew Dillon wrote: > > | :In message <20011204135626.A75212@cicely8.cicely.de>, Bernd Walter writes: > | :>> Is there any reason we don't want to truncate the file? Does O_TRUNC > | :>> not work well of the file is a tape device or something? > | :> > | :>I don't expect O_TRUNK to work on devices such tapes and disks. > | : > | :Well, it won't achieve anything on tapes or disk devices, but it > | :should be completely harmless to add the O_TRUNC flag. The current > | :behaviour is likely to be unexpected and cause confusion so it > | :might as well be changed. I'll commit this later unless someone > | :can think of a good reason not to. > | : > | :Ian > | > | Woa! That sounds like a bad idea to me. If you want to do it right > | then open(), fstat(), and only if the stat says it is a regular file > | do you then ftruncate(). Passing O_TRUNC to a tape device may be ignored > | by us, but it's not a valid flag to pass to a tape device and we shouldn't > | do it. > > I haven't used any of them for a while, but there are certainly > Unix systems that treat O_TRUNC as a signal to rewind a tape > device before writing to it. So? Who cares? This is FreeBSD's dump(8) and FreeBSD's write(2). There is no reason to worry about portability of FreeBSD's dump(8) in how write(2) flags work. If our write(2) "does the right thing" with O_TRUNC and tape devices, there is no reason not to let it do the right thing on its own. -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message