From: nobu@... Date: 2021-03-08T08:41:33+00:00 Subject: [ruby-core:102773] [Ruby master Bug#17673] sysseek(0) and '1A' in header return "EOFError (end of file reached)" Issue #17673 has been updated by nobu (Nobuyoshi Nakada). This is not specific to Ruby, but the very (in)famous text mode spec of Windows (and other dosish systems). ---------------------------------------- Bug #17673: sysseek(0) and '1A' in header return "EOFError (end of file reached)" https://bugs.ruby-lang.org/issues/17673#change-90793 * Author: stiuna (Juan Gregorio) * Status: Closed * 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: