From owner-freebsd-hackers Tue Jul 9 05:02:00 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id FAA02452 for hackers-outgoing; Tue, 9 Jul 1996 05:02:00 -0700 (PDT) Received: from gw.pinewood.nl (gw.pinewood.nl [194.171.50.9]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id FAA02439 for ; Tue, 9 Jul 1996 05:01:56 -0700 (PDT) Received: (from smap@localhost) by gw.pinewood.nl (8.6.12/8.6.12) id OAA19114 for ; Tue, 9 Jul 1996 14:01:54 +0200 Received: from pwood1.pinewood.nl(192.168.1.10) by gw.pinewood.nl via smap (V1.3) id sma019112; Tue Jul 9 14:01:34 1996 Received: (from franky@localhost) by pwood1.pinewood.nl (8.7.3/8.6.12) id OAA09948; Tue, 9 Jul 1996 14:01:33 +0200 (DST) From: "Frank ten Wolde" Message-Id: <9607091401.ZM9946@pwood1.pinewood.nl> Date: Tue, 9 Jul 1996 14:01:31 +0000 X-Face: 'BsFf8'k.q?J#?|$D*,)/?sRB{woUK&9\5K{ERmT;VTSyNLBb?muLf>b:Pt&VTDw8YCaC]6 C!MRSMr5UNjZLa]fi? X-Return-Receipt-To: franky@pinewood.nl X-Mailer: Z-Mail (3.2.1 10oct95) To: freebsd-hackers@FreeBSD.ORG Subject: >2G partition blues Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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