Date: Tue, 9 Jul 1996 14:01:31 +0000 From: "Frank ten Wolde" <franky@pinewood.nl> To: freebsd-hackers@FreeBSD.ORG Subject: >2G partition blues Message-ID: <9607091401.ZM9946@pwood1.pinewood.nl>
next in thread | raw e-mail | index | archive | help
Hello, I have a bug to report. I experience severe problems when trying to setup a 4.3 Gbdisk with sysinstall (2.1-RELEASE). The problem is in de code in .../src/release/libdisk/blocks.c in the lseek line 37: void write_block(int fd, daddr_t block, void *foo) { if (-1 == lseek(fd,block * 512,SEEK_SET)) <=== PROBLEM err(1,"lseek"); if (512 != write(fd,foo, 512)) err(1,"write"); } When 'block' is larger than 4194303 (>2G partition), the result 'block * 512' will yield a negative number, which is cast to (off_t), which is also NEGATIVE. Strangely the lseek() succeeds, but the following write(2) fails: write: Input/Output Error. The correct code should first cast 'block' to (off_t): if (-1 == lseek(fd,(off_t) block * 512,SEEK_SET)) ^^^^^^^^ There is a similar problem at line 27, in the read_block() funtion. I suspect that FreeBSD has many more such problems, as I experience unexplained errors when using the disklabel utility as well (2.1-RELEASE and 2.2-960612-SNAPSHOT) if I try to use slices (disklabel to the entire disk -- without slices -- apparently works). There is a similar problem in sysinstall in the 2.2-960612-SNAPSHOT release. Sysinstall aborts with: Debugger("Slice got negative blocknumber") called. I did not take a look at the actual code for 2.2-960612-SNAPSHOT. Maybe this can be fixed in future releases of FreeBSD :-) Regards, -Frank ten Wolde -- ---------------------------------------------------------------------- F.W. ten Wolde (PA3FMT) Pinewood Automation B.V. E-mail: franky@pinewood.nl Kluyverweg 2a Phone: +31-15 2682543 2629 HT Delft
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9607091401.ZM9946>