[ruby-core:102753] [Ruby master Bug#17673] sysseek(0) and '1A' in header return "EOFError (end of file reached)"
From:
cart4for1@...
Date:
2021-03-05 23:28:51 UTC
List:
ruby-core #102753
Issue #17673 has been updated by stiuna (Juan Gregorio).
Can you try on a different machine to check if this is a local problem?
Unfortunately I don't have another computer to test the bug with, what version of ruby do you use?
----------------------------------------
Bug #17673: sysseek(0) and '1A' in header return "EOFError (end of file reached)"
https://bugs.ruby-lang.org/issues/17673#change-90766
* Author: stiuna (Juan Gregorio)
* Status: Feedback
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The first byte of my file starts with the value **'1A'** .
Then:
``` ruby
descriptor = IO.sysopen(filePath)
file2Read = IO.new(descriptor)
file2Read.sysseek(0)
p file2Read.sysread(2).unpack('H*')
#=> "EOFError (end of file reached)"
```
But when I change the first byte of my file to **'AA'** for example.
Then:
``` ruby
#=> "aa45"
```
Is it a bug or am I missing something? I thought sysseek only changed the cursor and nothing else.
This error only occurs with byte **'1A'** I did the test with the rest of the bytes **[00..FF]** and there is no problem except with **'1A'** .
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>