From owner-freebsd-hackers Tue Dec 4 4:56:39 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by hub.freebsd.org (Postfix) with ESMTP id 8F8AE37B405; Tue, 4 Dec 2001 04:56:35 -0800 (PST) Received: (from uucp@localhost) by srv1.cosmo-project.de (8.11.0/8.11.0) with UUCP id fB4CuKl18679; Tue, 4 Dec 2001 13:56:21 +0100 (CET) Received: from mail.cicely.de (cicely20.cicely.de [10.1.1.22]) by cicely5.cicely.de (8.12.1/8.12.1) with ESMTP id fB4CuYAD038240; Tue, 4 Dec 2001 13:56:34 +0100 (CET)?g (envelope-from ticso@cicely8.cicely.de) Received: from cicely8.cicely.de (cicely8.cicely.de [10.1.2.10]) by mail.cicely.de (8.11.0/8.11.0) with ESMTP id fB4CuSL06643; Tue, 4 Dec 2001 13:56:33 +0100 (CET) Received: (from ticso@localhost) by cicely8.cicely.de (8.11.4/8.11.4) id fB4CuRY75265; Tue, 4 Dec 2001 13:56:28 +0100 (CET) (envelope-from ticso) Date: Tue, 4 Dec 2001 13:56:26 +0100 From: Bernd Walter To: cjclark@alum.mit.edu Cc: 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: <20011204135626.A75212@cicely8.cicely.de> References: <200112020920.fB29K1i06867@freefall.freebsd.org> <20011202160246.D30433@blossom.cjclark.org> <3C0B5895.17C8629C@optushome.com.au> <20011204025156.G37981@blossom.cjclark.org> <3C0CADD9.9CB09DF4@optushome.com.au> <20011204033538.H37981@blossom.cjclark.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011204033538.H37981@blossom.cjclark.org> User-Agent: Mutt/1.3.23i X-Operating-System: FreeBSD cicely8.cicely.de 5.0-CURRENT i386 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 Tue, Dec 04, 2001 at 03:35:38AM -0800, Crist J . Clark wrote: > On Tue, Dec 04, 2001 at 10:04:57PM +1100, Mark Hannon wrote: > > Hi Chris, > > > > This is exactly what I was seeing! (I finally twigged when I did a > > low level backup of a filesystem and then noticed that my level 9 > > backup was the same length as the night before ....) > > > > Thanks, Mark > > > > > > "Crist J . Clark" wrote: > > > > > > I did some more checking on how dump(8) works. If you dump to an > > > existing file, the file can never get smaller. That is, the file is > > > not truncated. I'll look at whether there is a good reason for this. > > > Is this actually what you were describing? > > I don't really see a reason why dump(8) needs to work that way. Here > is an untested patch that should change that behavior. > > Index: src/sbin/dump/tape.c > =================================================================== > RCS file: /export/ncvs/src/sbin/dump/tape.c,v > retrieving revision 1.12.2.1 > diff -u -r1.12.2.1 tape.c > --- src/sbin/dump/tape.c 1 Aug 2001 06:29:35 -0000 1.12.2.1 > +++ src/sbin/dump/tape.c 4 Dec 2001 11:24:12 -0000 > @@ -609,10 +609,10 @@ > } > #ifdef RDUMP > while ((tapefd = (host ? rmtopen(tape, 2) : > - pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0) > + pipeout ? 1 : open(tape, O_WRONLY | O_CREAT | O_TRUNC, 0666))) < 0) > #else > while ((tapefd = (pipeout ? 1 : > - open(tape, O_WRONLY|O_CREAT, 0666))) < 0) > + open(tape, O_WRONLY | O_CREAT| O_TRUNC, 0666))) < 0) > #endif > { > msg("Cannot open output \"%s\".\n", tape); > > 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. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message