From: <no...@so...> - 2002-02-15 14:42:29
|
Bugs item #219396, was opened at 2000-10-25 22:12 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=219396&group_id=10894 Category: 23. Channel Commands Group: = 8.3.2 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Donal K. Fellows (dkf) Summary: seek offset is limited to sizeof(int), where sizeof(long) sh Initial Comment: OriginalBugID: 6215 Bug Version: 8.3.2 SubmitDate: '2000-09-05' LastModified: '2000-10-25' Severity: MED Status: UnAssn Submitter: techsupp OS: Digital Unix Machine: 64-bit Compaq Alpha FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Robin T. Miller CustomShell: No patches, no customizations. ReproducibleScript: On Tru64 Unix, file offsets are sizeof(long), but the definition of seek limits the file offset to sizeof(int) or 31 bits (must be positive value). I had a simple C function used to determine disk capacity, that I decided to re-write in Tcl, but was disappointed to see that seek has this limitation. Of course to be portable to other platforms, 64-bit file system support is necessary. Here's the simple Tcl code to reproduce this problem: set attempts 0 set bsize 512 set mbyte [expr (1024 * 1024)] set adjust [expr ($mbyte * 250)] set offset $adjust while { 1 } { incr attempts if [catch {seek $chan $offset start} result] { puts stderr "seek failed!\n$result" break } set off [tell $chan] if { $opts(DebugFlag) } { puts [format "offset = %ld, lba = %lu" $off [expr ($off / $bsize)]] } if [catch {read $chan $bsize} result] { puts stderr "read failed!\n$result" break } if [eof $chan] { set adjust [expr ($adjust / 2)] if { ($adjust == 0) } { incr adjust } set offset [expr ($off - $adjust)] } else { incr offset $adjust if { ($adjust == 1) } { break; ;# We have max capacity! } } } puts " Attempts: $attempts" puts " Offset: $offset" puts " Capacity: [expr ($offset / $bsize)]" I consider this a bug rather than a feature enhancement, since Tru64 Unix is naturally a 64-bit system. ObservedBehavior: tru64% getcapacity -device rz2 -debug offset = 262144000, lba = 512000 offset = 524288000, lba = 1024000 offset = 786432000, lba = 1536000 offset = 1048576000, lba = 2048000 offset = 1310720000, lba = 2560000 offset = 1572864000, lba = 3072000 offset = 1835008000, lba = 3584000 offset = 2097152000, lba = 4096000 seek failed! integer value too large to represent as non-long integer Attempts: 9 Offset: 2359296000 Capacity: 4608000 tru64% tclsh % set chan [open /dev/rrz2c r] file5 % seek $chan 2359296000 start integer value too large to represent as non-long integer % close $chan % exit tru64% DesiredBehavior: I expect seek to allow a sizeof(long) offset value. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2001-09-20 03:38 Message: Logged In: YES user_id=79902 Assigning to myself really just to remind me that this is a sort-of duplicate of another bug I'm thinking of how to fix. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2000-11-28 05:33 Message: Yet another instance of the problems Tcl has with the difference between 32 bits and 64 bits (which also bites in expressions and clock handling; maybe elsewhere too) and which will take a concerted piece of monster effort to fix. I'm not even sure that the underlying API for seeks to non-32bit locations is common across all UNIX platforms; if this is the case, then additional configure tests will be needed too. :^( ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=219396&group_id=10894 |