file_ops: if FILE_CNT not available, reading binary files causes problems
Problem pseudo-confirmed so far on a foreign MIPS platform in remote ssh session (wasn't able to perform some important test due to lack of GCC compiler on the platform nor proper tools to do so).
If ECL_FILE_CNT is set to 0 during the cross-compilation ECL tries its best to work on the system, however if we have static files, we exactly know what is a file size with io_file_length
(at least on Unix, didn't check Windows – Unix mechanism uses fstat
) read bytes treats 0x00 values as EOF and we have an end-of-file exception.
(preasumbly) steps to reproduce:
-
Build ECL without FILE_CNT (may require some hacking of configure if we want to build it on the host machine)
-
Create binary file with non-zero values at the beginning and zero-values (0x00) later
-
Run
(with-open-file (s stream
:direction :input
:element-type '(unsigned-byte 8))
(print `("scanning-file" :from ,(file-position stream)
:length ,(file-length stream)))
(do ((byte #1=(read-byte stream nil 'done) #1#))
((eql byte 'done)
(print `(:file-acquireable-position ,(file-position stream))))
(princ #\.)))
Notes: This is not very urgent since usually we have FILE_CNT.