Package: util-linux Version: 2.13.1.1-1 Severity: normal File: /sbin/cfdisk Tags: patch
I used cfdisk to partition a 1,5 TB disk. The result looks fine e.g. with parted, however cfdisk refuses to deal with the disk # /sbin/cfdisk /dev/sdb FATAL ERROR: Cannot seek on disk drive Press any key to exit cfdisk The error message is from static void read_sector(unsigned char *buffer, long long sect_num) which calls lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET); and happened in my case while SECTOR_SIZE==512 and sect_name==-2047891486 (please note the negative number). The caller is at cfdisk.c:1772 read_sector(buffer.c.b, logical_sectors[logical++]); And here we already have the problem. logical_sectors is an int array, and logical_sectors[logical] = ext_info.first_sector + ext_info.offset + bs; 2246095845 0 2246095845 is 2247075810 which is too large for int on amd64 (and i386). At a first glance, fix seems to be very trivial, just change it to an long long array (see attached patch). The resulting binary now seems to handle the disk without any problems. Please consider to push this into Lenny, as larger disk will probably get very popular while Lenny is stable. kind regards Thorsten -- System Information: Debian Release: 5.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages util-linux depends on: ii libc6 2.7-16 GNU C Library: Shared libraries ii libncurses5 5.7+20081213-1 shared libraries for terminal hand ii libselinux1 2.0.65-5 SELinux shared libraries ii libslang2 2.1.3-3 The S-Lang programming library - r ii libuuid1 1.41.3-1 universally unique id library ii lsb-base 3.2-20 Linux Standard Base 3.2 init scrip ii tzdata 2008h-2 time zone and daylight-saving time ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime util-linux recommends no packages. Versions of packages util-linux suggests: ii console-tools 1:0.2.3dbs-65.1 Linux console and font utilities ii dosfstools 3.0.1-1 utilities for making and checking pn util-linux-locales <none> (no description available) -- no debconf information Mfg Thorsten
--- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -295,7 +295,7 @@ partition_info ext_info; int num_parts = 0; int logical = 0; -int logical_sectors[MAXIMUM_PARTS]; +long long logical_sectors[MAXIMUM_PARTS]; __sighandler_t old_SIGINT, old_SIGTERM;
pgpYTVqL3Db4K.pgp
Description: PGP signature