Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-04

TStreamReader (streamex unit) issue

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

Dear all,
TStreamReader.ReadLine seems to fail under specific circumstances. I created a test to easily reproduce the problem.
The test makes use of a TStream that behaves in a weird, but formally correct way. I created it based on a real experience with the StdIn that I was able to reproduce thanks to pre-existing logging. I suggest you use the test on Windows otherwise I'm not sure you'll be able to reproduce the problem.

I believe the bug can be fixed by updating VPByte right after FillBuffer is called:

      [...]
      FillBuffer;
      VPByte := @FBuffer[FBufferPosition]; //bugfix
      VPosition := FBufferPosition;
      [...]

Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64

Posted on lazarus forum at:
https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820

Is it a bug or am I missing something?

Kind regards,
Andrea

Reply by email

Michael Van Canneyt
to Andrea Mauri

Hello,

Can you please post this in the bugtracker ?
So it will not be forgotten.

Michael.

Andrea Mauri wrote 28 lines
Dear all, TStreamReader.ReadLine seems to fail under specific circumstances. I created a test to easily reproduce the problem. The test makes use of a TStream that behaves in a weird, but formally correct way. I created it based on a real experience with the StdIn that I was able to reproduce thanks to pre-existing logging. I suggest you use the test on Windows otherwise I'm not sure you'll be able to reproduce the problem. I believe the bug can be fixed by updating VPByte right after FillBuffer is called: [...] FillBuffer; VPByte := @FBuffer[FBufferPosition]; //bugfix VPosition := FBufferPosition; [...] Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64 Posted on lazarus forum at: https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820 Is it a bug or am I missing something? Kind regards, Andrea

Reply by email

Andrea Mauri
to Michael Van Canneyt

Submitted as: 0038734 (https://bugs.freepascal.org/view.php?id=38734)

Michael Van Canneyt wrote 43 lines
Hello, Can you please post this in the bugtracker ? So it will not be forgotten. Michael. On Thu, 8 Apr 2021, Andrea Mauri via fpc-devel wrote: > Dear all, > TStreamReader.ReadLine seems to fail under specific circumstances. > I created a test to easily reproduce the problem. > The test makes use of a TStream that behaves in a weird, but formally > correct way. I created it based on a real experience with the StdIn that I > was able to reproduce thanks to pre-existing logging. > I suggest you use the test on Windows otherwise I'm not sure you'll be able > to reproduce the problem. > > I believe the bug can be fixed by updating VPByte right after FillBuffer is > called: > > [...] > FillBuffer; > VPByte := @FBuffer[FBufferPosition]; //bugfix > VPosition := FBufferPosition; > [...] > > Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64 > > Posted on lazarus forum at: > https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820 > > Is it a bug or am I missing something? > > Kind regards, > Andrea >

Reply by email

Michael Van Canneyt
to Andrea Mauri

Thanks. I've assigned it to myself.

Michael.

Andrea Mauri wrote 49 lines
Submitted as: 0038734 (https://bugs.freepascal.org/view.php?id=38734) On Fri, 9 Apr 2021 at 09:11, Michael Van Canneyt wrote: > > Hello, > > Can you please post this in the bugtracker ? > So it will not be forgotten. > > Michael. > > On Thu, 8 Apr 2021, Andrea Mauri via fpc-devel wrote: > >> Dear all, >> TStreamReader.ReadLine seems to fail under specific circumstances. >> I created a test to easily reproduce the problem. >> The test makes use of a TStream that behaves in a weird, but formally >> correct way. I created it based on a real experience with the StdIn that > I >> was able to reproduce thanks to pre-existing logging. >> I suggest you use the test on Windows otherwise I'm not sure you'll be > able >> to reproduce the problem. >> >> I believe the bug can be fixed by updating VPByte right after FillBuffer > is >> called: >> >> [...] >> FillBuffer; >> VPByte := @FBuffer[FBufferPosition]; //bugfix >> VPosition := FBufferPosition; >> [...] >> >> Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64 >> >> Posted on lazarus forum at: >> > https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820 >> >> Is it a bug or am I missing something? >> >> Kind regards, >> Andrea >> >

Reply by email