Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

19-file-ops.t fails for nqp 2013.09 @ parrot 5.7.0 #133

Closed
FROGGS opened this issue Sep 24, 2013 · 7 comments
Closed

19-file-ops.t fails for nqp 2013.09 @ parrot 5.7.0 #133

FROGGS opened this issue Sep 24, 2013 · 7 comments

Comments

@FROGGS
Copy link
Contributor

FROGGS commented Sep 24, 2013

nqp --version
This is nqp version 2013.09 built on parrot 5.7.0 revision 0
uname -a
Linux localhost 3.11.0-gentoo #1 SMP Wed Sep 4 10:27:45 CST 2013 x86_64 AMD Phenom(tm) II X4 965 Processor AuthenticAMD GNU/Linux
t/nqp/19-file-ops.t ................... 1/40 src/io/utilities.c:370: failed assertion 'byte_length > 0'
Backtrace - Obtained 21 stack frames (max trace depth is 32).
/usr/lib64/libparrot.so.5.7.0(+0x89ea4) [0x7f4344886ea4]
/usr/lib64/libparrot.so.5.7.0(Parrot_confess+0x2c) [0x7f43448501e2]
/usr/lib64/libparrot.so.5.7.0(+0xc9ea6) [0x7f43448c6ea6]
/usr/lib64/libparrot.so.5.7.0(Parrot_io_readall_s+0x110) [0x7f43448c29a0]
/usr/lib64/libparrot.so.5.7.0(+0x11f388) [0x7f434491c388]
/usr/lib64/libparrot.so.5.7.0(+0x12c2d4) [0x7f43449292d4]
/usr/lib64/libparrot.so.5.7.0(+0xb2879) [0x7f43448af879]
/usr/lib64/libparrot.so.5.7.0(+0xb1fed) [0x7f43448aefed]
/usr/lib64/libparrot.so.5.7.0(+0x9aff4) [0x7f4344897ff4]
/usr/lib64/libparrot.so.5.7.0(Parrot_pcc_invoke_from_sig_object+0xae) [0x7f4344893c7e]
/usr/lib64/libparrot.so.5.7.0(Parrot_ext_call+0xd7) [0x7f43448878c7]
/usr/lib64/libparrot.so.5.7.0(+0x160601) [0x7f434495d601]
/usr/lib64/libparrot.so.5.7.0(Parrot_pcc_invoke_from_sig_object+0x6e) [0x7f4344893c3e]
/usr/lib64/libparrot.so.5.7.0(Parrot_ext_call+0xd7) [0x7f43448878c7]
/usr/lib64/libparrot.so.5.7.0(+0xb644f) [0x7f43448b344f]
/usr/lib64/libparrot.so.5.7.0(Parrot_cx_begin_execution+0x57) [0x7f43448b3547]
/usr/lib64/libparrot.so.5.7.0(Parrot_pf_execute_bytecode_program+0x9e) [0x7f43448bb9fe]
/usr/lib64/libparrot.so.5.7.0(Parrot_api_run_bytecode+0xd3) [0x7f4344883273]
./nqp(main+0x170) [0x4013c0]
/lib64/libc.so.6(__libc_start_main+0xf5) [0x7f4344476c05]
./nqp() [0x401471]
Attempting to get PIR backtrace.  No guarantees.  Here goes...
current instr.: '' pc 532 ((file unknown):25783034) (t/nqp/19-file-ops.t:28)
called from Sub '' pc 28745 (src/stage2/gen/NQPHLL.pir:11240) (src/stage2/gen/NQPHLL.nqp:1130)
called from Sub 'eval' pc 28392 (src/stage2/gen/NQPHLL.pir:11097) (src/stage2/gen/NQPHLL.nqp:1117)
called from Sub 'evalfiles' pc 31717 (src/stage2/gen/NQPHLL.pir:12495) (src/stage2/gen/NQPHLL.nqp:1323)
called from Sub 'command_eval' pc 30144 (src/stage2/gen/NQPHLL.pir:11883) (src/stage2/gen/NQPHLL.nqp:1227)
called from Sub 'command_line' pc 29463 (src/stage2/gen/NQPHLL.pir:11594) (src/stage2/gen/NQPHLL.nqp:1202)
called from Sub 'MAIN' pc 588 (src/stage2/gen/NQP.pir:200) (src/stage2/gen/NQP.nqp:3546)
called from Sub '' pc 565 (src/stage2/gen/NQP.pir:187) (src/stage2/gen/NQP.nqp:3541)
called from Sub '' pc 153558 (src/stage2/gen/NQP.pir:55168) (src/stage2/gen/NQP.nqp:3519)
t/nqp/19-file-ops.t ................... Failed 26/40 subtests 
@arnsholt
Copy link
Contributor

It seems to work for me, on a Red Hat 6 machine. Could you perhaps try blowing away the install/ directory and recompiling everything?

@Mouq
Copy link
Contributor

Mouq commented Sep 28, 2013

