Ungetc

e$B$^$:$O!"0J2<$N$h$&$K$9$k$He(B core e$B$rEG$-$^$9!#e(B

% ./ruby -ve ‘10000.times { STDIN.ungetc “a” }’
ruby 1.9.0 (2007-08-25 patchlevel 0) [i686-linux]
*** glibc detected *** free(): invalid next size (normal): 0x081bdc40


zsh: abort (core dumped) ./ruby -ve ‘10000.times { STDIN.ungetc “a” }’
% gdb ruby core.24221
GNU gdb 6.4.90-debian
Copyright © 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for
details.
This GDB was configured as “i486-linux-gnu”…Using host libthread_db
library “/lib/tls/libthread_db.so.1”.

warning: Can’t read pathname for load map: Input/output error.
Reading symbols from /lib/tls/libpthread.so.0…done.
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/tls/libdl.so.2…done.
Loaded symbols for /lib/tls/libdl.so.2
Reading symbols from /lib/tls/libcrypt.so.1…done.
Loaded symbols for /lib/tls/libcrypt.so.1
Reading symbols from /lib/tls/libm.so.6…done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6…done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2…done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./ruby -ve 10000.times { STDIN.ungetc “a” }’.
Program terminated with signal 6, Aborted.
#0 0xb7e04947 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7e04947 in raise () from /lib/tls/libc.so.6
#1 0xb7e060c9 in abort () from /lib/tls/libc.so.6
#2 0xb7e3a08a in __fsetlocking () from /lib/tls/libc.so.6
#3 0xb7e4194f in mallopt () from /lib/tls/libc.so.6
#4 0xb7e419f2 in free () from /lib/tls/libc.so.6
#5 0x08067042 in rb_io_fptr_finalize (fptr=0x81a9d08) at io.c:2331
#6 0x0806332b in rb_gc_call_finalizer_at_exit () at gc.c:2014
#7 0x08059d44 in ruby_finalize_1 () at eval.c:147
#8 0x08059e2b in ruby_cleanup (ex=0) at eval.c:181
#9 0x0805a09b in ruby_run_node (n=0xb7d38314) at eval.c:256
#10 0x080573f5 in main (argc=1236284, argv=0xb7f61518, envp=0xb7f93080)
at main.c:46
(gdb)

io.c e$B$NJQ99$r8+$k$H!“e(Bungetc failed e$B$NNc30H/@8%3!<%I$,>C$($Fe(B
e$B$$$k$N$G$9$,!”%P%C%U%!$O8GDjD9$G$"$k$?$a!"$?$/$5$se(B ungetc e$B$9e(B
e$B$l$P!"$$$:$l$O$$$C$Q$$$K$J$C$F<:GT$K$;$6$k$r$($^$;$s!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs