Discussion:
[fpc-devel] TStreamReader (streamex unit) issue
Andrea Mauri via fpc-devel
2021-04-08 08:36:47 UTC
Permalink
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
Michael Van Canneyt via fpc-devel
2021-04-09 07:11:28 UTC
Permalink
Hello,

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

Michael.
Post by Andrea Mauri via fpc-devel
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
[...]
FillBuffer;
VPosition := FBufferPosition;
[...]
Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64
https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820
Is it a bug or am I missing something?
Kind regards,
Andrea
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/ma
Andrea Mauri via fpc-devel
2021-04-09 11:59:22 UTC
Permalink
Submitted as: 0038734 (https://bugs.freepascal.org/view.php?id=38734)
Post by Michael Van Canneyt via fpc-devel
Hello,
Can you please post this in the bugtracker ?
So it will not be forgotten.
Michael.
Post by Andrea Mauri via fpc-devel
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
Post by Andrea Mauri via fpc-devel
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
Post by Andrea Mauri via fpc-devel
to reproduce the problem.
I believe the bug can be fixed by updating VPByte right after FillBuffer
is
Post by Andrea Mauri via fpc-devel
[...]
FillBuffer;
VPosition := FBufferPosition;
[...]
Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64
https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820
Post by Andrea Mauri via fpc-devel
Is it a bug or am I missing something?
Kind regards,
Andrea
Michael Van Canneyt via fpc-devel
2021-04-09 12:54:32 UTC
Permalink
Thanks. I've assigned it to myself.

Michael.
Post by Andrea Mauri via fpc-devel
Submitted as: 0038734 (https://bugs.freepascal.org/view.php?id=38734)
Post by Michael Van Canneyt via fpc-devel
Hello,
Can you please post this in the bugtracker ?
So it will not be forgotten.
Michael.
Post by Andrea Mauri via fpc-devel
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
Post by Andrea Mauri via fpc-devel
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
Post by Andrea Mauri via fpc-devel
to reproduce the problem.
I believe the bug can be fixed by updating VPByte right after FillBuffer
is
Post by Andrea Mauri via fpc-devel
[...]
FillBuffer;
VPosition := FBufferPosition;
[...]
Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64
https://forum.lazarus.freepascal.org/index.php?topic=54033.msg400820#msg400820
Post by Andrea Mauri via fpc-devel
Is it a bug or am I missing something?
Kind regards,
Andrea
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
https://lists.freepa

Loading...