From: SourceForge.net <no...@so...> - 2009-09-02 00:37:21
|
Bugs item #2848293, was opened at 2009-09-01 04:49 Message generated for change (Settings changed) made by bigrixx You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684730&aid=2848293&group_id=119701 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Classes >Group: Next Release >Status: Pending >Resolution: Fixed Priority: 5 Private: No Submitted By: Mark Gaubatz (mgaubatz) >Assigned to: Rick McGuire (bigrixx) Summary: Incorrect file overlay Initial Comment: Been chasing this since last week in a database write routine in 4.0 under Ubuntu 9.04 (haven't been able to test scenario under Windows)... When crossing apparent boundaries, the correct write pointer is returned, but the next write does not occur at the write pointer and overlays file storage as a consequence. Inserting self~seek("="self~query("POSITION WRITE") "WRITE") following the lineout/charout request keeps the write pointer in line. For example, w-ptr (write pointer) and fsize+1 (filesize + 1) should be identical as we're creating the database: Obj W-ptr fsize+1 1 17 17 2 145 145 : : : 40 52286 52286 41 55904 55904 42 56046 56046 43 56087 61066 <-- Error 44 56229 61066 <-- Error 45 56270 61066 <-- Error 46 56412 61066 <-- Error 47 60523 61066 <-- Error 48 60665 61066 <-- Error 49 64398 64398 : : : 128 166445 166445 <-- Final As a result, the database created is significantly smaller than the correct size and indexing fails as various internal database pointers are overwritten. Inserting the aforementioned self~seek, the test database is correctly generated and displays the following: Obj W-ptr fsize+1 1 17 17 2 145 145 : : : 40 52286 52286 41 55904 55904 42 56046 56046 43 61066 61066 44 61208 61208 45 65585 65585 46 65727 65727 47 69838 69838 48 69980 69980 49 73713 73713 : : : 128 228909 228909 <-- Final ---------------------------------------------------------------------- >Comment By: Rick McGuire (bigrixx) Date: 2009-09-01 20:37 Message: Committed revision 5133. ---------------------------------------------------------------------- Comment By: Mark Gaubatz (mgaubatz) Date: 2009-09-01 17:02 Message: Created a test program (much shorter than the original 3000 or so lines). Calling sequence: rexx dbtest [Incremental|Random] <seed> Incremental - test object sizes from 4092 to 16384 Random - test object sizes using <seed> to initialize the random number generator for repeatability. Random is the default. <seed> - specifies the random number generator seed value to be used. If <seed> is not specified, the current microsecond value will be used. Sample failing calls: rexx dbtest i -- Fails with an object length of 4097 rexx dbtest 0 -- Fails on the second object with an object length of 11775 rexx dbtest 13 -- Fails on the fifth object with an object length of 6016 Apparent common theme: charout > 4K, fails on next charout or lineout. dbtest.rex: /* REXX ***************************************************************/ /* */ /* Create database error */ /* */ /**********************************************************************/ parse upper value arg(1)~translate(" ",",") with routine seed rest . if rest \= "" then call exit 24, "Extraneous parameter" rest "specified" if routine~verify("0123456789") = 0 then routine = value("SEED",routine) routine = (routine "R")~word(1) if "I R"~wordpos(routine~left(1)) = 0 then call exit 24, "Invalid routine" routine "specified" if seed~verify("0123456789") > 0 then call exit 24, "Invalid seed value" seed "specified" seed = (seed time("L")~right(6))~word(1) say "Using seed" seed call random ,,seed db = .database~new("test.db") db~open("BOTH REPLACE") if routine == "I" then return VariantI() if routine == "R" then return VariantR() say "Invalid routine" routine "specified" exit 24 VariantI: procedure expose db do i = 4092 to 16384 call CreateObject i, i end i return 0 VariantR: procedure expose db do i = 1 to 1000 call CreateObject i, random(0,16384) end i return 0 CreateObject: procedure expose db use strict arg n, length object = "" do j = 1 to length object = object || random(0,255)~d2c end j say n~format(5) length~format(5) db~lineout(n object~length) db~charout("object-begin") db~charout(object) db~lineout("object-end") return Exit: use arg rc=0, message="" if message \= "" then say message exit rc ::class database mixinclass stream ::method open expose checkptr use arg options="" checkptr = 1 forward message "open" class (super) array(options) ::method charout use arg chars forward message "charout" class (super) array(chars) continue pr = result forward message "writecheck" array(chars~length) continue return pr ::method lineout use arg line forward message "lineout" class (super) array(line) continue pr = result forward message "writecheck" array(line~length) continue return pr ::method writecheck expose checkptr use arg newlength writeptr = self~query("POSITION WRITE") if writeptr < (checkptr+newlength) then do say "===> Failure: writeptr="writeptr "checkptr="checkptr 0/0 -- Force error and full traceback end checkptr = writeptr ---------------------------------------------------------------------- Comment By: Rick McGuire (bigrixx) Date: 2009-09-01 05:38 Message: Please provide a sample program that reproduces this problem. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684730&aid=2848293&group_id=119701 |