Hallo,
I've got a file open for IO. Only writing to it works okay. But if I also try to read from it, then things start going wrong. I've attached a test case that should return NIL but instead raises an error in ABCL (1.3.3, on OSX).
The problem is with the call to #'write-sequence on line 21.
In fact, from some other tests, I believe that replacing that call to #'write-sequence with a call to a function that does the same thing but by repeatedly setting the file-position and writing a byte, for each byte in the sequence, fixes things. That means something about #'write-sequence is broken.
Maybe I misunderstand the file level functions in Common Lisp, and my test doesn't use them correctly. However, the test passes in: CLISP, CCL, CMUCL, SBCL, ECL. So I thought I'd report this, just in case it is a bug in ABCL.
Also, removing the last three lines of code in #'main, which read one byte, makes the test run without errors.
Vibhu
A shorter test that shows a problem with file position: (with-open-file (stream "/tmp/io_test.tmp" :element-type '(unsigned-byte 8) :direction :io :if-exists :supersede :if-does-not-exist :create) (write-byte 10 stream) (file-position stream 0) (read-byte stream) (let ((before (file-position stream))) (write-byte 1 stream) (values before (file-position stream))))
Returns 1 1, should have been 1 2.
On Thu, Jun 30, 2016 at 4:05 AM, Vibhu Mohindra vibhu.mohindra@gmail.com wrote:
Hallo,
I've got a file open for IO. Only writing to it works okay. But if I also try to read from it, then things start going wrong. I've attached a test case that should return NIL but instead raises an error in ABCL (1.3.3, on OSX).
The problem is with the call to #'write-sequence on line 21.
In fact, from some other tests, I believe that replacing that call to #'write-sequence with a call to a function that does the same thing but by repeatedly setting the file-position and writing a byte, for each byte in the sequence, fixes things. That means something about #'write-sequence is broken.
Maybe I misunderstand the file level functions in Common Lisp, and my test doesn't use them correctly. However, the test passes in: CLISP, CCL, CMUCL, SBCL, ECL. So I thought I'd report this, just in case it is a bug in ABCL.
Also, removing the last three lines of code in #'main, which read one byte, makes the test run without errors.
Vibhu
Hi,
RandomAccessCharacterFile.java needed fixing. I've modified the version in abcl-1.3.2 and attached it. It makes my original test case pass. It also makes Stas's shorter test case pass.
I was able to make Stas's test case pass before mine, so they aren't identical.
I've also attached Java versions of those two test cases.
I haven't run any of abcl's existing tests or the ANSI test suite against my version of RandomAccessCharacterFile.java to check for regressions. But my own program that does a lot of IO runs correctly against it.
Vibhu
On 7/23/16 16:32, Vibhu Mohindra wrote:
Hi,
RandomAccessCharacterFile.java needed fixing. I've modified the version in abcl-1.3.2 and attached it. It makes my original test case pass. It also makes Stas's shorter test case pass.
[…]
I've also attached Java versions of those two test cases.
[…]
Thanks for the patch!
I'd like to get your tests running, but I need some insight into the nature of the test data. So, what exactly are the contents of "test.dat" and "test3.dat"? And what problems are you testing?
Feel free to email the contents of these files to my private address if the mailing list has problems and/or the contents are too large.
regards, Mark
Hi Mark,
Sorry, this slipped past me until just now.
On 15/08/2016 07:07, Mark Evenson wrote:
Thanks for the patch!
I'd like to get your tests running, but I need some insight into the nature of the test data. So, what exactly are the contents of "test.dat" and "test3.dat"?
Oh those don't exist. The tests create them.
And what problems are you testing?
The original email in this thread described a bug. This tests that that is fixed.
regards, Mark
Vibhu
On 02 Sep 2016, at 16:20, Vibhu Mohindra vibhu.mohindra@gmail.com wrote:
Hi Mark,
Sorry, this slipped past me until just now.
On 15/08/2016 07:07, Mark Evenson wrote:
Thanks for the patch!
I'd like to get your tests running, but I need some insight into the nature of the test data. So, what exactly are the contents of "test.dat" and "test3.dat"?
Oh those don't exist. The tests create them.
Hmmm. I didn’t see how that was possible in your code, but I was moving fast so must have made a mistake. I’ll go back to look.
On 2016/7/23 16:32, Vibhu Mohindra wrote:
Hi,
RandomAccessCharacterFile.java needed fixing. I've modified the version in abcl-1.3.2 and attached it. It makes my original test case pass. It also makes Stas's shorter test case pass.
I was able to make Stas's test case pass before mine, so they aren't identical.
I've also attached Java versions of those two test cases.
I haven't run any of abcl's existing tests or the ANSI test suite against my version of RandomAccessCharacterFile.java to check for regressions. But my own program that does a lot of IO runs correctly against it.
Vibhu
Applied as [r14863](http://abcl.org/trac/changeset/14863); thanks for the help here!
I need to give better instructions on how to package tests. I'm about to give the Maven integration a shove to prepare abcl-1.4.0 artifacts, so I might as well report on the failing test suite while I am at it.
armedbear-devel@common-lisp.net