diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | io.c | 5 | ||||
-rw-r--r-- | test/ruby/test_system.rb | 10 |
3 files changed, 15 insertions, 10 deletions
@@ -1,3 +1,11 @@ +Tue Dec 23 19:42:59 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (rb_io_ungetc): raise an exception at unread stream to + avoid unspecified behavior. [ruby-dev:22330] + + * test/ruby/test_system.rb (test_syntax): glob relatively from + __FILE__. + Tue Dec 23 18:09:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org> * pack.c (pack_pack): remove unnecessary negative value check. @@ -27,7 +35,7 @@ Tue Dec 23 14:13:51 2003 akira yamada <akira@ruby-lang.org> * test/uri/test_generic.rb (TestGeneric::test_set_component): added tets. - + Tue Dec 23 11:08:34 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> * test/xsd/test_noencoding.rb: rescue Errno::EINVAL and do not test. @@ -1314,8 +1314,9 @@ rb_io_ungetc(io, c) int cc = NUM2INT(c); GetOpenFile(io, fptr); + if (!(fptr->mode & FMODE_RBUF)) + rb_raise(rb_eIOError, "unread stream"); rb_io_check_readable(fptr); - flush_before_seek(fptr); if (ungetc(cc, fptr->f) == EOF && cc != EOF) rb_sys_fail(fptr->path); @@ -3456,7 +3457,7 @@ rb_io_ctl(io, req, arg, io_p) rb_raise(rb_eArgError, "return value overflowed string"); } - if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) { + if (fptr->f2 && fileno(fptr->f) != fileno(fptr->f2)) { /* call on f2 too; ignore result */ io_cntl(fileno(fptr->f2), cmd, narg, io_p); } diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index 71eb7ad183..a19f6ef9b7 100644 --- a/test/ruby/test_system.rb +++ b/test/ruby/test_system.rb @@ -54,15 +54,11 @@ class TestSystem < Test::Unit::TestCase File.unlink "script_tmp" or `/bin/rm -f "script_tmp"` File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"` + end - if (dir = File.dirname(File.dirname($0))) == '.' - dir = "" - else - dir << "/" - end - + def test_syntax assert_nothing_raised(Exception) do - for script in Dir["#{dir}{lib,sample,ext}/**/*.rb"] + for script in Dir[File.expand_path("../../../{lib,sample,ext}/**/*.rb", __FILE__)] valid_syntax? IO::read(script), script end end |