Dies on Mac OS X too, but only after upgrading parrot from 5.5.0 to 5.7.0 (note: ok 15 still wasn't passing previously)

$ nqp --version
This is nqp version 2013.09-39-g0bf3998 built on parrot 5.7.0 revision RELEASE_5_7_0-8-g918f0da
$ uname -a
Darwin amoquin.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
$ nqp t/nqp/19-file-ops.t
1..40
ok 1 - nqp::stat exists
ok 2 - nqp::stat not exists
ok 3 - nqp::stat is directory
ok 4 - nqp::stat not directory
ok 5 - nqp::stat is regular file
ok 6 - nqp::stat not regular file
ok 7 - nqp::open for read
ok 8 - nqp::tellfh start of file
ok 9 - nqp::readlinefh line to read
ok 10 - nqp::tellfh line two
ok 11 - nqp::readallfh lines to read
ok 12 - nqp::tellfh end of file
ok 13 - nqp::readlinefh end of file
ok 14 - nqp::readlinefh end of file repeat
src/io/utilities.c:370: failed assertion 'byte_length > 0'
Backtrace - Obtained 22 stack frames (max trace depth is 32).
0   libparrot.dylib                     0x000000010ab89d0a Parrot_print_backtrace + 58
1   libparrot.dylib                     0x000000010ab8848a Parrot_confess + 170
2   libparrot.dylib                     0x000000010ac23544 io_read_chars_append_string + 340
3   libparrot.dylib                     0x000000010ac155ad Parrot_io_readall_s + 925
4   libparrot.dylib                     0x000000010accc4b7 Parrot_FileHandle_nci_readall + 695
5   libparrot.dylib                     0x000000010ace48a4 Parrot_NativePCCMethod_invoke + 180
6   libparrot.dylib                     0x000000010ab43b6c Parrot_callmethodcc_p_sc + 268
7   libparrot.dylib                     0x000000010abe9549 runops_fast_core + 201
8   libparrot.dylib                     0x000000010abe8909 runops_int + 265
9   libparrot.dylib                     0x000000010abb693a runops + 506
10  libparrot.dylib                     0x000000010abaccf3 Parrot_pcc_invoke_from_sig_object + 451
11  libparrot.dylib                     0x000000010ab8aaa1 Parrot_ext_call + 593
12  libparrot.dylib                     0x000000010ad43556 Parrot_Task_invoke + 342
13  libparrot.dylib                     0x000000010abacc92 Parrot_pcc_invoke_from_sig_object + 354
14  libparrot.dylib                     0x000000010ab8aaa1 Parrot_ext_call + 593
15  libparrot.dylib                     0x000000010abf1602 Parrot_cx_next_task + 338
16  libparrot.dylib                     0x000000010abf12a6 Parrot_cx_outer_runloop + 182
17  libparrot.dylib                     0x000000010abf0fa3 Parrot_cx_begin_execution + 339
18  libparrot.dylib                     0x000000010ac054c8 Parrot_pf_execute_bytecode_program + 424
19  libparrot.dylib                     0x000000010ab8021d Parrot_api_run_bytecode + 541
20  nqp                                 0x000000010a8c5060 main + 448
21  libdyld.dylib                       0x00007fff8ea607e1 start + 0
Attempting to get PIR backtrace.  No guarantees.  Here goes...
current instr.: '' pc 532 ((file unknown):1267257113) (t/nqp/19-file-ops.t:28)
called from Sub '' pc 28745 (src/stage2/gen/NQPHLL.pir:11240) (src/stage2/gen/NQPHLL.nqp:1130)
called from Sub 'eval' pc 28392 (src/stage2/gen/NQPHLL.pir:11097) (src/stage2/gen/NQPHLL.nqp:1117)
called from Sub 'evalfiles' pc 31717 (src/stage2/gen/NQPHLL.pir:12495) (src/stage2/gen/NQPHLL.nqp:1323)
called from Sub 'command_eval' pc 30144 (src/stage2/gen/NQPHLL.pir:11883) (src/stage2/gen/NQPHLL.nqp:1227)
called from Sub 'command_line' pc 29463 (src/stage2/gen/NQPHLL.pir:11594) (src/stage2/gen/NQPHLL.nqp:1202)
called from Sub 'MAIN' pc 588 (src/stage2/gen/NQP.pir:200) (src/stage2/gen/NQP.nqp:3546)
called from Sub '' pc 565 (src/stage2/gen/NQP.pir:187) (src/stage2/gen/NQP.nqp:3541)
called from Sub '' pc 153570 (src/stage2/gen/NQP.pir:55172) (src/stage2/gen/NQP.nqp:3519)
[1]    21235 abort      nqp t/nqp/19-file-ops.t

@FROGGS
Copy link
Contributor Author

FROGGS commented Sep 29, 2013

can you please test this patch?

diff --git a/src/io/api.c b/src/io/api.c
index 3296f5c..b2f811a 100644
--- a/src/io/api.c
+++ b/src/io/api.c
@@ -791,7 +791,8 @@ Parrot_io_readall_s(PARROT_INTERP, ARGMOD(PMC *handle))
             STRING * const s = io_get_new_empty_string(interp, encoding, -1, remaining_size);

             io_sync_buffers_for_read(interp, handle, vtable, read_buffer, write_buffer);
-            io_read_chars_append_string(interp, s, handle, vtable, read_buffer, remaining_size);
+            if (remaining_size > 0 && !Parrot_io_eof(interp, handle))
+                io_read_chars_append_string(interp, s, handle, vtable, read_buffer, remaining_size);
             return s;
         }
     }

@FROGGS
Copy link
Contributor Author

FROGGS commented Sep 29, 2013

@Mouq
Copy link
Contributor

Mouq commented Sep 29, 2013

t/nqp/19-file-ops.t ................... ok
The patched fixed it on my computer. FROGGS++

@FROGGS
Copy link
Contributor Author

FROGGS commented Sep 29, 2013

parrot/parrot#981

@rurban
Copy link

rurban commented Sep 30, 2013

parrot fixed with parrot/parrot@2abb109
Thanks a lot!

@FROGGS FROGGS closed this as completed in 384469f Oct 16, 2013
FROGGS added a commit that referenced this issue Oct 29, 2013
kentfredric pushed a commit to kentfredric/parrot that referenced this issue Nov 28, 2013
This fails on gentoo as seen here: Raku/nqp#133
Now it does not try to read from a file when there are no bytes left.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants