[Bug 59908] New: Reading a file: When a line is longer, End of File (EOF) is triggered
http://bugs.winehq.org/show_bug.cgi?id=59908 Bug ID: 59908 Summary: Reading a file: When a line is longer, End of File (EOF) is triggered Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: critical Priority: P2 Component: -unknown Assignee: wine-bugs@list.winehq.org Reporter: horst53@mail.de Distribution: --- I have a text file. It contains many lines. I have a program written in VB2022, using .net Framework 4.8. You can try it yourself with this simple code: FileOpen(1, "test.txt", OpenMode.Input) Do Until EOF(1) MsgBox(Len(LineInput(1))) Loop FileClose(1) If a line in the test.txt file is longer (ca. 5000+ chars), the rest of the file is skipped. This may potentially lead to data loss. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |normal --- Comment #1 from Ken Sharp <imwellcushtymelike@gmail.com> --- Wine version? Console output? https://gitlab.winehq.org/wine/wine/-/wikis/Bugs -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #2 from Nikolay Sivov <bunglehead@gmail.com> --- (In reply to horst53 from comment #0)
I have a text file. It contains many lines. I have a program written in VB2022, using .net Framework 4.8. You can try it yourself with this simple code:
FileOpen(1, "test.txt", OpenMode.Input) Do Until EOF(1) MsgBox(Len(LineInput(1))) Loop FileClose(1)
If a line in the test.txt file is longer (ca. 5000+ chars), the rest of the file is skipped. This may potentially lead to data loss.
Hi. Could you attach a source file that is possible to compile and test? Also please attach a text file that shows the issue. Are you running this with .NET installed on Wine or with wine-mono? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Janne <janne.kekkonen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janne.kekkonen@gmail.com --- Comment #3 from Janne <janne.kekkonen@gmail.com> --- Hello, tested this with fresh 32-bit prefix on Wine 11.11. .NET was not installed. The application was compiled with Microsoft.NET Framework version 4.0.30319, on Windows 11. Command used to build application: C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe /target:exe /out:test32.exe test.vb Source code: Module Program Sub Main() FileOpen(1, "test.txt", OpenMode.Input) Do Until EOF(1) MsgBox(Len(LineInput(1))) Loop FileClose(1) End Sub End Module I tested the application with a 4-line test.txt file, where the third line is 5,069 characters long. The application successfully displays the length information for lines 1 through 3, but it exits immediately after the third message box. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Janne <janne.kekkonen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|janne.kekkonen@gmail.com | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #4 from Nikolay Sivov <bunglehead@gmail.com> --- Works fine for me with current wine. Not sure what could be wrong. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Janne <janne.kekkonen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janne.kekkonen@gmail.com --- Comment #5 from Janne <janne.kekkonen@gmail.com> --- I also tested the application with a 4-line test.txt file using much shorter line lengths. The first line had 1 character, the second line had 2 characters, the third had 3 characters, and the fourth had 4 characters. With this file, only the length of the first line was displayed before the application exited/crashed. My test file had Lf as line separator. Could this cause issues? According to this: https://www.vb-net.com/Dotnet/Vb/VafctLineInput.htm LineInput reads characters until it encounters a Cr or CrLf. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Janne <janne.kekkonen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|janne.kekkonen@gmail.com | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #6 from horst53@mail.de --- Hello @Janne: Source code: Module Program Sub Main() FileOpen(1, "test.txt", OpenMode.Input) Do Until EOF(1) MsgBox(Len(LineInput(1))) Loop FileClose(1) End Sub End Module Your code should be useful to reproduce the problem. Please use more than three lines. In my case, End Of File came after a very long line. Just try 10000 chars to get sure. After that, the following lines were skipped. But: I rewrote my code using a StreamReader and also read line by line. This works perfectly. I use the latest wine on Ubuntu 26.04 LTS. If a reproduction should not be possible I can write a test EXE and TXT file, of course. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #7 from Janne <janne.kekkonen@gmail.com> --- Hello, I logged my test application and according to logs there were only one call to Kernel32.ReadFile with NumberOfBytesToRead set to 400. I looked LineInput implementation from mono. Code & link to code at the end. This is just quessing what might happen in case of my four line test file. First call to LineInput reads whole file and file pointer is to EOF. Next call to LineInput and check IsEOF is true -> all done. (Not sure is code below the correct one.) https://gitlab.winehq.org/mono/mono-basic/-/blob/main/vbruntime/Microsoft.Vi... Public Function LineInput() As String VerifyFileModes(OpenMode.Input, OpenMode.Binary) VerifyReadAccess() If IsEOF() Then Throw Microsoft.VisualBasic.CompilerServices.ExceptionUtils.GetVBException(VBErrors.ERR62_Input_past_end_of_file) Return Reader.ReadLine() End Function Private ReadOnly Property IsEOF() As Boolean Get Return Stream.Position = Stream.Length End Get End Property -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #8 from Janne <janne.kekkonen@gmail.com> --- Hello horst53, I created a text file with 25 lines, where the first line was 12,115 characters long. The following line lengths varied between 175 and 4,600 characters. The test application successfully showed the length of every line in this file. I then modified the file by moving the ~12k character line to the very end, and adding two lines with a length below 5 characters after it. In this case, the test application exited right after the ~12k character line. This seems to be the same issue I saw with the very small files. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #9 from horst53@mail.de --- Thanks for testing -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Esme Povirk <madewokherd@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |mscoree CC| |madewokherd@gmail.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #10 from Janne <janne.kekkonen@gmail.com> --- Created attachment 81257 --> http://bugs.winehq.org/attachment.cgi?id=81257 Test applications for LineInput Hello, i made another test application that prints the file pointer value after each read operation. In Windows output looks like this:
test2 After FileOpen FP = 1 Start to read file 1, FP = 4 12, FP = 8 123, FP = 13 1234, FP = 19
However, in Wine, output looks like this:
WINEDEBUG=-all,-fixme WINEPREFIX=~/dotnet wine test2.exe /builds/mono/wine-mono/wine-mono-11.1.0/mono/mono/eglib/gmisc-win32.c:138: assertion 'filename != NULL' failed
After FileOpen FP = 1 Start to read file 1, FP = 14
Attached is a ZIP file containing the source code, executables for both test applications, test.txt, and build.bat. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #11 from Esme Povirk <madewokherd@gmail.com> --- It's likely that the VB.NET class libraries for this aren't well-tested, and the code quality isn't great. But this is basic functionality that I consider to be very important. I have on my todo list to look into this. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #12 from Esme Povirk <madewokherd@gmail.com> --- Yeah, I don't think StreamReader/StreamWriter (which buffer) can be used simultaneously with the underlying Stream the way FileData does here. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #13 from Esme Povirk <madewokherd@gmail.com> --- MR sent: https://gitlab.winehq.org/mono/mono/-/merge_requests/238 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 --- Comment #14 from Janne <janne.kekkonen@gmail.com> --- Hello, I tested my test application with Wine11.16. Now whole file is read & printed.
wine --version wine-11.16 WINEDEBUG=-all,-fixme WINEPREFIX=~/dotnet wine test2.exe After FileOpen FP = 1 Start to read file 1, FP = 3 12, FP = 6 123, FP = 10 1234, FP = 14
I also tested the original application with text file containing one very long line (15k characters). The remaining lines were between 400 and 4096 characters. The length for all lines was shown correctly. It seems to me that this issue is fixed. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Esme Povirk <madewokherd@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |29a87db3c71d9cc7e4c20fa44eb | |813172c0e11a9 Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #15 from Esme Povirk <madewokherd@gmail.com> --- Reported fixed. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59908 Alexandre Julliard <julliard@winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #16 from Alexandre Julliard <julliard@winehq.org> --- Closing bugs fixed in 11.18. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla