Subject: bin/927: "dump" chokes on huge filesystems
To: None <gnats-admin@NetBSD.ORG>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: netbsd-bugs
Date: 03/30/1995 06:20:03
>Number: 927
>Category: bin
>Synopsis: "dump" chokes on huge filesystems
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 30 06:20:02 1995
>Originator: Kenneth Stailey
>Organization:
self
>Release: NetBSD 1.0A March 18 1995
>Environment:
System: NetBSD pluto 1.0A NetBSD 1.0A (PLUTO) #25: Tue Mar 28 13:17:39 EST 1995 ken@pluto:/usr/src/sys/arch/i386/compile/PLUTO i386
>Description:
If you cast a large "long long" into an int you can get a
negative result.
#include <stdio.h>
main()
{
long long ll;
int i;
ll = 5000000000 * 10;
i = (int)ll;
printf("%d\n", i);
}
A comparison in /usr/src/sbin/dump/traverse.c is wreck by this.
>How-To-Repeat:
Run dump on huge filesystem (>8GB?)
>Fix:
*** /usr/src/sbin/dump/traverse.c.orig Tue Jun 14 18:49:57 1994
--- /usr/src/sbin/dump/traverse.c Mon Mar 27 13:10:32 1995
***************
*** 562,568 ****
extern int errno;
loop:
! if ((int)lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0)
msg("bread: lseek fails\n");
if ((cnt = read(diskfd, buf, size)) == size)
return;
--- 562,568 ----
extern int errno;
loop:
! if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) < 0)
msg("bread: lseek fails\n");
if ((cnt = read(diskfd, buf, size)) == size)
return;
--JAA00346.796572210/pluto.spacenet.com--
>Audit-Trail:
>Unformatted: