Skip Menu |

This queue is for tickets about the Xbase CPAN distribution.

Report information
The Basics
Id: 105004
Status: new
Priority: 0/
Queue: Xbase

People
Owner: Nobody in particular
Requestors: frank_mckenney [...] mindspring.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Xbase-1.07: FPT file handling problem
Date: Fri, 5 Jun 2015 14:38:58 -0400
To: bug-Xbase [...] rt.cpan.org
From: Frank McKenney <frank_mckenney [...] mindspring.com>
Module: Xbase-1.07 (1996) Perl: This is perl 5, version 12, subversion 3 (v5.12.3) built for i486-linux-thread-multi OS: Linux amun 3.2.63-grsec #1 SMP Fri Oct 24 13:43:09 PDT 2014 i686 AMD Athlon(tm) II X2 250 Processor AuthenticAMD GNU/Linux There is a bug in the section of Xbase.pm v1.07 that handles the FPT files used by FoxBase, etc. to store MEMO fields. Using Xbase v1.07, if the MEMO file is set up with a BLOCKSIZE greater than 255 (the default is 64), or if non-zero data is present in certain officially unused portions of the FPT file header, attempts to retrieve the contents of MEMO fields will fail or return invalid results. This appears to be the result of a combination of "guessing" where the offset and BLOCKSIZE values were being stored in the header and assuming Intel (little endian) values rather the correct Motorola (big endian) values. A diff file that, if applied to a v1.07 Xbase.pm file (1996), will fix this problem is attached. ( Since I don't know if e-mail bug submission allows attachments, I've also appended the contents of the -- short -- file below. ) Hope this helps someone else. Frank McKenney -- To be a first-rate scientist it is not necessary (and certainly not sufficient) to be extremely clever, anyhow in a pyrotechnic sense. One of the great social revolutions brought about by scientific research has been the democratization of learning. Anyone who combines strong common sense with an ordinary degree of imaginativeness can become a creative scientist, and a happy one besides, in so far as happiness depends upon being able to develop to the limit of one's abilities. -- Peter Medawar, "Lucky Jim" 1968 -- Frank McKenney, McKenney Associates Richmond, Virginia / (804) 320-4887 Munged E-mail: frank uscore mckenney aatt mindspring ddoott com -------------------------------------------------------- 0a1,37 Show quoted text
> #------------------- > # > # 2015-05-19 FAMcK > # > # Corrected several MEMO file (FPT) errors discovered while working > # with the Harbour Project compiler (Clipper replacement): > # > # 1) FPT "BLOCKSIZE" is a 16-bit BIG-endian value contained in > # bytes 6-7 of the header of the associated DBF file. > # Old code only worked due to the default BLOCKSIZE of 64 > # fitting into one byte and the presence of trailing zeroes > # in bytes 8-10 of most (but not all) FPT files. > # > # However, this would have failed with any FPT file with a > # BLOCKSIZE > 255. > # > # 2) A MEMO block pointer of " 0" apparently indicates > # an empty value (""). It definitely -- does not -- mean seek > # to offset 0 of the FPT file. <grin> > # > # Note: The code used to obtain 'fpt_nextf', the next-free-block > # pointer, also uses unpack("V") on a BIG-endian field, but > # this does not cause any problems because that value is > # never used. As the Xbase-1.07 Abstract says, this code > # is intended only for reading. > # > # Frank McKenney, McKenney Associates > # > # References: > # > # Microsoft FoxPro Memo File Structure (.FPT) > # https://msdn.microsoft.com/en-us/library/8599s21w.aspx > # > # Xbase File Format Description > # http://www.clicketyclick.dk/databases/xbase/format/index.html > # > #-------------------
149c186 < $self->{'fpt_blksize'}=unpack("l",pack("L",unpack("V",substr($fpth,7,4)))); --- Show quoted text
> $self->{'fpt_blksize'}=unpack("l",pack("L",unpack("n",substr($fpth,6,2)))); # 7,4 -> 6,2 FAMcK
467a505 Show quoted text
> return "" if $memblk == 0; # Empty MEMO field, don't seek. FAMcK
--------------------------------------------------------

Message body is not shown because sender requested not to inline it.