[Seaside] random maddening bug - "corrupted" file upload contents

Bob Arning arning315 at comcast.net
Thu Jan 11 01:41:48 UTC 2018


I've been able to boil it down to one method. This fails sometimes and 
succeeds sometimes. Whichever it does, it tends to keep doing that for a 
while. Quitting and restarting may get it to change.

test4
"
self test4
"
     | species bufferSize buffer totalRead outputStream answer 
inputStream ba byte1 |

     false ifTrue: [
         ba := (FileStream readOnlyFileNamed: '/Users/bob/z99.zip') 
binary; contentsOfEntireFile.
      ] ifFalse: [
         ba := ByteArray new: 18202085.
         ba atAllPut: 99.
         1 to: 20 do: [  :i | ba at: i put: (#[80 75 3 4 10 7 7 7 7 7 
125 83 67 73 7 7 7 7 7 7] at: i) ].
      ].
     inputStream := ba readStream.
     bufferSize := 16384.
     species := ByteArray.
     buffer := species new: bufferSize.
     totalRead := 0.
     outputStream := nil.
     [ inputStream atEnd ] whileFalse: [ | readCount |
         readCount := inputStream readInto: buffer startingAt: 1 count: 
bufferSize.
         totalRead = 0 ifTrue: [
             byte1 := buffer first.
         ].
         totalRead := totalRead + readCount.

         outputStream ifNil: [
             inputStream atEnd
                 ifTrue: [ ^ buffer copyFrom: 1 to: readCount ]
                 ifFalse: [ outputStream := (species new: bufferSize) 
writeStream ] ].
         outputStream next: readCount putAll: buffer startingAt: 1.
         byte1 = outputStream firstByte ifFalse: [ self halt ].
     ].
     answer := outputStream ifNil: [ species new ] ifNotNil: [ 
outputStream contents ].
     byte1 = answer first ifFalse: [ self halt ].
     ^answer


On 1/10/18 4:42 AM, Cyrille Delaunay wrote:
>
> Has anyone been able to reproduce my little scenario ?
> As a reminder, suspicion is that something "wrong" has been introduced 
> with Pharo6

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20180110/6d574809/attachment.html>


More information about the seaside mailing list