diff -urN ruby18.orig/Makefile ruby18/Makefile --- ruby18.orig/Makefile Fri Feb 4 23:59:24 2005 +++ ruby18/Makefile Tue Feb 22 21:16:49 2005 @@ -7,7 +7,7 @@ PORTNAME= ruby PORTVERSION= ${RUBY_PORTVERSION} -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= lang ruby ipv6 MASTER_SITES= ${MASTER_SITE_RUBY} MASTER_SITE_SUBDIR= ${MASTER_SITE_SUBDIR_RUBY} @@ -42,6 +42,7 @@ RUBY_NO_RUN_DEPENDS= yes #USE_AUTOCONF= yes # does not work with 2.13; requires 2.53 or later +USE_REINPLACE= yes GNU_CONFIGURE= yes WRKSRC= ${RUBY_WRKSRC} CONFIGURE_ARGS= ${RUBY_CONFIGURE_ARGS} \ @@ -58,16 +59,13 @@ LATEST_LINK= ruby-devel .include -.if ${OSVERSION} >= 502102 -RUBY_ENABLE_PTHREAD?= public demand -.endif - -.if defined(RUBY_ENABLE_PTHREAD) && ${RUBY_ENABLE_PTHREAD} != "no" -CONFIGURE_ARGS+= --enable-pthread -# There seems to be a bug in either gcc or libpthread that gets -# (mini)ruby to malfunction.. -CFLAGS:= ${CFLAGS:N-march=*} +.if ${ARCH} != "sparc64" +# XXX - It seems that the PTHREAD variables might be set wrong in +# bsd.port.mk for the sparc64 platform? Adding them here will +# cause the newly-built ruby to fail a 'make test'. +CONFIGURE_ENV= CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" \ + LIBS="${PTHREAD_LIBS}" .endif .if ${ARCH} == "ia64" @@ -134,6 +132,10 @@ ${MV} ${WRKSRC}/ext/dl/h2rb ${WRKSRC}/bin/ post-patch: +.if ${ARCH} != "sparc64" + ${REINPLACE_CMD} -e 's|-l$$pthread_lib|${PTHREAD_LIBS}|g' \ + ${WRKSRC}/configure +.endif ${FIND} ${PATCH_WRKSRC} -name '*.orig' -delete .for d in Win32API ${RM} -rf ${BUILD_WRKSRC}/ext/${d} diff -urN ruby18.orig/files/patch-100_cvs_updates ruby18/files/patch-100_cvs_updates --- ruby18.orig/files/patch-100_cvs_updates Wed Dec 31 19:00:00 1969 +++ ruby18/files/patch-100_cvs_updates Tue Feb 22 16:52:00 2005 @@ -0,0 +1,2615 @@ +diff -ruN -p ChangeLog ChangeLog +--- ChangeLog 2004-12-25 19:56:41.000000000 +0900 ++++ ChangeLog 2005-01-06 20:31:36.000000000 +0900 +@@ -1,3 +1,192 @@ ++Thu Jan 6 20:31:07 2005 NAKAMURA Usaku ++ ++ * ext/zlib/zlib.c (zstream_end): should return value. (backported ++ from CVS HEAD) ++ ++Thu Jan 6 19:55:13 2005 Hirokazu Yamamoto ++ ++ * win32/win32.c (rb_w32_close): didn't close socket handle. ++ [ruby-dev:25414] ++ ++ * win32/win32.c (rb_w32_open_osfhandle): bcc32's _open_osfhandle ++ never set EMFILE. ++ ++Thu Jan 6 17:14:31 2005 Hirokazu Yamamoto ++ ++ * random.c (random_seed): O_NONBLOCK isn't defined on some ++ platforms. [ruby-dev:25417] ++ ++Thu Jan 6 13:45:35 2005 Tanaka Akira ++ ++ * lib/time.rb: recognize +00:00 and GMT as a localtime. ++ ++Thu Jan 6 07:58:28 2005 Dave Thomas ++ ++ * lib/rdoc/usage.rb (RDoc::RDoc.usage_no_exit): Allow for colons ++ in path names on DOS machines. (thanks to Johan Nilsson) ++ ++Wed Jan 5 20:16:32 2005 Tanaka Akira ++ ++ * random.c (limited_big_rand): didn't work if SIZEOF_BDIGITS == 2. ++ [ruby-dev:25408] ++ ++ * random.c (random_seed): refined. ++ ++Wed Jan 5 12:49:39 2005 Nobuyoshi Nakada ++ ++ * eval.c (rb_thread_initialize): Thread objects cannot be initialized ++ again. fixed: [ruby-core:04067] ++ ++Wed Jan 5 10:48:16 2005 NAKAMURA Usaku ++ ++ * dir.c (dir_s_mkdir): win32 special processing doesn't need any ++ longer. (backported from CVS HEAD) ++ ++ * win32/win32.[ch] (rb_w32_mkdir): new function. POSIX.1 compatible ++ interface. (backported from CVS HEAD) ++ ++ * win32/win32.[ch] (rb_w32_rmdir): new function. (backported from CVS ++ HEAD) ++ ++Wed Jan 5 02:30:11 2005 Tanaka Akira ++ ++ * random.c (init_by_array): imported from mt19937ar-cok.tgz. ++ (genrand_int32): ditto. ++ (genrand_real): replaced with genrand_res53 in mt19937ar-cok. ++ (rand_init): support bignum for longer seed. ++ (random_seed): generate longer seed. ++ (make_mask): new function. ++ (limited_rand): ditto. ++ (limited_big_rand): ditto. ++ (rb_f_rand): call limited_rand and limited_big_rand. ++ [ruby-dev:25403] ++ ++Tue Jan 4 23:25:29 2005 Yukihiro Matsumoto ++ ++ * bignum.c (rb_big_rand): should return positive random number. ++ [ruby-dev:25401] ++ ++Tue Jan 4 11:15:29 2005 TAMURA Takashi ++ ++ * bignum.c (rb_big_rand): do not use rb_big_modulo to generate ++ random bignums. [ruby-dev:25396] ++ ++Mon Jan 3 14:01:54 2005 Tanaka Akira ++ ++ * random.c (random_seed): don't use /dev/urandom if it is not ++ character device. ++ ++Mon Jan 3 11:37:42 2005 Tanaka Akira ++ ++ * random.c (random_seed): use /dev/urandom if available. ++ [ruby-dev:25392] ++ ++Mon Jan 3 07:46:42 2005 GOTOU Yuuzou ++ ++ * lib/webrick/httpauth/htpasswd.rb (WEBrick::Htpasswd#reload): ++ raise NotImplementedError if password is encrypted by digest ++ algorithms. This patch is contributed by sheepman. [ruby-list:40467] ++ ++ * lib/webrick/httpauth/digestauth.rb ++ (WEBrick::HTTPAuth::DigestAuth#_authenticate): fix digest calculation. ++ This patch is contributed by sheepman. [ruby-list:40482] ++ ++ * lib/webrick/{httpauth.rb,httpauth/basicauth.rb,httpproxy.rb}: use ++ pack/unpack-template char "m" instead of lib/base64.rb to do base64 ++ encoding/decoding. fixed: [ruby-dev:25336] ++ ++ * test/webrick/test_httpauth.rb: new file. ++ ++Sat Jan 1 04:20:23 2005 GOTOU Yuuzou ++ ++ * ext/openssl/ossl_ns_spki.c (ossl_spki_set_challenge): should call ++ StringValue before GetSPKI. fixed: [ruby-dev:25359]. ++ ++Sat Jan 1 01:13:28 2005 Yukihiro Matsumoto ++ ++ * variable.c (rb_autoload): [ruby-dev:25373] ++ ++Fri Dec 31 14:10:43 2004 Dave Thomas ++ ++ * lib/rdoc/ri/ri_formatter.rb (RI::TextFormatter::display_flow_item): Fix problem ++ if heading contains formatting. ++ ++Thu Dec 30 00:41:42 2004 Yukihiro Matsumoto ++ ++ * eval.c (svalue_to_avalue): [ruby-dev:25366] ++ ++ * string.c (rb_str_justify): [ruby-dev:25367] ++ ++Wed Dec 29 11:07:07 2004 Dave Thomas ++ ++ * lib/rdoc/generators/template/html/kilmer.rb: Update to use new ++ sections. ++ ++Tue Dec 28 22:31:46 2004 Nobuyoshi Nakada ++ ++ * string.c (rb_str_justify): create buffer string after argument type ++ conversion. fixed: [ruby-dev:25341] ++ ++Tue Dec 28 15:41:48 2004 Nobuyoshi Nakada ++ ++ * ext/nkf/nkf-utf8/nkf.c (reinit): should initialize all static ++ variables. fixed: [ruby-list:40445] ++ ++Tue Dec 28 15:25:20 2004 Nobuyoshi Nakada ++ ++ * ext/nkf/lib/kconv.rb (Kconv::RegexpEucjp): second byte is up to ++ 0xfe. ++ ++ * ext/nkf/lib/kconv.rb (Kconv#kconv): should handle UTF8 and UTF16 ++ properly. ++ ++Tue Dec 28 13:35:20 2004 Nobuyoshi Nakada ++ ++ * ext/zlib/zlib.c (rb_deflate_s_deflate, rb_inflate_s_inflate): ensure ++ freeing internal zstreams. fixed: [ruby-dev:25309] ++ ++ * ext/zlib/zlib.c (rb_deflate_init_copy): replace rb_deflate_clone. ++ ++Tue Dec 28 12:26:45 2004 NAKAMURA Usaku ++ ++ * win32/Makefile.sub, win32/setup.mak (RDOCTARGET, install, ++ install-nodoc, install-doc): rdoc support for mswin32. ++ ++ * win32/configure.bat (--enable-install-doc, --disable-install-doc): ++ ditto. ++ ++Mon Dec 27 20:02:14 2004 Hidetoshi NAGAI ++ ++ * ext/tcltklib/tcltklib.c: fix SEGV bug when deleting Tk interp ++ ++ * ext/tk/lib/multi-tk.rb: ditto ++ ++Mon Dec 27 16:55:17 2004 GOTOU Yuuzou ++ ++ * ext/openssl/ossl_x509name.c (Init_ossl_x509name): should use ++ rb_hash_new to get exactly a Hash. fix [ruby-dev:25325]. ++ ++Mon Dec 27 16:29:56 2004 Yukihiro Matsumoto ++ ++ * string.c (rb_str_justify): [ruby-dev:25341] ++ ++Mon Dec 27 15:47:48 2004 Minero Aoki ++ ++ * test/fileutils/fileasserts.rb: sync with HEAD. ++ ++ * test/fileutils/test_fileutils.rb: ditto. ++ ++ * test/fileutils/test_nowrite.rb: ditto. ++ ++Mon Dec 27 15:21:07 2004 Minero Aoki ++ ++ * lib/fileutils.rb (mv): should raise error when moving a ++ directory to the (empty) directory. [ruby-talk:124368] ++ (backport from HEAD 1.48) ++ ++ * lib/fileutils.rb (mv): wrongly did not overwrite file on Win32 ++ platforms. (backport from HEAD 1.48) ++ + Sat Dec 25 11:11:48 2004 Yukihiro Matsumoto + + * stable version 1.8.2 released. +@@ -1867,6 +2056,7 @@ Sat Oct 2 00:42:20 2004 Yukihiro Matsu + [ruby-dev:24383] + + * string.c (rb_str_sum): string may be altered. [ruby-dev:24381] ++ + Mon Oct 11 17:51:34 2004 Yukihiro Matsumoto + + * io.c (rb_io_popen): get mode string via rb_io_flags_mode() to +@@ -1885,7 +2075,6 @@ Mon Oct 11 17:51:34 2004 Yukihiro Matsu + prevent access to recycled object (via continuation for + example). [ruby-dev:24463] + +- + Fri Oct 1 11:40:14 2004 Yukihiro Matsumoto + + * eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe +@@ -1916,11 +2105,6 @@ Fri Oct 1 11:25:20 2004 Hidetoshi NAGA + + Thu Sep 30 00:50:44 2004 Hidetoshi NAGAI + +-Sat Oct 9 00:25:39 2004 Tanaka Akira +- +- * io.c (rb_io_fread): rb_thread_wait_fd() was lost. +- [ruby-dev:24457] +- + * ext/tcltklib/tcltklib.c (ip_init): bug fix + + * ext/tk/tkutil.c (get_eval_string_core): accept a Regexp object +diff -ruN -p bignum.c bignum.c +--- bignum.c 2004-11-17 04:43:24.000000000 +0900 ++++ bignum.c 2005-01-05 01:54:10.000000000 +0900 +@@ -2,8 +2,8 @@ + + bignum.c - + +- $Author: gotoyuzo $ +- $Date: 2004/11/16 19:43:24 $ ++ $Author: matz $ ++ $Date: 2005/01/04 16:54:10 $ + created at: Fri Jun 10 00:48:55 JST 1994 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -2010,11 +2010,13 @@ rb_big_rand(max, rand_buf) + return rb_float_new(rand_buf[0]); + } + v = bignew(len,1); ++ len--; ++ BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len]; + while (len--) { + BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len]; + } + +- return rb_big_modulo((VALUE)v, max); ++ return v; + } + + /* +diff -ruN -p dir.c dir.c +--- dir.c 2004-12-18 11:07:30.000000000 +0900 ++++ dir.c 2005-01-05 10:50:03.000000000 +0900 +@@ -2,8 +2,8 @@ + + dir.c - + +- $Author: matz $ +- $Date: 2004/12/18 02:07:30 $ ++ $Author: usa $ ++ $Date: 2005/01/05 01:50:03 $ + created at: Wed Jan 5 09:51:01 JST 1994 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -761,13 +761,8 @@ dir_s_mkdir(argc, argv, obj) + } + + check_dirname(&path); +-#ifndef _WIN32 + if (mkdir(RSTRING(path)->ptr, mode) == -1) + rb_sys_fail(RSTRING(path)->ptr); +-#else +- if (mkdir(RSTRING(path)->ptr) == -1) +- rb_sys_fail(RSTRING(path)->ptr); +-#endif + + return INT2FIX(0); + } +diff -ruN -p eval.c eval.c +--- eval.c 2004-12-18 11:07:29.000000000 +0900 ++++ eval.c 2005-01-05 12:50:04.000000000 +0900 +@@ -2,8 +2,8 @@ + + eval.c - + +- $Author: matz $ +- $Date: 2004/12/18 02:07:29 $ ++ $Author: nobu $ ++ $Date: 2005/01/05 03:50:04 $ + created at: Thu Jun 10 14:22:17 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -2545,7 +2545,7 @@ svalue_to_avalue(v) + if (RARRAY(tmp)->len == 1) { + top = rb_check_array_type(RARRAY(tmp)->ptr[0]); + if (!NIL_P(top) && RARRAY(top)->len > 1) { +- return v; ++ return tmp; + } + return rb_ary_new3(1, v); + } +@@ -11567,10 +11567,21 @@ static VALUE + rb_thread_initialize(thread, args) + VALUE thread, args; + { ++ rb_thread_t th; ++ + if (!rb_block_given_p()) { + rb_raise(rb_eThreadError, "must be called with a block"); + } +- return rb_thread_start_0(rb_thread_yield, args, rb_thread_check(thread)); ++ th = rb_thread_check(thread); ++ if (th->stk_max) { ++ NODE *node = th->node; ++ if (!node) { ++ rb_raise(rb_eThreadError, "already initialized thread"); ++ } ++ rb_raise(rb_eThreadError, "already initialized thread - %s:%d", ++ node->nd_file, nd_line(node)); ++ } ++ return rb_thread_start_0(rb_thread_yield, args, th); + } + + +diff -ruN -p ext/nkf/lib/kconv.rb ext/nkf/lib/kconv.rb +--- ext/nkf/lib/kconv.rb 2004-11-03 16:30:41.000000000 +0900 ++++ ext/nkf/lib/kconv.rb 2004-12-28 15:26:03.000000000 +0900 +@@ -74,8 +74,8 @@ module Kconv + RegexpEucjp = /\A(?: + [\x00-\x7f] | + \x8e [\xa1-\xdf] | +- \x8f [\xa1-\xdf] [\xa1-\xdf] | +- [\xa1-\xdf] [\xa1-\xdf] ++ \x8f [\xa1-\xdf] [\xa1-\xfe] | ++ [\xa1-\xdf] [\xa1-\xfe] + )*\z/nx + RegexpUtf8 = /\A(?: + [\x00-\x7f] | +@@ -101,8 +101,9 @@ module Kconv + when ::NKF::SJIS + opt << 'S' + when ::NKF::UTF8 +- when ::NKF::UTF16 + opt << 'W' ++ when ::NKF::UTF16 ++ opt << 'W16' + end + + case out_code +@@ -113,8 +114,9 @@ module Kconv + when ::NKF::SJIS + opt << 's' + when ::NKF::UTF8 +- when ::NKF::UTF16 + opt << 'w' ++ when ::NKF::UTF16 ++ opt << 'w16' + when ::NKF::NOCONV + return str + end +diff -ruN -p ext/nkf/nkf-utf8/nkf.c ext/nkf/nkf-utf8/nkf.c +--- ext/nkf/nkf-utf8/nkf.c 2004-12-04 03:04:38.000000000 +0900 ++++ ext/nkf/nkf-utf8/nkf.c 2004-12-28 15:42:33.000000000 +0900 +@@ -39,7 +39,7 @@ + ** E-Mail: furukawa@tcp-ip.or.jp + ** $B$^$G8fO"Mm$r$*4j$$$7$^$9!#(B + ***********************************************************************/ +-/* $Id: nkf.c,v 1.2.2.3 2004/12/03 18:04:38 naruse Exp $ */ ++/* $Id: nkf.c,v 1.2.2.4 2004/12/28 06:42:33 nobu Exp $ */ + #define NKF_VERSION "2.0.4" + #define NKF_RELEASE_DATE "2004-12-01" + #include "config.h" +@@ -1303,6 +1303,10 @@ struct input_code * find_inputcode_byfun + return 0; + } + ++#ifdef CHECK_OPTION ++static int (*iconv_for_check)() = 0; ++#endif ++ + #ifdef ANSI_C_PROTOTYPE + void set_iconv(int f, int (*iconv_func)(int c2,int c1,int c0)) + #else +@@ -1311,9 +1315,6 @@ void set_iconv(f, iconv_func) + int (*iconv_func)(); + #endif + { +-#ifdef CHECK_OPTION +- static int (*iconv_for_check)() = 0; +-#endif + #ifdef INPUT_CODE_FIX + if (f || !input_f) + #endif +@@ -4292,6 +4293,9 @@ reinit() + broken_counter = 0; + broken_last = 0; + z_prev2=0,z_prev1=0; ++#ifdef CHECK_OPTION ++ iconv_for_check = 0; ++#endif + + } + #endif +diff -ruN -p ext/openssl/ossl_ns_spki.c ext/openssl/ossl_ns_spki.c +--- ext/openssl/ossl_ns_spki.c 2004-12-15 10:54:39.000000000 +0900 ++++ ext/openssl/ossl_ns_spki.c 2005-01-01 04:24:11.000000000 +0900 +@@ -1,5 +1,5 @@ + /* +- * $Id: ossl_ns_spki.c,v 1.3.2.1 2004/12/15 01:54:39 matz Exp $ ++ * $Id: ossl_ns_spki.c,v 1.3.2.2 2004/12/31 19:24:11 gotoyuzo Exp $ + * 'OpenSSL for Ruby' project + * Copyright (C) 2001-2002 Michal Rokos + * All rights reserved. +@@ -155,8 +155,8 @@ ossl_spki_set_challenge(VALUE self, VALU + { + NETSCAPE_SPKI *spki; + +- GetSPKI(self, spki); + StringValue(str); ++ GetSPKI(self, spki); + if (!ASN1_STRING_set(spki->spkac->challenge, RSTRING(str)->ptr, + RSTRING(str)->len)) { + ossl_raise(eSPKIError, NULL); +diff -ruN -p ext/openssl/ossl_x509name.c ext/openssl/ossl_x509name.c +--- ext/openssl/ossl_x509name.c 2004-12-19 17:28:32.000000000 +0900 ++++ ext/openssl/ossl_x509name.c 2004-12-27 16:55:56.000000000 +0900 +@@ -1,5 +1,5 @@ + /* +- * $Id: ossl_x509name.c,v 1.4.2.7 2004/12/19 08:28:32 gotoyuzo Exp $ ++ * $Id: ossl_x509name.c,v 1.4.2.8 2004/12/27 07:55:56 gotoyuzo Exp $ + * 'OpenSSL for Ruby' project + * Copyright (C) 2001 Michal Rokos + * All rights reserved. +@@ -326,7 +326,8 @@ Init_ossl_x509name() + ptrstr = INT2NUM(V_ASN1_PRINTABLESTRING); + ia5str = INT2NUM(V_ASN1_IA5STRING); + rb_define_const(cX509Name, "DEFAULT_OBJECT_TYPE", utf8str); +- hash = rb_funcall(rb_cHash, rb_intern("new"), 1, DEFAULT_OBJECT_TYPE); ++ hash = rb_hash_new(); ++ RHASH(hash)->ifnone = utf8str; + rb_hash_aset(hash, rb_str_new2("C"), ptrstr); + rb_hash_aset(hash, rb_str_new2("countryName"), ptrstr); + rb_hash_aset(hash, rb_str_new2("serialNumber"), ptrstr); +diff -ruN -p ext/tcltklib/sample/sample1.rb ext/tcltklib/sample/sample1.rb +--- ext/tcltklib/sample/sample1.rb 2004-10-11 13:51:05.000000000 +0900 ++++ ext/tcltklib/sample/sample1.rb 2004-12-29 11:15:52.000000000 +0900 +@@ -24,7 +24,7 @@ class Test1 + c = ip.commands() + # 使用するコマンドに対応するオブジェクトは変数に入れておく. + append, bind, button, destroy, incr, info, label, place, set, wm = +- c.indexes( ++ c.values_at( + "append", "bind", "button", "destroy", "incr", "info", "label", "place", + "set", "wm") + +@@ -136,7 +136,7 @@ class Test1 + + # サンプルのためのウィジェットを生成する. + def sample(ip, parent) +- bind, button, destroy, grid, toplevel, wm = ip.commands().indexes( ++ bind, button, destroy, grid, toplevel, wm = ip.commands().values_at( + "bind", "button", "destroy", "grid", "toplevel", "wm") + + ## toplevel +@@ -207,7 +207,7 @@ class Test1 + # parent: 親ウィジェット + # title: toplevel ウィジェットのウインドウのタイトル + def inittoplevel(ip, parent, title) +- bind, button, destroy, toplevel, wm = ip.commands().indexes( ++ bind, button, destroy, toplevel, wm = ip.commands().values_at( + "bind", "button", "destroy", "toplevel", "wm") + + # 新しいウインドウを開くには, toplevel を使う. +@@ -229,7 +229,7 @@ class Test1 + + # label のサンプル. + def test_label(ip, parent) +- button, global, label, pack = ip.commands().indexes( ++ button, global, label, pack = ip.commands().values_at( + "button", "global", "label", "pack") + t1, b1, cb = inittoplevel(ip, parent, "label") + +@@ -272,7 +272,7 @@ class Test1 + + # button のサンプル. + def test_button(ip, parent) +- button, pack = ip.commands().indexes("button", "pack") ++ button, pack = ip.commands().values_at("button", "pack") + t1, b1, cb = inittoplevel(ip, parent, "button") + + ## button +@@ -290,7 +290,7 @@ class Test1 + + # checkbutton のサンプル. + def test_checkbutton(ip, parent) +- checkbutton, global, pack = ip.commands().indexes( ++ checkbutton, global, pack = ip.commands().values_at( + "checkbutton", "global", "pack") + t1, b1, cb = inittoplevel(ip, parent, "checkbutton") + +@@ -306,7 +306,7 @@ class Test1 + + # radiobutton のサンプル. + def test_radiobutton(ip, parent) +- global, label, pack, radiobutton = ip.commands().indexes( ++ global, label, pack, radiobutton = ip.commands().values_at( + "global", "label", "pack", "radiobutton") + t1, b1, cb = inittoplevel(ip, parent, "radiobutton") + +@@ -330,7 +330,7 @@ class Test1 + + # scale のサンプル. + def test_scale(ip, parent) +- global, pack, scale = ip.commands().indexes( ++ global, pack, scale = ip.commands().values_at( + "global", "pack", "scale") + t1, b1, cb = inittoplevel(ip, parent, "scale") + +@@ -350,7 +350,7 @@ class Test1 + + # entry のサンプル. + def test_entry(ip, parent) +- button, entry, global, pack = ip.commands().indexes( ++ button, entry, global, pack = ip.commands().values_at( + "button", "entry", "global", "pack") + t1, b1, cb = inittoplevel(ip, parent, "entry") + +@@ -369,7 +369,7 @@ class Test1 + + # text のサンプル. + def test_text(ip, parent) +- button, pack, text = ip.commands().indexes( ++ button, pack, text = ip.commands().values_at( + "button", "pack", "text") + t1, b1, cb = inittoplevel(ip, parent, "text") + +@@ -385,7 +385,7 @@ class Test1 + + # raise/lower のサンプル. + def test_raise(ip, parent) +- button, frame, lower, pack, raise = ip.commands().indexes( ++ button, frame, lower, pack, raise = ip.commands().values_at( + "button", "frame", "lower", "pack", "raise") + t1, b1, cb = inittoplevel(ip, parent, "raise/lower") + +@@ -408,7 +408,7 @@ class Test1 + # modal なウィジェットのサンプル. + def test_modal(ip, parent) + button, frame, message, pack, tk_chooseColor, tk_getOpenFile, +- tk_messageBox = ip.commands().indexes( ++ tk_messageBox = ip.commands().values_at( + "button", "frame", "message", "pack", "tk_chooseColor", + "tk_getOpenFile", "tk_messageBox") + # 最初に load されていないライブラリは ip.commands() に存在しないので, +@@ -451,7 +451,7 @@ class Test1 + + # menu のサンプル. + def test_menu(ip, parent) +- global, menu, menubutton, pack = ip.commands().indexes( ++ global, menu, menubutton, pack = ip.commands().values_at( + "global", "menu", "menubutton", "pack") + tk_optionMenu = TclTkLibCommand.new(ip, "tk_optionMenu") + t1, b1, cb = inittoplevel(ip, parent, "menu") +@@ -498,7 +498,7 @@ class Test1 + # listbox のサンプル. + def test_listbox(ip, parent) + clipboard, frame, grid, listbox, lower, menu, menubutton, pack, scrollbar, +- selection = ip.commands().indexes( ++ selection = ip.commands().values_at( + "clipboard", "frame", "grid", "listbox", "lower", "menu", "menubutton", + "pack", "scrollbar", "selection") + t1, b1, cb = inittoplevel(ip, parent, "listbox") +@@ -559,7 +559,7 @@ class Test1 + + # canvas のサンプル. + def test_canvas(ip, parent) +- canvas, lower, pack = ip.commands().indexes("canvas", "lower", "pack") ++ canvas, lower, pack = ip.commands().values_at("canvas", "lower", "pack") + t1, b1, cb = inittoplevel(ip, parent, "canvas") + + ## canvas +diff -ruN -p ext/tcltklib/tcltklib.c ext/tcltklib/tcltklib.c +--- ext/tcltklib/tcltklib.c 2004-12-23 13:16:42.000000000 +0900 ++++ ext/tcltklib/tcltklib.c 2004-12-27 20:03:58.000000000 +0900 +@@ -4,7 +4,7 @@ + * Oct. 24, 1997 Y. Matsumoto + */ + +-#define TCLTKLIB_RELEASE_DATE "2004-12-23" ++#define TCLTKLIB_RELEASE_DATE "2004-12-27" + + #include "ruby.h" + #include "rubysig.h" +@@ -70,9 +70,13 @@ fprintf(stderr, ARG1, ARG2); fprintf(std + /* release date */ + const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE; + +-/*finalize_proc_name */ ++/* finalize_proc_name */ + static char *finalize_hook_name = "INTERP_FINALIZE_HOOK"; + ++/* to cancel remained after-scripts when deleting IP */ ++#define REMAINED_AFTER_IDS_VAR "__ruby_tcltklib_remained_after_script_list__" ++#define CANCEL_REMAINED_AFTER_IDS "foreach id $__ruby_tcltklib_remained_after_script_list__ {after cancel $id}" ++ + /* for callback break & continue */ + static VALUE eTkCallbackReturn; + static VALUE eTkCallbackBreak; +@@ -3312,12 +3316,16 @@ delete_slaves(ip) + + Tcl_Preserve(slave); + +-#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4) +-#else + if (!Tcl_InterpDeleted(slave)) { +- Tcl_Eval(slave, "foreach i [after info] { after cancel $i }"); ++ if (Tcl_Eval(slave, "after info") == TCL_OK ++ && Tcl_SetVar(slave, ++ REMAINED_AFTER_IDS_VAR, ++ Tcl_GetStringResult(slave), ++ TCL_GLOBAL_ONLY) != (char *)NULL) { ++ DUMP1("cancel after scripts"); ++ Tcl_Eval(slave, CANCEL_REMAINED_AFTER_IDS); ++ } + } +-#endif + + /* delete slaves of slave */ + delete_slaves(slave); +@@ -3360,18 +3368,20 @@ ip_free(ptr) + + Tcl_ResetResult(ptr->ip); + ++ if (Tcl_Eval(ptr->ip, "after info") == TCL_OK ++ && Tcl_SetVar(ptr->ip, ++ REMAINED_AFTER_IDS_VAR, ++ Tcl_GetStringResult(ptr->ip), ++ TCL_GLOBAL_ONLY) != (char *)NULL) { ++ DUMP1("cancel after scripts"); ++ Tcl_Eval(ptr->ip, CANCEL_REMAINED_AFTER_IDS); ++ } ++ + if (Tcl_GetCommandInfo(ptr->ip, finalize_hook_name, &info)) { + DUMP2("call finalize hook proc '%s'", finalize_hook_name); + Tcl_Eval(ptr->ip, finalize_hook_name); + } + +-#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4) +-#else +- if (!Tcl_InterpDeleted(ptr->ip)) { +- Tcl_Eval(ptr->ip, "foreach i [after info] {after cancel $i}"); +- } +-#endif +- + del_root(ptr->ip); + + DUMP1("delete interp"); +@@ -3838,12 +3848,14 @@ ip_delete(self) + /* Tcl_Preserve(ptr->ip); */ + rbtk_preserve_ip(ptr); + +-#if TCL_MAJOR_VERSION < 8 || ( TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 4) +-#else +- if (!Tcl_InterpDeleted(ptr->ip)) { +- Tcl_Eval(ptr->ip, "foreach i [after info] { after cancel $i }"); ++ if (Tcl_Eval(ptr->ip, "after info") == TCL_OK ++ && Tcl_SetVar(ptr->ip, ++ REMAINED_AFTER_IDS_VAR, ++ Tcl_GetStringResult(ptr->ip), ++ TCL_GLOBAL_ONLY) != (char *)NULL) { ++ DUMP1("cancel after scripts"); ++ Tcl_Eval(ptr->ip, CANCEL_REMAINED_AFTER_IDS); + } +-#endif + + del_root(ptr->ip); + +diff -ruN -p ext/tk/lib/multi-tk.rb ext/tk/lib/multi-tk.rb +--- ext/tk/lib/multi-tk.rb 2004-12-20 14:10:33.000000000 +0900 ++++ ext/tk/lib/multi-tk.rb 2004-12-27 20:04:00.000000000 +0900 +@@ -189,7 +189,9 @@ class MultiTkIp + unless ip.deleted? + ip._split_tklist(ip._invoke('interp', 'slaves')).each{|name| + begin +- ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}") ++ # ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}") ++ after_ids = ip._eval_without_enc("#{name} eval {after info}") ++ ip._eval_without_enc("#{name} eval {foreach i {#{after_ids}} {after cancel $i}}") + rescue Exception + end + begin +@@ -236,7 +238,9 @@ class MultiTkIp + @slave_ip_tbl.each{|name, subip| + _destroy_slaves_of_slaveIP(subip) + begin +- subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = subip._eval_without_enc("after info") ++ subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + =begin +@@ -270,7 +274,9 @@ class MultiTkIp + } + + begin +- @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = @interp._eval_without_enc("after info") ++ @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + begin +@@ -310,7 +316,9 @@ class MultiTkIp + @slave_ip_tbl.each{|name, subip| + _destroy_slaves_of_slaveIP(subip) + begin +- subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = subip._eval_without_enc("after info") ++ subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + =begin +@@ -344,7 +352,9 @@ class MultiTkIp + } + + begin +- @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = @interp._eval_without_enc("after info") ++ @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + =begin +@@ -1315,7 +1325,7 @@ class MultiTkIp + @cmd_queue.enq([nil, cmd, *args]) + rescue Exception => e + # ignore +- if $DEBUG || true ++ if $DEBUG + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) +@@ -1821,7 +1831,9 @@ class MultiTkIp + end + =end + begin +- subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # subip._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = subip._eval_without_enc("after info") ++ subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + +@@ -1850,7 +1862,9 @@ class MultiTkIp + } + + begin +- @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ # @interp._eval_without_enc("foreach i [after info] {after cancel $i}") ++ after_ids = @interp._eval_without_enc("after info") ++ @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}") + rescue Exception + end + =begin +diff -ruN -p ext/tk/lib/tk.rb ext/tk/lib/tk.rb +--- ext/tk/lib/tk.rb 2004-12-24 01:22:36.000000000 +0900 ++++ ext/tk/lib/tk.rb 2004-12-27 20:03:59.000000000 +0900 +@@ -1,6 +1,6 @@ + # + # tk.rb - Tk interface module using tcltklib +-# $Date: 2004/12/23 16:22:36 $ ++# $Date: 2004/12/27 11:03:59 $ + # by Yukihiro Matsumoto + + # use Shigehiro's tcltklib +@@ -3940,7 +3940,7 @@ end + #Tk.freeze + + module Tk +- RELEASE_DATE = '2004-12-24'.freeze ++ RELEASE_DATE = '2004-12-27'.freeze + + autoload :AUTO_PATH, 'tk/variable' + autoload :TCL_PACKAGE_PATH, 'tk/variable' +diff -ruN -p ext/zlib/zlib.c ext/zlib/zlib.c +--- ext/zlib/zlib.c 2004-12-18 16:37:01.000000000 +0900 ++++ ext/zlib/zlib.c 2005-01-06 20:31:40.000000000 +0900 +@@ -3,7 +3,7 @@ + * + * Copyright (C) UENO Katsuhiro 2000-2003 + * +- * $Id: zlib.c,v 1.7.2.12 2004/12/18 07:37:01 nobu Exp $ ++ * $Id: zlib.c,v 1.7.2.14 2005/01/06 11:31:40 usa Exp $ + */ + + #include +@@ -55,7 +55,7 @@ static void zstream_reset_input _((struc + static void zstream_passthrough_input _((struct zstream*)); + static VALUE zstream_detach_input _((struct zstream*)); + static void zstream_reset _((struct zstream*)); +-static void zstream_end _((struct zstream*)); ++static VALUE zstream_end _((struct zstream*)); + static void zstream_run _((struct zstream*, Bytef*, uInt, int)); + static VALUE zstream_sync _((struct zstream*, Bytef*, uInt)); + static void zstream_mark _((struct zstream*)); +@@ -80,7 +80,8 @@ static VALUE rb_zstream_closed_p _((VALU + + static VALUE rb_deflate_s_allocate _((VALUE)); + static VALUE rb_deflate_initialize _((int, VALUE*, VALUE)); +-static VALUE rb_deflate_clone _((VALUE)); ++static VALUE rb_deflate_init_copy _((VALUE, VALUE)); ++static VALUE deflate_run _((VALUE)); + static VALUE rb_deflate_s_deflate _((int, VALUE*, VALUE)); + static void do_deflate _((struct zstream*, VALUE, int)); + static VALUE rb_deflate_deflate _((int, VALUE*, VALUE)); +@@ -89,6 +90,7 @@ static VALUE rb_deflate_flush _((int, VA + static VALUE rb_deflate_params _((VALUE, VALUE, VALUE)); + static VALUE rb_deflate_set_dictionary _((VALUE, VALUE)); + ++static VALUE inflate_run _((VALUE)); + static VALUE rb_inflate_s_allocate _((VALUE)); + static VALUE rb_inflate_initialize _((int, VALUE*, VALUE)); + static VALUE rb_inflate_s_inflate _((VALUE, VALUE)); +@@ -667,7 +669,7 @@ zstream_reset(z) + zstream_reset_input(z); + } + +-static void ++static VALUE + zstream_end(z) + struct zstream *z; + { +@@ -677,7 +679,7 @@ zstream_end(z) + if (RTEST(ruby_debug)) { + rb_warning("attempt to close uninitialized zstream; ignored."); + } +- return; ++ return Qnil; + } + if (z->flags & ZSTREAM_FLAG_IN_STREAM) { + if (RTEST(ruby_debug)) { +@@ -692,6 +694,7 @@ zstream_end(z) + raise_zlib_error(err, z->stream.msg); + } + z->flags = 0; ++ return Qnil; + } + + static void +@@ -1152,26 +1155,31 @@ rb_deflate_initialize(argc, argv, obj) + * Duplicates the deflate stream. + */ + static VALUE +-rb_deflate_clone(obj) +- VALUE obj; ++rb_deflate_init_copy(self, orig) ++ VALUE self, orig; + { +- struct zstream *z = get_zstream(obj); +- struct zstream *z2; +- VALUE clone; ++ struct zstream *z1 = get_zstream(self); ++ struct zstream *z2 = get_zstream(orig); + int err; + +- clone = zstream_deflate_new(rb_class_of(obj)); +- Data_Get_Struct(clone, struct zstream, z2); +- +- err = deflateCopy(&z2->stream, &z->stream); ++ err = deflateCopy(&z1->stream, &z2->stream); + if (err != Z_OK) { + raise_zlib_error(err, 0); + } ++ z1->flags = z2->flags; + +- z2->flags = z->flags; +- CLONESETUP(clone, obj); +- OBJ_INFECT(clone, obj); +- return clone; ++ return self; ++} ++ ++static VALUE ++deflate_run(args) ++ VALUE args; ++{ ++ struct zstream *z = (struct zstream *)((VALUE *)args)[0]; ++ VALUE src = ((VALUE *)args)[1]; ++ ++ zstream_run(z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH); ++ return zstream_detach_buffer(z); + } + + /* +@@ -1201,7 +1209,7 @@ rb_deflate_s_deflate(argc, argv, klass) + VALUE klass; + { + struct zstream z; +- VALUE src, level, dst; ++ VALUE src, level, dst, args[2]; + int err, lev; + + rb_scan_args(argc, argv, "11", &src, &level); +@@ -1215,9 +1223,9 @@ rb_deflate_s_deflate(argc, argv, klass) + } + ZSTREAM_READY(&z); + +- zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_FINISH); +- dst = zstream_detach_buffer(&z); +- zstream_end(&z); ++ args[0] = (VALUE)&z; ++ args[1] = src; ++ dst = rb_ensure(deflate_run, (VALUE)args, zstream_end, (VALUE)&z); + + OBJ_INFECT(dst, src); + return dst; +@@ -1430,6 +1438,18 @@ rb_inflate_initialize(argc, argv, obj) + return obj; + } + ++static VALUE ++inflate_run(args) ++ VALUE args; ++{ ++ struct zstream *z = (struct zstream *)((VALUE *)args)[0]; ++ VALUE src = ((VALUE *)args)[1]; ++ ++ zstream_run(z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH); ++ zstream_run(z, "", 0, Z_FINISH); /* for checking errors */ ++ return zstream_detach_buffer(z); ++} ++ + /* + * call-seq: Zlib::Inflate.inflate(string) + * +@@ -1452,7 +1472,7 @@ rb_inflate_s_inflate(obj, src) + VALUE obj, src; + { + struct zstream z; +- VALUE dst; ++ VALUE dst, args[2]; + int err; + + StringValue(src); +@@ -1463,10 +1483,9 @@ rb_inflate_s_inflate(obj, src) + } + ZSTREAM_READY(&z); + +- zstream_run(&z, RSTRING(src)->ptr, RSTRING(src)->len, Z_SYNC_FLUSH); +- zstream_run(&z, "", 0, Z_FINISH); /* for checking errors */ +- dst = zstream_detach_buffer(&z); +- zstream_end(&z); ++ args[0] = (VALUE)&z; ++ args[1] = src; ++ dst = rb_ensure(inflate_run, (VALUE)args, zstream_end, (VALUE)&z); + + OBJ_INFECT(dst, src); + return dst; +@@ -3333,7 +3352,7 @@ void Init_zlib() + rb_define_singleton_method(cDeflate, "deflate", rb_deflate_s_deflate, -1); + rb_define_alloc_func(cDeflate, rb_deflate_s_allocate); + rb_define_method(cDeflate, "initialize", rb_deflate_initialize, -1); +- rb_define_method(cDeflate, "clone", rb_deflate_clone, 0); ++ rb_define_method(cDeflate, "initialize_copy", rb_deflate_init_copy, 0); + rb_define_method(cDeflate, "deflate", rb_deflate_deflate, -1); + rb_define_method(cDeflate, "<<", rb_deflate_addstr, 1); + rb_define_method(cDeflate, "flush", rb_deflate_flush, -1); +diff -ruN -p lib/fileutils.rb lib/fileutils.rb +--- lib/fileutils.rb 2004-12-25 04:24:35.000000000 +0900 ++++ lib/fileutils.rb 2004-12-27 15:22:14.000000000 +0900 +@@ -73,6 +73,12 @@ + # :verbose flags to methods in FileUtils. + # + ++unless defined?(Errno::EXDEV) ++ module Errno ++ class EXDEV < SystemCallError; end ++ end ++end ++ + module FileUtils + + # All methods are module_function. +@@ -107,7 +113,6 @@ module FileUtils + + alias chdir cd + +- + # + # Options: (none) + # +@@ -570,30 +575,44 @@ module FileUtils + return if options[:noop] + + fu_each_src_dest(src, dest) do |s,d| +- if rename_cannot_overwrite_file? and File.file?(d) +- begin ++ src_stat = fu_lstat(s) ++ dest_stat = fu_stat(d) ++ begin ++ if rename_cannot_overwrite_file? and dest_stat and not dest_stat.directory? + File.unlink d +- rescue SystemCallError +- raise unless options[:force] + end +- end +- begin +- File.rename s, d +- rescue SystemCallError ++ if dest_stat and dest_stat.directory? ++ raise Errno::EISDIR, dest ++ end + begin ++ File.rename s, d ++ rescue Errno::EXDEV + copy_entry s, d, true +- File.unlink s +- rescue SystemCallError +- raise unless options[:force] + end ++ rescue SystemCallError ++ raise unless options[:force] + end + end + end + + alias move mv + ++ def fu_stat(path) ++ File.stat(path) ++ rescue SystemCallError ++ nil ++ end ++ private :fu_stat ++ ++ def fu_lstat(path) ++ File.lstat(path) ++ rescue SystemCallError ++ nil ++ end ++ private :fu_lstat ++ + def rename_cannot_overwrite_file? #:nodoc: +- /djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ !~ RUBY_PLATFORM ++ /djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM + end + private :rename_cannot_overwrite_file? + +diff -ruN -p lib/rdoc/generators/template/html/kilmer.rb lib/rdoc/generators/template/html/kilmer.rb +--- lib/rdoc/generators/template/html/kilmer.rb 2004-09-10 02:46:05.000000000 +0900 ++++ lib/rdoc/generators/template/html/kilmer.rb 2004-12-29 11:15:52.000000000 +0900 +@@ -139,6 +139,18 @@ END:methods + + ENDIF:methods + ++ ++START:sections ++
++IF:sectitle ++

%sectitle%

++IF:seccomment ++
++ %seccomment% ++
++ENDIF:seccomment ++ENDIF:sectitle ++ + IF:attributes + + +@@ -168,6 +180,8 @@ ENDIF:classlist + + !INCLUDE! + ++END:sections ++ + + + } +diff -ruN -p lib/rdoc/markup/simple_markup/to_flow.rb lib/rdoc/markup/simple_markup/to_flow.rb +--- lib/rdoc/markup/simple_markup/to_flow.rb 2004-08-30 23:22:26.000000000 +0900 ++++ lib/rdoc/markup/simple_markup/to_flow.rb 2004-12-31 14:22:04.000000000 +0900 +@@ -113,7 +113,7 @@ module SM + end + + def accept_heading(am, fragment) +- @res << Flow::H.new(fragment.head_level, am.flow(fragment.txt)) ++ @res << Flow::H.new(fragment.head_level, convert_flow(am.flow(fragment.txt))) + end + + +diff -ruN -p lib/rdoc/ri/ri_formatter.rb lib/rdoc/ri/ri_formatter.rb +--- lib/rdoc/ri/ri_formatter.rb 2004-09-14 23:49:19.000000000 +0900 ++++ lib/rdoc/ri/ri_formatter.rb 2004-12-31 14:22:05.000000000 +0900 +@@ -164,7 +164,7 @@ module RI + display_verbatim_flow_item(item, @indent) + + when SM::Flow::H +- display_heading(conv_html(item.text.join), item.level, @indent) ++ display_heading(conv_html(item.text), item.level, @indent) + + when SM::Flow::RULE + draw_line +@@ -186,6 +186,7 @@ module RI + ###################################################################### + + def display_heading(text, level, indent) ++ text = strip_attributes(text) + case level + when 1 + ul = "=" * text.length +@@ -211,13 +212,30 @@ module RI + display_flow_item(f) + end + end ++ ++ def strip_attributes(txt) ++ tokens = txt.split(%r{()}) ++ text = [] ++ attributes = 0 ++ tokens.each do |tok| ++ case tok ++ when %r{^$}, %r{^<(\w+)>$} ++ ; ++ else ++ text << tok ++ end ++ end ++ text.join ++ end ++ ++ + end + + + ###################################################################### + # Handle text with attributes. We're a base class: there are + # different presentation classes (one, for example, uses overstrikes +- # to handle bold and underlinig, while another using ANSI escape ++ # to handle bold and underlining, while another using ANSI escape + # sequences + + class AttributeFormatter < TextFormatter +@@ -247,6 +265,8 @@ module RI + + + class AttributeString ++ attr_reader :txt ++ + def initialize + @txt = [] + @optr = 0 +@@ -345,7 +365,7 @@ module RI + ################################################## + + # This formatter generates overstrike-style formatting, which +- # works with pages such as man and less. ++ # works with pagers such as man and less. + + class OverstrikeFormatter < AttributeFormatter + +@@ -408,16 +428,18 @@ module RI + end + + HEADINGS = { +- 1 => "\033[1;32m%s\033[m", +- 2 => "\033[4;32m%s\033[m", +- 3 => "\033[32m%s\033[m" ++ 1 => [ "\033[1;32m", "\033[m" ] , ++ 2 => ["\033[4;32m", "\033[m" ], ++ 3 => ["\033[32m", "\033[m" ] + } + + def display_heading(text, level, indent) + level = 3 if level > 3 ++ heading = HEADINGS[level] + print indent +- printf(HEADINGS[level], text) +- puts ++ print heading[0] ++ print strip_attributes(text) ++ puts heading[1] + end + + private +@@ -611,6 +633,7 @@ module RI + # Place heading level indicators inline with heading. + + def display_heading(text, level, indent) ++ text = strip_attributes(text) + case level + when 1 + puts "= " + text.upcase +diff -ruN -p lib/rdoc/usage.rb lib/rdoc/usage.rb +--- lib/rdoc/usage.rb 2004-08-26 04:39:18.000000000 +0900 ++++ lib/rdoc/usage.rb 2005-01-06 08:02:50.000000000 +0900 +@@ -96,7 +96,7 @@ module RDoc + + # Display usage + def RDoc.usage_no_exit(*args) +- main_program_file, = caller[-1].split(/:/, 2) ++ main_program_file, = caller[-1].split(/:\d+/, 2) + comment = File.open(main_program_file) do |file| + find_comment(file) + end +diff -ruN -p lib/time.rb lib/time.rb +--- lib/time.rb 2004-02-12 02:36:37.000000000 +0900 ++++ lib/time.rb 2005-01-06 13:48:31.000000000 +0900 +@@ -60,7 +60,7 @@ class Time + 'MST' => -7, 'MDT' => -6, + 'PST' => -8, 'PDT' => -7, + # Following definition of military zones is original one. +- # See RFC 1123 and RFC 2822 for the error of RFC 822. ++ # See RFC 1123 and RFC 2822 for the error in RFC 822. + 'A' => +1, 'B' => +2, 'C' => +3, 'D' => +4, 'E' => +5, 'F' => +6, + 'G' => +7, 'H' => +8, 'I' => +9, 'K' => +10, 'L' => +11, 'M' => +12, + 'N' => -1, 'O' => -2, 'P' => -3, 'Q' => -4, 'R' => -5, 'S' => -6, +@@ -83,6 +83,17 @@ class Time + off + end + ++ def zone_utc?(zone) ++ # * +0000 means localtime. [RFC 2822] ++ # * GMT is a localtime abbreviation in Europe/London, etc. ++ if /\A(?:-00:00|-0000|-00|UTC|Z|UT)\z/i =~ zone ++ true ++ else ++ false ++ end ++ end ++ private :zone_utc? ++ + # + # Parses +date+ using ParseDate.parsedate and converts it to a Time object. + # +@@ -160,7 +171,7 @@ class Time + + if off + t = Time.utc(year, mon, day, hour, min, sec) - off +- t.localtime if off != 0 ++ t.localtime if !zone_utc?(zone) + t + else + Time.local(year, mon, day, hour, min, sec) +@@ -212,8 +223,8 @@ class Time + end + + t = Time.utc(year, mon, day, hour, min, sec) +- offset = zone_offset(zone) +- t = (t - offset).localtime if offset != 0 || zone == '+0000' ++ t -= zone_offset(zone) ++ t.localtime if !zone_utc?(zone) + t + else + raise ArgumentError.new("not RFC 2822 compliant date: #{date.inspect}") +@@ -612,6 +623,19 @@ if __FILE__ == $0 + assert_raise(ArgumentError) { Time.rfc2822("\307\341\314\343\332\311, 30 \344\346\335\343\310\321 2001 10:01:06") } + assert_raise(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=BF=E5),?= 12 =?iso-8859-1?Q?9=B7=EE?= 2001 14:52:41\n+0900 (JST)") } + end ++ ++ def test_zone_0000 ++ assert_equal(true, Time.parse("2000-01-01T00:00:00Z").utc?) ++ assert_equal(true, Time.parse("2000-01-01T00:00:00-00:00").utc?) ++ assert_equal(false, Time.parse("2000-01-01T00:00:00+00:00").utc?) ++ assert_equal(false, Time.parse("Sat, 01 Jan 2000 00:00:00 GMT").utc?) ++ assert_equal(true, Time.parse("Sat, 01 Jan 2000 00:00:00 -0000").utc?) ++ assert_equal(false, Time.parse("Sat, 01 Jan 2000 00:00:00 +0000").utc?) ++ assert_equal(false, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 GMT").utc?) ++ assert_equal(true, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 -0000").utc?) ++ assert_equal(false, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 +0000").utc?) ++ assert_equal(true, Time.rfc2822("Sat, 01 Jan 2000 00:00:00 UTC").utc?) ++ end + end + + end +diff -ruN -p lib/webrick/httpauth/basicauth.rb lib/webrick/httpauth/basicauth.rb +--- lib/webrick/httpauth/basicauth.rb 2004-12-18 15:17:33.000000000 +0900 ++++ lib/webrick/httpauth/basicauth.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -34,7 +34,7 @@ module WEBrick + unless basic_credentials = check_scheme(req) + challenge(req, res) + end +- userid, password = decode64(basic_credentials).split(":", 2) ++ userid, password = basic_credentials.unpack("m*")[0].split(":", 2) + password ||= "" + if userid.empty? + error("user id was not given.") +diff -ruN -p lib/webrick/httpauth/digestauth.rb lib/webrick/httpauth/digestauth.rb +--- lib/webrick/httpauth/digestauth.rb 2004-12-18 16:19:46.000000000 +0900 ++++ lib/webrick/httpauth/digestauth.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -174,11 +174,11 @@ module WEBrick + + if auth_req['qop'] == "auth" || auth_req['qop'] == nil + ha2 = hexdigest(req.request_method, auth_req['uri']) +- ha2_res = digest("", auth_req['uri']) ++ ha2_res = hexdigest("", auth_req['uri']) + elsif auth_req['qop'] == "auth-int" + ha2 = hexdigest(req.request_method, auth_req['uri'], + hexdigest(req.body)) +- ha2_res = digest("", auth_req['uri'], hexdigest(req.body)) ++ ha2_res = hexdigest("", auth_req['uri'], hexdigest(res.body)) + end + + if auth_req['qop'] == "auth" || auth_req['qop'] == "auth-int" +@@ -330,10 +330,6 @@ module WEBrick + def hexdigest(*args) + @h.hexdigest(args.join(":")) + end +- +- def digest(*args) +- @h.digest(args.join(":")) +- end + end + + class ProxyDigestAuth < DigestAuth +diff -ruN -p lib/webrick/httpauth/htpasswd.rb lib/webrick/httpauth/htpasswd.rb +--- lib/webrick/httpauth/htpasswd.rb 2003-07-24 01:51:36.000000000 +0900 ++++ lib/webrick/httpauth/htpasswd.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -32,7 +32,15 @@ module WEBrick + open(@path){|io| + while line = io.gets + line.chomp! +- user, pass = line.split(":") ++ case line ++ when %r!\A[^:]+:[a-zA-Z0-9./]{13}\z! ++ user, pass = line.split(":") ++ when /:\$/, /:\{SHA\}/ ++ raise NotImplementedError, ++ 'MD5, SHA1 .htpasswd file not supported' ++ else ++ raise StandardError, 'bad .htpasswd file' ++ end + @passwd[user] = pass + end + } +diff -ruN -p lib/webrick/httpauth.rb lib/webrick/httpauth.rb +--- lib/webrick/httpauth.rb 2004-12-18 15:17:33.000000000 +0900 ++++ lib/webrick/httpauth.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -22,7 +22,7 @@ module WEBrick + user = pass = nil + if /^Basic\s+(.*)/o =~ req[req_field] + userpass = $1 +- user, pass = decode64(userpass).split(":", 2) ++ user, pass = userpass.unpack("m*")[0].split(":", 2) + end + if block.call(user, pass) + req.user = user +diff -ruN -p lib/webrick/httpproxy.rb lib/webrick/httpproxy.rb +--- lib/webrick/httpproxy.rb 2004-08-22 01:16:18.000000000 +0900 ++++ lib/webrick/httpproxy.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -110,7 +110,7 @@ module WEBrick + proxy_host = proxy.host + proxy_port = proxy.port + if proxy.userinfo +- credentials = "Basic " + encode64(proxy.userinfo) ++ credentials = "Basic " + [proxy.userinfo].pack("m*") + header['proxy-authorization'] = credentials + end + end +@@ -170,7 +170,7 @@ module WEBrick + if proxy = proxy_uri(req, res) + proxy_request_line = "CONNECT #{host}:#{port} HTTP/1.0" + if proxy.userinfo +- credentials = "Basic " + encode64(proxy.userinfo) ++ credentials = "Basic " + [proxy.userinfo].pack("m*") + end + host, port = proxy.host, proxy.port + end +diff -ruN -p random.c random.c +--- random.c 2004-03-15 11:33:03.000000000 +0900 ++++ random.c 2005-01-06 17:24:04.000000000 +0900 +@@ -2,8 +2,8 @@ + + random.c - + +- $Author: matz $ +- $Date: 2004/03/15 02:33:03 $ ++ $Author: ocean $ ++ $Date: 2005/01/06 08:24:04 $ + created at: Fri Dec 24 16:39:21 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -92,6 +92,37 @@ init_genrand(s) + left = 1; initf = 1; + } + ++/* initialize by an array with array-length */ ++/* init_key is the array for initializing keys */ ++/* key_length is its length */ ++/* slight change for C++, 2004/2/26 */ ++static void ++init_by_array(unsigned long init_key[], int key_length) ++{ ++ int i, j, k; ++ init_genrand(19650218UL); ++ i=1; j=0; ++ k = (N>key_length ? N : key_length); ++ for (; k; k--) { ++ state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL)) ++ + init_key[j] + j; /* non linear */ ++ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ ++ i++; j++; ++ if (i>=N) { state[0] = state[N-1]; i=1; } ++ if (j>=key_length) j=0; ++ } ++ for (k=N-1; k; k--) { ++ state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL)) ++ - i; /* non linear */ ++ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ ++ i++; ++ if (i>=N) { state[0] = state[N-1]; i=1; } ++ } ++ ++ state[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ ++ left = 1; initf = 1; ++} ++ + static void + next_state() + { +@@ -114,9 +145,9 @@ next_state() + *p = p[M-N] ^ TWIST(p[0], state[0]); + } + +-/* generates a random number on [0,1)-real-interval */ +-static double +-genrand_real() ++/* generates a random number on [0,0xffffffff]-interval */ ++static unsigned long ++genrand_int32(void) + { + unsigned long y; + +@@ -129,10 +160,18 @@ genrand_real() + y ^= (y << 15) & 0xefc60000UL; + y ^= (y >> 18); + +- return (double)y * (1.0/4294967296.0); +- /* divided by 2^32 */ ++ return y; + } + ++/* generates a random number on [0,1) with 53-bit resolution*/ ++static double ++genrand_real(void) ++{ ++ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6; ++ return(a*67108864.0+b)*(1.0/9007199254740992.0); ++} ++/* These real versions are due to Isaku Wada, 2002/01/09 added */ ++ + #undef N + #undef M + +@@ -144,32 +183,126 @@ genrand_real() + #include + #endif + #include ++#include ++#include ++#ifdef HAVE_FCNTL_H ++#include ++#endif + + static int first = 1; ++static VALUE saved_seed = INT2FIX(0); + +-static int +-rand_init(seed) +- unsigned long seed; ++static VALUE ++rand_init(vseed) ++ VALUE vseed; + { +- static unsigned long saved_seed; +- unsigned long old; ++ volatile VALUE seed; ++ VALUE old; ++ long len; ++ unsigned long *buf; + ++ seed = rb_to_int(vseed); ++ switch (TYPE(seed)) { ++ case T_FIXNUM: ++ len = sizeof(VALUE); ++ break; ++ case T_BIGNUM: ++ len = RBIGNUM(seed)->len * SIZEOF_BDIGITS; ++ if (len == 0) ++ len = 4; ++ break; ++ default: ++ rb_raise(rb_eTypeError, "failed to convert %s into Integer", ++ rb_obj_classname(vseed)); ++ } ++ len = (len + 3) / 4; /* number of 32bit words */ ++ buf = ALLOCA_N(long, len); /* allocate longs for init_by_array */ ++ memset(buf, 0, len * sizeof(long)); ++ if (FIXNUM_P(seed)) { ++ buf[0] = FIX2ULONG(seed) & 0xffffffff; ++#if SIZEOF_LONG > 4 ++ buf[1] = FIX2ULONG(seed) >> 32; ++#endif ++ } ++ else { ++ int i, j; ++ for (i = RBIGNUM(seed)->len-1; 0 <= i; i--) { ++ j = i * SIZEOF_BDIGITS / 4; ++#if SIZEOF_BDIGITS < 4 ++ buf[j] <<= SIZEOF_BDIGITS * 8; ++#endif ++ buf[j] |= ((BDIGIT *)RBIGNUM(seed)->digits)[i]; ++ } ++ } ++ while (1 < len && buf[len-1] == 0) { ++ len--; ++ } ++ if (len <= 1) { ++ init_genrand(buf[0]); ++ } ++ else { ++ if (buf[len-1] == 1) /* remove leading-zero-guard */ ++ len--; ++ init_by_array(buf, len); ++ } + first = 0; +- init_genrand(seed); + old = saved_seed; + saved_seed = seed; + + return old; + } + +-static unsigned long ++static VALUE + random_seed() + { + static int n = 0; + struct timeval tv; ++ int fd; ++ struct stat statbuf; ++ ++ int seed_len; ++ BDIGIT *digits; ++ unsigned long *seed; ++ NEWOBJ(big, struct RBignum); ++ OBJSETUP(big, rb_cBignum, T_BIGNUM); ++ ++ seed_len = 4 * sizeof(long); ++ big->sign = 1; ++ big->len = seed_len / SIZEOF_BDIGITS + 1; ++ digits = big->digits = ALLOC_N(BDIGIT, big->len); ++ seed = (unsigned long *)big->digits; ++ ++ memset(digits, 0, big->len * SIZEOF_BDIGITS); ++ ++#ifdef S_ISCHR ++ if ((fd = open("/dev/urandom", O_RDONLY ++#ifdef O_NONBLOCK ++ |O_NONBLOCK ++#endif ++#ifdef O_NOCTTY ++ |O_NOCTTY ++#endif ++#ifdef O_NOFOLLOW ++ |O_NOFOLLOW ++#endif ++ )) >= 0) { ++ if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) { ++ read(fd, seed, seed_len); ++ } ++ close(fd); ++ } ++#endif + + gettimeofday(&tv, 0); +- return tv.tv_sec ^ tv.tv_usec ^ getpid() ^ n++; ++ seed[0] ^= tv.tv_usec; ++ seed[1] ^= tv.tv_sec; ++ seed[2] ^= getpid() ^ (n++ << 16); ++ seed[3] ^= (unsigned long)&seed; ++ ++ /* set leading-zero-guard if need. */ ++ digits[big->len-1] = digits[big->len-2] <= 1 ? 1 : 0; ++ ++ return rb_big_norm((VALUE)big); + } + + /* +@@ -192,19 +325,94 @@ rb_f_srand(argc, argv, obj) + VALUE *argv; + VALUE obj; + { +- VALUE sd; +- unsigned long seed, old; ++ VALUE seed, old; + + rb_secure(4); +- if (rb_scan_args(argc, argv, "01", &sd) == 0) { ++ if (rb_scan_args(argc, argv, "01", &seed) == 0) { + seed = random_seed(); + } +- else { +- seed = NUM2ULONG(sd); +- } + old = rand_init(seed); + +- return ULONG2NUM(old); ++ return old; ++} ++ ++static unsigned long ++make_mask(unsigned long x) ++{ ++ x = x | x >> 1; ++ x = x | x >> 2; ++ x = x | x >> 4; ++ x = x | x >> 8; ++ x = x | x >> 16; ++#if 4 < SIZEOF_LONG ++ x = x | x >> 32; ++#endif ++ return x; ++} ++ ++static unsigned long ++limited_rand(unsigned long limit) ++{ ++ unsigned long mask = make_mask(limit); ++ int i; ++ unsigned long val; ++ ++ retry: ++ val = 0; ++ for (i = SIZEOF_LONG/4-1; 0 <= i; i--) { ++ if (mask >> (i * 32)) { ++ val |= genrand_int32() << (i * 32); ++ val &= mask; ++ if (limit < val) ++ goto retry; ++ } ++ } ++ return val; ++} ++ ++static VALUE ++limited_big_rand(struct RBignum *limit) ++{ ++ unsigned long mask, lim, rnd; ++ struct RBignum *val; ++ int i, len, boundary; ++ ++ len = (limit->len * SIZEOF_BDIGITS + 3) / 4; ++ val = (struct RBignum *)rb_big_clone((VALUE)limit); ++ val->sign = 1; ++#if SIZEOF_BDIGITS == 2 ++# define BIG_GET32(big,i) (((BDIGIT *)(big)->digits)[(i)*2] | \ ++ ((i)*2+1 < (big)->len ? (((BDIGIT *)(big)->digits)[(i)*2+1] << 16) \ ++ : 0)) ++# define BIG_SET32(big,i,d) ((((BDIGIT *)(big)->digits)[(i)*2] = (d) & 0xffff), \ ++ ((i)*2+1 < (big)->len ? (((BDIGIT *)(big)->digits)[(i)*2+1] = (d) >> 16) \ ++ : 0)) ++#else ++ /* SIZEOF_BDIGITS == 4 */ ++# define BIG_GET32(big,i) (((BDIGIT *)(big)->digits)[i]) ++# define BIG_SET32(big,i,d) (((BDIGIT *)(big)->digits)[i] = (d)) ++#endif ++ retry: ++ mask = 0; ++ boundary = 1; ++ for (i = len-1; 0 <= i; i--) { ++ lim = BIG_GET32(limit, i); ++ mask = mask ? 0xffffffff : make_mask(lim); ++ if (mask) { ++ rnd = genrand_int32() & mask; ++ if (boundary) { ++ if (lim < rnd) ++ goto retry; ++ if (rnd < lim) ++ boundary = 0; ++ } ++ } ++ else { ++ rnd = 0; ++ } ++ BIG_SET32(val, i, rnd); ++ } ++ return rb_big_norm((VALUE)val); + } + + /* +@@ -246,18 +454,26 @@ rb_f_rand(argc, argv, obj) + max = (long)RFLOAT(vmax)->value; + break; + } +- vmax = rb_dbl2big(RFLOAT(vmax)->value); ++ if (RFLOAT(vmax)->value < 0) ++ vmax = rb_dbl2big(-RFLOAT(vmax)->value); ++ else ++ vmax = rb_dbl2big(RFLOAT(vmax)->value); + /* fall through */ + case T_BIGNUM: + bignum: + { +- long len = RBIGNUM(vmax)->len; +- double *buf = ALLOCA_N(double, len); +- +- while (len--) { +- buf[len] = genrand_real(); +- } +- return rb_big_rand(vmax, buf); ++ struct RBignum *limit = (struct RBignum *)vmax; ++ if (!limit->sign) { ++ limit = (struct RBignum *)rb_big_clone(vmax); ++ limit->sign = 1; ++ } ++ limit = (struct RBignum *)rb_big_minus((VALUE)limit, INT2FIX(1)); ++ if (FIXNUM_P((VALUE)limit)) { ++ if (FIX2LONG((VALUE)limit) == -1) ++ return rb_float_new(genrand_real()); ++ return LONG2NUM(limited_rand(FIX2LONG((VALUE)limit))); ++ } ++ return limited_big_rand(limit); + } + case T_NIL: + max = 0; +@@ -274,8 +490,7 @@ rb_f_rand(argc, argv, obj) + return rb_float_new(genrand_real()); + } + if (max < 0) max = -max; +- val = max*genrand_real(); +- ++ val = limited_rand(max-1); + return LONG2NUM(val); + } + +@@ -284,4 +499,5 @@ Init_Random() + { + rb_define_global_function("srand", rb_f_srand, -1); + rb_define_global_function("rand", rb_f_rand, -1); ++ rb_global_variable(&saved_seed); + } +diff -ruN -p string.c string.c +--- string.c 2004-12-09 14:38:59.000000000 +0900 ++++ string.c 2004-12-30 01:05:10.000000000 +0900 +@@ -2,8 +2,8 @@ + + string.c - + +- $Author: nobu $ +- $Date: 2004/12/09 05:38:59 $ ++ $Author: matz $ ++ $Date: 2004/12/29 16:05:10 $ + created at: Mon Aug 9 17:12:58 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -4474,8 +4474,6 @@ rb_str_justify(argc, argv, str, jflag) + + rb_scan_args(argc, argv, "11", &w, &pad); + width = NUM2LONG(w); +- if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str); +- res = rb_str_new5(str, 0, width); + if (argc == 2) { + StringValue(pad); + f = RSTRING(pad)->ptr; +@@ -4484,6 +4482,8 @@ rb_str_justify(argc, argv, str, jflag) + rb_raise(rb_eArgError, "zero width padding"); + } + } ++ if (width < 0 || RSTRING(str)->len >= width) return rb_str_dup(str); ++ res = rb_str_new5(str, 0, width); + p = RSTRING(res)->ptr; + if (jflag != 'l') { + n = width - RSTRING(str)->len; +diff -ruN -p test/fileutils/fileasserts.rb test/fileutils/fileasserts.rb +--- test/fileutils/fileasserts.rb 2003-11-18 14:09:20.000000000 +0900 ++++ test/fileutils/fileasserts.rb 2004-12-27 15:48:08.000000000 +0900 +@@ -1,12 +1,10 @@ +-# +-# test/fileutils/fileasserts.rb +-# ++# $Id: fileasserts.rb,v 1.2.2.1 2004/12/27 06:48:08 aamine Exp $ + + module Test + module Unit + module Assertions # redefine + +- def assert_same_file( from, to ) ++ def assert_same_file(from, to) + _wrap_assertion { + assert_block("file #{from} != #{to}") { + File.read(from) == File.read(to) +@@ -14,7 +12,22 @@ module Test + } + end + +- def assert_file_exist( path ) ++ def assert_same_entry(from, to) ++ _wrap_assertion { ++ assert_block("entry #{from} != #{to}") { ++ a = File.stat(from) ++ b = File.stat(to) ++ ++ a.mode == b.mode and ++ #a.atime == b.atime and ++ a.mtime == b.mtime and ++ a.uid == b.uid and ++ a.gid == b.gid ++ } ++ } ++ end ++ ++ def assert_file_exist(path) + _wrap_assertion { + assert_block("file not exist: #{path}") { + File.exist?(path) +@@ -22,7 +35,7 @@ module Test + } + end + +- def assert_file_not_exist( path ) ++ def assert_file_not_exist(path) + _wrap_assertion { + assert_block("file not exist: #{path}") { + not File.exist?(path) +@@ -30,7 +43,7 @@ module Test + } + end + +- def assert_directory( path ) ++ def assert_directory(path) + _wrap_assertion { + assert_block("is not directory: #{path}") { + File.directory?(path) +@@ -38,14 +51,22 @@ module Test + } + end + +- def assert_symlink( path ) ++ def assert_symlink(path) + _wrap_assertion { +- assert_block("is no symlink: #{path}") { ++ assert_block("is not a symlink: #{path}") { + File.symlink?(path) + } + } + end + ++ def assert_not_symlink(path) ++ _wrap_assertion { ++ assert_block("is a symlink: #{path}") { ++ not File.symlink?(path) ++ } ++ } ++ end ++ + end + end + end +diff -ruN -p test/fileutils/test_fileutils.rb test/fileutils/test_fileutils.rb +--- test/fileutils/test_fileutils.rb 2004-07-20 09:17:51.000000000 +0900 ++++ test/fileutils/test_fileutils.rb 2004-12-27 15:48:08.000000000 +0900 +@@ -1,8 +1,4 @@ +-# +-# test/fileutils/test_fileutils.rb +-# +- +-$:.unshift File.dirname(__FILE__) ++# $Id: test_fileutils.rb,v 1.16.2.3 2004/12/27 06:48:08 aamine Exp $ + + require 'fileutils' + require 'fileasserts' +@@ -20,7 +16,7 @@ Dir.mkdir tmproot unless File.directory? + Dir.chdir tmproot + + def have_drive_letter? +- /djgpp|mswin(?!ce)|mingw|bcc|emx/ === RUBY_PLATFORM ++ /djgpp|mswin(?!ce)|mingw|bcc|emx/ =~ RUBY_PLATFORM + end + + def have_file_perm? +@@ -53,6 +49,18 @@ def have_hardlink? + HAVE_HARDLINK + end + ++begin ++ Dir.mkdir("\n") ++ Dir.rmdir("\n") ++ def lf_in_path_allowed? ++ true ++ end ++rescue ++ def lf_in_path_allowed? ++ false ++ end ++end ++ + Dir.chdir prevdir + Dir.rmdir tmproot + +@@ -60,7 +68,7 @@ class TestFileUtils + + include FileUtils + +- def my_rm_rf( path ) ++ def my_rm_rf(path) + if File.exist?('/bin/rm') + system %Q[/bin/rm -rf "#{path}"] + else +@@ -70,7 +78,7 @@ class TestFileUtils + + def setup + @prevdir = Dir.pwd +- tmproot = "#{Dir.tmpdir}/fileutils.rb.#{$$}" ++ tmproot = TMPROOT + Dir.mkdir tmproot unless File.directory?(tmproot) + Dir.chdir tmproot + my_rm_rf 'data'; Dir.mkdir 'data' +@@ -86,13 +94,12 @@ class TestFileUtils + end + + +- TARGETS = %w( data/same data/all data/random data/zero ) ++ TARGETS = %w( data/a data/all data/random data/zero ) + + def prepare_data_file +- same_chars = 'a' * 50 +- File.open('data/same', 'w') {|f| ++ File.open('data/a', 'w') {|f| + 32.times do +- f.puts same_chars ++ f.puts 'a' * 50 + end + } + +@@ -226,6 +233,44 @@ end + assert_same_file fname, "tmp/#{fname}" + end + ++ cp_r 'data', 'tmp2', :preserve => true ++ TARGETS.each do |fname| ++ assert_same_entry fname, "tmp2/#{File.basename(fname)}" ++ assert_same_file fname, "tmp2/#{File.basename(fname)}" ++ end ++ ++ # a/* -> b/* ++ mkdir 'tmp/cpr_src' ++ mkdir 'tmp/cpr_dest' ++ File.open('tmp/cpr_src/a', 'w') {|f| f.puts 'a' } ++ File.open('tmp/cpr_src/b', 'w') {|f| f.puts 'b' } ++ File.open('tmp/cpr_src/c', 'w') {|f| f.puts 'c' } ++ mkdir 'tmp/cpr_src/d' ++ cp_r 'tmp/cpr_src/.', 'tmp/cpr_dest' ++ assert_same_file 'tmp/cpr_src/a', 'tmp/cpr_dest/a' ++ assert_same_file 'tmp/cpr_src/b', 'tmp/cpr_dest/b' ++ assert_same_file 'tmp/cpr_src/c', 'tmp/cpr_dest/c' ++ assert_directory 'tmp/cpr_dest/d' ++ rm_rf 'tmp/cpr_src' ++ rm_rf 'tmp/cpr_dest' ++ ++if have_symlink? ++ # symlink in a directory ++ mkdir 'tmp/cpr_src' ++ ln_s 'SLdest', 'tmp/cpr_src/symlink' ++ cp_r 'tmp/cpr_src', 'tmp/cpr_dest' ++ assert_symlink 'tmp/cpr_dest/symlink' ++ assert_equal 'SLdest', File.readlink('tmp/cpr_dest/symlink') ++ ++ # root is a symlink ++ ln_s 'cpr_src', 'tmp/cpr_src2' ++ cp_r 'tmp/cpr_src2', 'tmp/cpr_dest2' ++ assert_directory 'tmp/cpr_dest2' ++ assert_not_symlink 'tmp/cpr_dest2' ++ assert_symlink 'tmp/cpr_dest2/symlink' ++ assert_equal 'SLdest', File.readlink('tmp/cpr_dest2/symlink') ++end ++ + # pathname + touch 'tmp/cprtmp' + assert_nothing_raised { +@@ -249,6 +294,17 @@ end + assert_same_file fname, 'tmp/mvdest' + end + ++ # [ruby-talk:124368] ++ mkdir 'tmp/tmpdir' ++ mkdir_p 'tmp/dest2/tmpdir' ++ assert_raises(Errno::EISDIR) { ++ mv 'tmp/tmpdir', 'tmp/dest2' ++ } ++ mkdir 'tmp/dest2/tmpdir/junk' ++ assert_raises(Errno::EISDIR) { ++ mv 'tmp/tmpdir', 'tmp/dest2' ++ } ++ + # src==dest (1) same path + touch 'tmp/cptmp' + assert_raises(ArgumentError) { +@@ -323,6 +379,14 @@ end + # rm_f 'tmpdatadir' + Dir.rmdir 'tmpdatadir' + ++ Dir.mkdir 'tmp/tmpdir' ++ File.open('tmp/tmpdir/a', 'w') {|f| f.puts 'dummy' } ++ File.open('tmp/tmpdir/c', 'w') {|f| f.puts 'dummy' } ++ rm_f ['tmp/tmpdir/a', 'tmp/tmpdir/b', 'tmp/tmpdir/c'] ++ assert_file_not_exist 'tmp/tmpdir/a' ++ assert_file_not_exist 'tmp/tmpdir/c' ++ Dir.rmdir 'tmp/tmpdir' ++ + # pathname + touch 'tmp/rmtmp1' + touch 'tmp/rmtmp2' +@@ -367,6 +431,23 @@ end + assert_file_not_exist 'tmp/tmpdir' + assert_file_exist 'tmp' + ++ Dir.mkdir 'tmp/tmpdir' ++ File.open('tmp/tmpdir/a', 'w') {|f| f.puts 'dummy' } ++ File.open('tmp/tmpdir/c', 'w') {|f| f.puts 'dummy' } ++ rm_r ['tmp/tmpdir/a', 'tmp/tmpdir/b', 'tmp/tmpdir/c'], :force => true ++ assert_file_not_exist 'tmp/tmpdir/a' ++ assert_file_not_exist 'tmp/tmpdir/c' ++ Dir.rmdir 'tmp/tmpdir' ++ ++if have_symlink? ++ # [ruby-talk:94635] a symlink to the directory ++ Dir.mkdir 'tmp/tmpdir' ++ File.symlink '..', 'tmp/tmpdir/symlink_to_dir' ++ rm_r 'tmp/tmpdir' ++ assert_file_not_exist 'tmp/tmpdir' ++ assert_file_exist 'tmp' ++end ++ + # pathname + Dir.mkdir 'tmp/tmpdir1'; touch 'tmp/tmpdir1/tmp' + Dir.mkdir 'tmp/tmpdir2'; touch 'tmp/tmpdir2/tmp' +@@ -509,6 +590,19 @@ end + assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm? + Dir.rmdir 'tmp/tmp' + ++if have_file_perm? ++ mkdir 'tmp/tmp', :mode => 07777 ++ assert_directory 'tmp/tmp' ++ assert_equal 07777, (File.stat('tmp/tmp').mode & 07777) ++ Dir.rmdir 'tmp/tmp' ++end ++ ++if lf_in_path_allowed? ++ mkdir "tmp-first-line\ntmp-second-line" ++ assert_directory "tmp-first-line\ntmp-second-line" ++ Dir.rmdir "tmp-first-line\ntmp-second-line" ++end ++ + # pathname + assert_nothing_raised { + mkdir Pathname.new('tmp/tmpdirtmp') +@@ -557,6 +651,22 @@ end + assert_equal 0700, (File.stat('tmp/tmp/tmp').mode & 0777) if have_file_perm? + rm_rf 'tmp/tmp' + ++ mkdir_p 'tmp/tmp', :mode => 0 ++ assert_directory 'tmp/tmp' ++ assert_equal 0, (File.stat('tmp/tmp').mode & 0777) if have_file_perm? ++ # DO NOT USE rm_rf here. ++ # (rm(1) try to chdir to parent directory, it fails to remove directory.) ++ Dir.rmdir 'tmp/tmp' ++ Dir.rmdir 'tmp' ++ ++if have_file_perm? ++ mkdir_p 'tmp/tmp/tmp', :mode => 07777 ++ assert_directory 'tmp/tmp/tmp' ++ assert_equal 07777, (File.stat('tmp/tmp/tmp').mode & 07777) ++ Dir.rmdir 'tmp/tmp/tmp' ++ Dir.rmdir 'tmp/tmp' ++end ++ + # pathname + assert_nothing_raised { + mkdir_p Pathname.new('tmp/tmp/tmp') +@@ -639,4 +749,11 @@ end + } + end + ++ def test_chmod ++ # FIXME ++ end ++ ++ #def test_chown # 1.8 does not have chown ++ #def test_chown_R # 1.8 does not have chown_R ++ + end +diff -ruN -p test/fileutils/test_nowrite.rb test/fileutils/test_nowrite.rb +--- test/fileutils/test_nowrite.rb 2003-11-25 20:02:30.000000000 +0900 ++++ test/fileutils/test_nowrite.rb 2004-12-27 15:48:08.000000000 +0900 +@@ -1,20 +1,15 @@ +-# +-# test/fileutils/test_nowrite.rb +-# +- +-$:.unshift File.dirname(__FILE__) ++# $Id: test_nowrite.rb,v 1.4.2.1 2004/12/27 06:48:08 aamine Exp $ + + require 'fileutils' + require 'fileasserts' + require 'tmpdir' + require 'test/unit' + +- + class TestNoWrite < Test::Unit::TestCase + + include FileUtils::NoWrite + +- def my_rm_rf( path ) ++ def my_rm_rf(path) + if File.exist?('/bin/rm') + system %Q[/bin/rm -rf "#{path}"] + else +@@ -52,7 +47,7 @@ class TestNoWrite < Test::Unit::TestCase + check 'tmp/mv' + end + +- def check( dest ) ++ def check(dest) + assert_file_not_exist dest + assert_file_exist SRC + assert_same_file SRC, COPY +diff -ruN -p test/ruby/test_rand.rb test/ruby/test_rand.rb +--- test/ruby/test_rand.rb 1970-01-01 09:00:00.000000000 +0900 ++++ test/ruby/test_rand.rb 2005-01-05 02:38:41.000000000 +0900 +@@ -0,0 +1,124 @@ ++require 'test/unit' ++ ++class TestRand < Test::Unit::TestCase ++ def test_mt ++ srand(0x00000456_00000345_00000234_00000123) ++ %w(1067595299 955945823 477289528 4107218783 4228976476).each {|w| ++ assert_equal(w.to_i, rand(0x100000000)) ++ } ++ end ++ ++ def test_0x3fffffff ++ srand(0) ++ %w(209652396 398764591 924231285 404868288 441365315).each {|w| ++ assert_equal(w.to_i, rand(0x3fffffff)) ++ } ++ end ++ ++ def test_0x40000000 ++ srand(0) ++ %w(209652396 398764591 924231285 404868288 441365315).each {|w| ++ assert_equal(w.to_i, rand(0x40000000)) ++ } ++ end ++ ++ def test_0x40000001 ++ srand(0) ++ %w(209652396 398764591 924231285 441365315 192771779).each {|w| ++ assert_equal(w.to_i, rand(0x40000001)) ++ } ++ end ++ ++ def test_0xffffffff ++ srand(0) ++ %w(2357136044 2546248239 3071714933 3626093760 2588848963).each {|w| ++ assert_equal(w.to_i, rand(0xffffffff)) ++ } ++ end ++ ++ def test_0x100000000 ++ srand(0) ++ %w(2357136044 2546248239 3071714933 3626093760 2588848963).each {|w| ++ assert_equal(w.to_i, rand(0x100000000)) ++ } ++ end ++ ++ def test_0x100000001 ++ srand(0) ++ %w(2546248239 1277901399 243580376 1171049868 2051556033).each {|w| ++ assert_equal(w.to_i, rand(0x100000001)) ++ } ++ end ++ ++ def test_0x1000000000000 ++ srand(0) ++ %w(11736396900911 ++ 183025067478208 ++ 197104029029115 ++ 130583529618791 ++ 180361239846611).each {|w| ++ assert_equal(w.to_i, rand(0x1000000000000)) ++ } ++ end ++ ++ def test_0x1000000000001 ++ srand(0) ++ %w(187121911899765 ++ 197104029029115 ++ 180361239846611 ++ 236336749852452 ++ 208739549485656).each {|w| ++ assert_equal(w.to_i, rand(0x1000000000001)) ++ } ++ end ++ ++ def test_0x3fffffffffffffff ++ srand(0) ++ %w(900450186894289455 ++ 3969543146641149120 ++ 1895649597198586619 ++ 827948490035658087 ++ 3203365596207111891).each {|w| ++ assert_equal(w.to_i, rand(0x3fffffffffffffff)) ++ } ++ end ++ ++ def test_0x4000000000000000 ++ srand(0) ++ %w(900450186894289455 ++ 3969543146641149120 ++ 1895649597198586619 ++ 827948490035658087 ++ 3203365596207111891).each {|w| ++ assert_equal(w.to_i, rand(0x4000000000000000)) ++ } ++ end ++ ++ def test_0x4000000000000001 ++ srand(0) ++ %w(900450186894289455 ++ 3969543146641149120 ++ 1895649597198586619 ++ 827948490035658087 ++ 2279347887019741461).each {|w| ++ assert_equal(w.to_i, rand(0x4000000000000001)) ++ } ++ end ++ ++ def test_neg_0x10000000000 ++ ws = %w(455570294424 1073054410371 790795084744 2445173525 1088503892627) ++ srand(3) ++ ws.each {|w| assert_equal(w.to_i, rand(0x10000000000)) } ++ srand(3) ++ ws.each {|w| assert_equal(w.to_i, rand(-0x10000000000)) } ++ end ++ ++ def test_neg_0x10000 ++ ws = %w(2732 43567 42613 52416 45891) ++ srand(0) ++ ws.each {|w| assert_equal(w.to_i, rand(0x10000)) } ++ srand(0) ++ ws.each {|w| assert_equal(w.to_i, rand(-0x10000)) } ++ end ++ ++end +diff -ruN -p test/webrick/test_httpauth.rb test/webrick/test_httpauth.rb +--- test/webrick/test_httpauth.rb 1970-01-01 09:00:00.000000000 +0900 ++++ test/webrick/test_httpauth.rb 2005-01-03 07:50:01.000000000 +0900 +@@ -0,0 +1,105 @@ ++require "test/unit" ++require "net/http" ++require "tempfile" ++require "webrick" ++require "webrick/httpauth/basicauth" ++ ++class TestWEBrickHTTPAuth < Test::Unit::TestCase ++ class NullWriter ++ def NullWriter.<<(msg) ++ puts msg if $DEBUG ++ return self ++ end ++ end ++ ++ def start_httpserver ++ server = WEBrick::HTTPServer.new( ++ :BindAddress => "0.0.0.0", :Port => 0, ++ :Logger => WEBrick::Log.new(NullWriter), ++ :AccessLog => [[NullWriter, ""]] ++ ) ++ thread = nil ++ begin ++ thread = Thread.start{ server.start } ++ addr = server.listeners[0].addr ++ yield([server, addr[3], addr[1]]) ++ ensure ++ server.stop ++ thread.join ++ end ++ end ++ ++ def test_basic_auth ++ start_httpserver{|server, addr, port| ++ realm = "WEBrick's realm" ++ path = "/basic_auth" ++ ++ server.mount_proc(path){|req, res| ++ WEBrick::HTTPAuth.basic_auth(req, res, realm){|user, pass| ++ user == "webrick" && pass == "supersecretpassword" ++ } ++ res.body = "hoge" ++ } ++ http = Net::HTTP.new(addr, port) ++ g = Net::HTTP::Get.new(path) ++ g.basic_auth("webrick", "supersecretpassword") ++ http.request(g){|res| assert_equal("hoge", res.body)} ++ g.basic_auth("webrick", "not super") ++ http.request(g){|res| assert_not_equal("hoge", res.body)} ++ } ++ end ++ ++ def test_basic_auth2 ++ start_httpserver{|server, addr, port| ++ realm = "WEBrick's realm" ++ path = "/basic_auth2" ++ ++ tmpfile = Tempfile.new("test_webrick_auth") ++ tmpfile.close ++ tmp_pass = WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path) ++ tmp_pass.set_passwd(realm, "webrick", "supersecretpassword") ++ tmp_pass.set_passwd(realm, "foo", "supersecretpassword") ++ tmp_pass.flush ++ ++ htpasswd = WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path) ++ users = [] ++ htpasswd.each{|user, pass| users << user } ++ assert_equal(2, users.size) ++ assert(users.member?("webrick")) ++ assert(users.member?("foo")) ++ ++ server.mount_proc(path){|req, res| ++ auth = WEBrick::HTTPAuth::BasicAuth.new( ++ :Realm => realm, :UserDB => htpasswd, ++ :Logger => server.logger ++ ) ++ auth.authenticate(req, res) ++ res.body = "hoge" ++ } ++ http = Net::HTTP.new(addr, port) ++ g = Net::HTTP::Get.new(path) ++ g.basic_auth("webrick", "supersecretpassword") ++ http.request(g){|res| assert_equal("hoge", res.body)} ++ g.basic_auth("webrick", "not super") ++ http.request(g){|res| assert_not_equal("hoge", res.body)} ++ } ++ end ++ ++ def test_basic_auth3 ++ tmpfile = Tempfile.new("test_webrick_auth") ++ tmpfile.puts("webrick:{SHA}GJYFRpBbdchp595jlh3Bhfmgp8k=") ++ tmpfile.flush ++ assert_raises(NotImplementedError){ ++ WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path) ++ } ++ tmpfile.close(true) ++ ++ tmpfile = Tempfile.new("test_webrick_auth") ++ tmpfile.puts("webrick:$apr1$IOVMD/..$rmnOSPXr0.wwrLPZHBQZy0") ++ tmpfile.flush ++ assert_raises(NotImplementedError){ ++ WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path) ++ } ++ tmpfile.close(true) ++ end ++end +diff -ruN -p variable.c variable.c +--- variable.c 2004-10-02 12:50:48.000000000 +0900 ++++ variable.c 2005-01-01 01:15:02.000000000 +0900 +@@ -3,7 +3,7 @@ + variable.c - + + $Author: matz $ +- $Date: 2004/10/02 03:50:48 $ ++ $Date: 2004/12/31 16:15:02 $ + created at: Tue Apr 19 23:55:15 JST 1994 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -1289,7 +1289,7 @@ rb_autoload(mod, id, file) + tbl = check_autoload_table(av); + } + else { +- av = Data_Wrap_Struct(rb_cData, rb_mark_tbl, st_free_table, 0); ++ av = Data_Wrap_Struct(0, rb_mark_tbl, st_free_table, 0); + st_add_direct(tbl, autoload, av); + DATA_PTR(av) = tbl = st_init_numtable(); + } +diff -ruN -p version.h version.h +--- version.h 2004-12-25 19:56:39.000000000 +0900 ++++ version.h 2005-01-06 13:54:55.000000000 +0900 +@@ -1,14 +1,14 @@ + #define RUBY_VERSION "1.8.2" +-#define RUBY_RELEASE_DATE "2004-12-25" ++#define RUBY_RELEASE_DATE "2005-01-06" + #define RUBY_VERSION_CODE 182 +-#define RUBY_RELEASE_CODE 20041225 ++#define RUBY_RELEASE_CODE 20050106 + + #define RUBY_VERSION_MAJOR 1 + #define RUBY_VERSION_MINOR 8 + #define RUBY_VERSION_TEENY 2 +-#define RUBY_RELEASE_YEAR 2004 +-#define RUBY_RELEASE_MONTH 12 +-#define RUBY_RELEASE_DAY 25 ++#define RUBY_RELEASE_YEAR 2005 ++#define RUBY_RELEASE_MONTH 1 ++#define RUBY_RELEASE_DAY 6 + + RUBY_EXTERN const char ruby_version[]; + RUBY_EXTERN const char ruby_release_date[]; +diff -ruN -p win32/Makefile.sub win32/Makefile.sub +--- win32/Makefile.sub 2004-11-17 13:11:21.000000000 +0900 ++++ win32/Makefile.sub 2004-12-28 12:28:10.000000000 +0900 +@@ -87,6 +87,13 @@ DESTDIR = $(prefix) + !if !defined(libdir) + libdir = $(exec_prefix)/lib + !endif ++!ifndef RIDATADIR ++RIDATADIR = $(DESTDIR)/share/ri/$(MAJOR).$(MINOR)/system ++!endif ++!ifndef RDOCTARGET ++RDOCTARGET = install-nodoc ++!endif ++ + !if !defined(CFLAGS) + CFLAGS = -MD $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) + !endif +@@ -424,14 +431,20 @@ $(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEX + {$(srcdir)/win32}.def.lib: + $(AR) $(ARFLAGS)$@ -def:$< + +-install: rbconfig.rb ++install: install-nodoc $(RDOCTARGET) ++ ++install-nodoc: rbconfig.rb + $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) + $(MINIRUBY) $(srcdir)/ext/extmk.rb $(SCRIPT_ARGS) install + + what-where no-install: rbconfig.rb +- $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) ++ $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)" + $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(SCRIPT_ARGS) install + ++install-doc: ++ @echo Generating RDoc documentation ++ $(DESTDIR:/=\)\bin\$(PROGRAM) $(srcdir)/bin/rdoc --all --ri-system --op "$(RIDATADIR)" $(srcdir) ++ + clean: clean-ext clean-local + + clean-local: +diff -ruN -p win32/configure.bat win32/configure.bat +--- win32/configure.bat 2002-09-11 09:24:07.000000000 +0900 ++++ win32/configure.bat 2004-12-28 12:28:10.000000000 +0900 +@@ -14,6 +14,10 @@ if "%1" == "--srcdir" goto :srcdir + if "%1" == "srcdir" goto :srcdir + if "%1" == "--target" goto :target + if "%1" == "target" goto :target ++if "%1" == "--enable-install-doc" goto :enable-rdoc ++if "%1" == "--disable-install-doc" goto :disable-rdoc ++if "%1" == "-h" goto :help ++if "%1" == "--help" goto :help + echo>> ~tmp~.mak "%1" \ + shift + goto :loop +@@ -27,6 +31,25 @@ goto :loop + shift + shift + goto :loop ++:enable-rdoc ++ echo>> ~tmp~.mak "RDOCTARGET=install-doc" \ ++ shift ++goto :loop ++:disable-rdoc ++ echo>> ~tmp~.mak "RDOCTARGET=install-nodoc" \ ++ shift ++goto :loop ++:help ++ echo Configuration: ++ echo --help display this help ++ echo --srcdir=DIR find the sources in DIR [configure dir or `..'] ++ echo System types: ++ echo --target=TARGET configure for TARGET [i386-mswin32] ++ echo Optional Package: ++ echo --enable-install-doc install rdoc indexes during install ++ del ~tmp~.mak ++goto :exit + :end + echo>> ~tmp~.mak WIN32DIR=$(@D) + nmake -alf ~tmp~.mak ++:exit +diff -ruN -p win32/setup.mak win32/setup.mak +--- win32/setup.mak 2004-11-16 17:36:11.000000000 +0900 ++++ win32/setup.mak 2004-12-28 12:28:10.000000000 +0900 +@@ -32,6 +32,9 @@ alpha-$(OS): -prologue- -alpha- -epilogu + @type << > $(MAKEFILE) + ### Makefile for ruby $(OS) ### + srcdir = $(srcdir:\=/) ++!if defined(RDOCTARGET) ++RDOCTARGET = $(RDOCTARGET) ++!endif + << + @cl -nologo -EP -I$(srcdir) -DRUBY_EXTERN="//" <<"Creating $(MAKEFILE)" >> $(MAKEFILE) + #include "version.h" +diff -ruN -p win32/win32.c win32/win32.c +--- win32/win32.c 2004-12-24 23:52:24.000000000 +0900 ++++ win32/win32.c 2005-01-06 20:05:31.000000000 +0900 +@@ -93,7 +93,7 @@ static struct ChildRecord *CreateChild(c + static bool has_redirection(const char *); + static void StartSockets (); + static DWORD wait_events(HANDLE event, DWORD timeout); +-#if !defined(__BORLANDC__) && !defined(_WIN32_WCE) ++#if !defined(_WIN32_WCE) + static int rb_w32_open_osfhandle(long osfhandle, int flags); + #else + #define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags) +@@ -1637,6 +1637,19 @@ rb_w32_open_osfhandle(long osfhandle, in + + #endif + ++#ifdef __BORLANDC__ ++static int ++rb_w32_open_osfhandle(long osfhandle, int flags) ++{ ++ int fd = _open_osfhandle(osfhandle, flags); ++ if (fd == -1) { ++ errno = EMFILE; /* too many open files */ ++ _doserrno = 0L; /* not an OS error */ ++ } ++ return fd; ++} ++#endif ++ + #undef getsockopt + + static int +@@ -3231,6 +3244,7 @@ rb_w32_close(int fd) + return _close(fd); + } + _set_osfhnd(fd, (SOCKET)INVALID_HANDLE_VALUE); ++ _close(fd); + if (closesocket(sock) == SOCKET_ERROR) { + errno = map_errno(WSAGetLastError()); + return -1; +@@ -3324,6 +3338,45 @@ rb_w32_snprintf(char *buf, size_t size, + return ret; + } + ++#undef mkdir ++#undef rmdir ++int ++rb_w32_mkdir(const char *path, int mode) ++{ ++ int ret = -1; ++ RUBY_CRITICAL(do { ++ if (mkdir(path) == -1) ++ break; ++ if (chmod(path, mode) == -1) { ++ int save_errno = errno; ++ rmdir(path); ++ errno = save_errno; ++ break; ++ } ++ ret = 0; ++ } while (0)); ++ return ret; ++} ++ ++int ++rb_w32_rmdir(const char *path) ++{ ++ DWORD attr; ++ int ret; ++ RUBY_CRITICAL({ ++ attr = GetFileAttributes(path); ++ if (attr != (DWORD)-1 && (attr & FILE_ATTRIBUTE_READONLY)) { ++ attr &= ~FILE_ATTRIBUTE_READONLY; ++ SetFileAttributes(path, attr); ++ } ++ ret = rmdir(path); ++ if (ret < 0 && attr != (DWORD)-1) { ++ SetFileAttributes(path, attr); ++ } ++ }); ++ return ret; ++} ++ + #if !defined(__BORLANDC__) && !defined(_WIN32_WCE) + int + rb_w32_isatty(int fd) +diff -ruN -p win32/win32.h win32/win32.h +--- win32/win32.h 2004-12-24 23:52:25.000000000 +0900 ++++ win32/win32.h 2005-01-05 10:50:06.000000000 +0900 +@@ -127,6 +127,10 @@ extern "C++" { + #undef isatty + #define isatty(h) rb_w32_isatty(h) + #endif ++#undef mkdir ++#define mkdir(p, m) rb_w32_mkdir(p, m) ++#undef rmdir ++#define rmdir(p) rb_w32_rmdir(p) + + #ifdef __MINGW32__ + struct timezone { +@@ -187,6 +191,8 @@ extern pid_t rb_w32_getpid(void); + #if !defined(__BORLANDC__) && !defined(_WIN32_WCE) + extern int rb_w32_isatty(int); + #endif ++extern int rb_w32_mkdir(const char *, int); ++extern int rb_w32_rmdir(const char *); + + #ifdef __BORLANDC__ + extern FILE *rb_w32_fopen(const char *, const char *); diff -urN ruby18.orig/files/patch-101_cvs_updates ruby18/files/patch-101_cvs_updates --- ruby18.orig/files/patch-101_cvs_updates Wed Dec 31 19:00:00 1969 +++ ruby18/files/patch-101_cvs_updates Tue Feb 22 16:52:00 2005 @@ -0,0 +1,699 @@ +diff -ruN -p ChangeLog ChangeLog +--- ChangeLog 2005-01-06 20:31:36.000000000 +0900 ++++ ChangeLog 2005-01-11 09:46:05.000000000 +0900 +@@ -1,3 +1,40 @@ ++Tue Jan 11 09:44:40 2005 Hirokazu Yamamoto ++ ++ * numeric.c (Init_Numeric): turn off floating point exceptions ++ on bcc32. "1e300".to_f had crashed by overflow. ++ ++Tue Jan 11 03:10:10 2005 Minero Aoki ++ ++ * lib/fileutils.rb (copy_entry): could not copy symbolic link. ++ [ruby-talk:125733] ++ ++ * lib/fileutils.rb (copy_stream): use read/write instead of ++ sysread/syswrite. ++ ++Mon Jan 10 23:08:15 2005 Nobuyoshi Nakada ++ ++ * variable.c (rb_autoload): hide internal data from ruby level. ++ fixed: [ruby-dev:25435], [ruby-list:40498] ++ ++Sun Jan 9 03:12:58 2005 Tanaka Akira ++ ++ * io.c (io_fread): warn nonblocking behavior. ++ (io_readpartial): new method IO#readpartial. ++ ++Sat Jan 8 04:38:47 2005 why the lucky stiff ++ ++ * lib/yaml.rb: Kernel#y requires an argument. ++ ++Fri Jan 7 21:12:29 2005 TAMURA Takashi ++ ++ * random.c (rand_init): use ALLOC_N instead of ALLOCA_N ++ [ruby-dev:25426] ++ ++Fri Jan 7 18:03:35 2005 Tanaka Akira ++ ++ * gc.c (mark_locations_array): avoid core dump with -O3. ++ [ruby-dev:25424] ++ + Thu Jan 6 20:31:07 2005 NAKAMURA Usaku + + * ext/zlib/zlib.c (zstream_end): should return value. (backported +@@ -205,7 +242,7 @@ Sat Dec 25 01:28:23 2004 Yukihiro Matsu + + * dln.c: use for NetBSD. [ruby-dev:25313] + +- * io.c (rb_f_select): [ruby-dev:25312] ++ * io.c (rb_f_select): IO list could be altered. [ruby-dev:25312] + + Fri Dec 24 23:51:48 2004 Hirokazu Yamamoto + +@@ -1016,7 +1053,8 @@ Mon Nov 29 15:22:28 2004 Nobuyoshi Naka + + Mon Nov 29 03:08:30 2004 Yukihiro Matsumoto + +- * object.c (convert_type): [ruby-core:03845] ++ * object.c (convert_type): direct call conversion methods for the ++ performance. [ruby-core:03845] + + * eval.c (rb_funcall_rescue): new function. + +@@ -1026,7 +1064,8 @@ Mon Nov 29 03:08:30 2004 Yukihiro Matsu + + * parse.y (reduce_nodes): empty body should return nil. + +- * string.c (rb_str_aset): [ruby-dev:24981] ++ * string.c (rb_str_aset): the original string should not be ++ affected by modifying duplicated string. [ruby-dev:24981] + + Mon Nov 29 13:57:38 2004 NAKAMURA Usaku + +@@ -1060,7 +1099,8 @@ Sat Nov 27 21:43:39 2004 Tanaka Akira + + Sat Nov 27 14:44:15 2004 Kent Sibilev + +- * lib/cgi/session.rb (CGI::Session::initialize): [ruby-core:03832] ++ * lib/cgi/session.rb (CGI::Session::initialize): create_new_id is ++ now a instance method. [ruby-core:03832] + + Sat Nov 27 09:41:21 2004 Yukihiro Matsumoto + +@@ -1137,7 +1177,8 @@ Tue Nov 23 00:10:48 2004 Yukihiro Matsu + + * dir.c (dir_seek): use NUM2OFFT(). + +- * misc/ruby-mode.el (ruby-non-block-do-re): [ruby-core:03719] ++ * misc/ruby-mode.el (ruby-non-block-do-re): should not match words ++ start with block keyword and underscore. [ruby-core:03719] + + Mon Nov 22 22:33:02 2004 Dave Thomas + +diff -ruN -p gc.c gc.c +--- gc.c 2004-12-20 22:53:34.000000000 +0900 ++++ gc.c 2005-01-07 18:08:19.000000000 +0900 +@@ -3,7 +3,7 @@ + gc.c - + + $Author: akr $ +- $Date: 2004/12/20 13:53:34 $ ++ $Date: 2005/01/07 09:08:19 $ + created at: Tue Oct 5 09:44:46 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -619,9 +619,11 @@ mark_locations_array(x, n) + register VALUE *x; + register long n; + { ++ VALUE v; + while (n--) { +- if (is_pointer_to_heap((void *)*x)) { +- gc_mark(*x, 0); ++ v = *x; ++ if (is_pointer_to_heap((void *)v)) { ++ gc_mark(v, 0); + } + x++; + } +diff -ruN -p io.c io.c +--- io.c 2004-12-25 19:56:39.000000000 +0900 ++++ io.c 2005-01-09 03:17:10.000000000 +0900 +@@ -2,8 +2,8 @@ + + io.c - + +- $Author: matz $ +- $Date: 2004/12/25 10:56:39 $ ++ $Author: akr $ ++ $Date: 2005/01/08 18:17:10 $ + created at: Fri Oct 15 18:08:59 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -944,6 +944,27 @@ rb_io_to_io(io) + } + + /* reading functions */ ++static long ++read_buffered_data(ptr, len, f) ++ char *ptr; ++ long len; ++ FILE *f; ++{ ++ long n; ++ ++#ifdef READ_DATA_PENDING_COUNT ++ n = READ_DATA_PENDING_COUNT(f); ++ if (n <= 0) return 0; ++ if (n > len) n = len; ++ return fread(ptr, 1, n, f); ++#else ++ for (n = 0; n < len && READ_DATA_PENDING(f); ++n) { ++ *ptr++ = getc(f); ++ } ++ return n; ++#endif ++} ++ + long + io_fread(ptr, len, fptr) + char *ptr; +@@ -952,32 +973,17 @@ io_fread(ptr, len, fptr) + { + long n = len; + int c; ++ int saved_errno; + + while (n > 0) { +-#ifdef READ_DATA_PENDING_COUNT +- long i = READ_DATA_PENDING_COUNT(fptr->f); +- if (i <= 0) { +- rb_thread_wait_fd(fileno(fptr->f)); +- rb_io_check_closed(fptr); +- i = READ_DATA_PENDING_COUNT(fptr->f); +- } +- if (i > 0) { +- if (i > n) i = n; +- TRAP_BEG; +- c = fread(ptr, 1, i, fptr->f); +- TRAP_END; +- if (c < 0) goto eof; +- ptr += c; +- n -= c; +- if (c < i) goto eof; +- continue; +- } +-#else +- if (!READ_DATA_PENDING(fptr->f)) { +- rb_thread_wait_fd(fileno(fptr->f)); +- rb_io_check_closed(fptr); +- } +-#endif ++ c = read_buffered_data(ptr, n, fptr->f); ++ if (c < 0) goto eof; ++ if (c > 0) { ++ ptr += c; ++ if ((n -= c) <= 0) break; ++ } ++ rb_thread_wait_fd(fileno(fptr->f)); ++ rb_io_check_closed(fptr); + TRAP_BEG; + c = getc(fptr->f); + TRAP_END; +@@ -998,6 +1004,9 @@ io_fread(ptr, len, fptr) + if (len > n) { + clearerr(fptr->f); + } ++ saved_errno = errno; ++ rb_warn("nonblocking IO#read is obsolete; use IO#readpartial or IO#sysread"); ++ errno = saved_errno; + } + if (len == n) return 0; + } +@@ -1092,6 +1101,126 @@ read_all(fptr, siz, str) + return str; + } + ++static VALUE ++io_getpartial(int argc, VALUE *argv, VALUE io) ++{ ++ OpenFile *fptr; ++ VALUE length, str; ++ long n, len; ++ ++ rb_scan_args(argc, argv, "11", &length, &str); ++ ++ if ((len = NUM2LONG(length)) < 0) { ++ rb_raise(rb_eArgError, "negative length %ld given", len); ++ } ++ ++ if (NIL_P(str)) { ++ str = rb_str_new(0, len); ++ } ++ else { ++ StringValue(str); ++ rb_str_modify(str); ++ rb_str_resize(str, len); ++ } ++ OBJ_TAINT(str); ++ ++ GetOpenFile(io, fptr); ++ rb_io_check_readable(fptr); ++ ++ if (len == 0) ++ return str; ++ ++ READ_CHECK(fptr->f); ++ if (RSTRING(str)->len != len) { ++ modified: ++ rb_raise(rb_eRuntimeError, "buffer string modified"); ++ } ++ n = read_buffered_data(RSTRING(str)->ptr, len, fptr->f); ++ if (n <= 0) { ++ again: ++ if (RSTRING(str)->len != len) goto modified; ++ TRAP_BEG; ++ n = read(fileno(fptr->f), RSTRING(str)->ptr, len); ++ TRAP_END; ++ if (n < 0) { ++ if (rb_io_wait_readable(fileno(fptr->f))) ++ goto again; ++ rb_sys_fail(fptr->path); ++ } ++ } ++ rb_str_resize(str, n); ++ ++ if (n == 0) ++ return Qnil; ++ else ++ return str; ++} ++ ++/* ++ * call-seq: ++ * ios.readpartial(maxlen[, outbuf]) => string, outbuf ++ * ++ * Reads at most maxlen bytes from the I/O stream but ++ * it blocks only if ios has no data immediately available. ++ * If the optional outbuf argument is present, ++ * it must reference a String, which will receive the data. ++ * It raises EOFError on end of file. ++ * ++ * readpartial is designed for streams such as pipe, socket, tty, etc. ++ * It blocks only when no data immediately available. ++ * This means that it blocks only when following all conditions hold. ++ * * the buffer in the IO object is empty. ++ * * the content of the stream is empty. ++ * * the stream is not reached to EOF. ++ * ++ * When readpartial blocks, it waits data or EOF on the stream. ++ * If some data is reached, readpartial returns with the data. ++ * If EOF is reached, readpartial raises EOFError. ++ * ++ * When readpartial doesn't blocks, it returns or raises immediately. ++ * If the buffer is not empty, it returns the data in the buffer. ++ * Otherwise if the stream has some content, ++ * it returns the data in the stream. ++ * Otherwise if the stream is reached to EOF, it raises EOFError. ++ * ++ * r, w = IO.pipe # buffer pipe content ++ * w << "abc" # "" "abc". ++ * r.readpartial(4096) #=> "abc" "" "" ++ * r.readpartial(4096) # blocks because buffer and pipe is empty. ++ * ++ * r, w = IO.pipe # buffer pipe content ++ * w << "abc" # "" "abc" ++ * w.close # "" "abc" EOF ++ * r.readpartial(4096) #=> "abc" "" EOF ++ * r.readpartial(4096) # raises EOFError ++ * ++ * r, w = IO.pipe # buffer pipe content ++ * w << "abc\ndef\n" # "" "abc\ndef\n" ++ * r.gets #=> "abc\n" "def\n" "" ++ * w << "ghi\n" # "def\n" "ghi\n" ++ * r.readpartial(4096) #=> "def\n" "" "ghi\n" ++ * r.readpartial(4096) #=> "ghi\n" "" "" ++ * ++ * Note that readpartial is nonblocking-flag insensitive. ++ * It blocks even if the nonblocking-flag is set. ++ * ++ * Also note that readpartial behaves similar to sysread in blocking mode. ++ * The behavior is identical when the buffer is empty. ++ * ++ */ ++ ++static VALUE ++io_readpartial(int argc, VALUE *argv, VALUE io) ++{ ++ VALUE ret; ++ ++ ret = io_getpartial(argc, argv, io); ++ if (NIL_P(ret)) ++ rb_eof_error(); ++ else ++ return ret; ++} ++ + /* + * call-seq: + * ios.read([integer [, buffer]]) => string, buffer, or nil +@@ -5409,6 +5538,7 @@ Init_IO() + + rb_define_method(rb_cIO, "readlines", rb_io_readlines, -1); + ++ rb_define_method(rb_cIO, "readpartial", io_readpartial, -1); + rb_define_method(rb_cIO, "read", io_read, -1); + rb_define_method(rb_cIO, "write", io_write, 1); + rb_define_method(rb_cIO, "gets", rb_io_gets_m, -1); +diff -ruN -p lib/fileutils.rb lib/fileutils.rb +--- lib/fileutils.rb 2004-12-27 15:22:14.000000000 +0900 ++++ lib/fileutils.rb 2005-01-11 03:28:32.000000000 +0900 +@@ -1,7 +1,7 @@ + # + # = fileutils.rb + # +-# Copyright (c) 2000-2004 Minero Aoki ++# Copyright (c) 2000-2005 Minero Aoki + # + # This program is free software. + # You can distribute/modify this program under the same terms of ruby. +@@ -47,12 +47,14 @@ + # + # There are some `low level' methods, which does not accept any option: + # +-# uptodate?(file, cmp_list) + # copy_entry(src, dest, preserve = false, dereference = false) + # copy_file(src, dest, preserve = false, dereference = true) + # copy_stream(srcstream, deststream) ++# remove_file(path, force = false) ++# remove_dir(path, force = false) + # compare_file(path_a, path_b) + # compare_stream(stream_a, stream_b) ++# uptodate?(file, cmp_list) + # + # == module FileUtils::Verbose + # +@@ -219,7 +221,6 @@ module FileUtils + end + private :fu_mkdir + +- + # + # Options: noop, verbose + # +@@ -241,7 +242,6 @@ module FileUtils + end + end + +- + # + # Options: force noop verbose + # +@@ -325,7 +325,6 @@ module FileUtils + ln_s src, dest, options + end + +- + # + # Options: preserve noop verbose + # +@@ -413,7 +412,8 @@ module FileUtils + # Both of +src+ and +dest+ must be a path name. + # +src+ must exist, +dest+ must not exist. + # +- # If +preserve+ is true, this method preserves owner, group and permissions. ++ # If +preserve+ is true, this method preserves owner, group, permissions ++ # and modified time. + # If +dereference+ is true, this method copies a target of symbolic link + # instead of a symbolic link itself. + # +@@ -431,23 +431,21 @@ module FileUtils + + # + # Copies stream +src+ to +dest+. +- # Both of +src+ and +dest+ must be a IO. ++ # +src+ must respond to #read(n) and ++ # +dest+ must respond to #write(str). + # + def copy_stream(src, dest) + fu_copy_stream0 src, dest, fu_stream_blksize(src, dest) + end + + def fu_copy_stream0(src, dest, blksize) #:nodoc: +- begin +- while true +- dest.syswrite src.sysread(blksize) +- end +- rescue EOFError ++ while s = src.read(blksize) ++ dest.write s + end + end + private :fu_copy_stream0 + +- class CopyContext_ ++ class CopyContext_ #:nodoc: internal use only + include ::FileUtils + + def initialize(preserve = false, dereference = false, stat = nil) +@@ -527,7 +525,11 @@ module FileUtils + end + + def stat(path) +- @stat ||= ::File.stat(path) ++ if @dereference ++ @stat ||= ::File.stat(path) ++ else ++ @stat ||= ::File.lstat(path) ++ end + end + + def chmod(mode, path) +@@ -616,7 +618,6 @@ module FileUtils + end + private :rename_cannot_overwrite_file? + +- + # + # Options: force noop verbose + # +@@ -736,7 +737,6 @@ module FileUtils + end + end + +- + # + # Returns true if the contents of a file A and a file B are identical. + # +@@ -773,7 +773,6 @@ module FileUtils + false + end + +- + # + # Options: mode noop verbose + # +@@ -799,7 +798,6 @@ module FileUtils + end + end + +- + # + # Options: noop verbose + # +@@ -818,7 +816,6 @@ module FileUtils + File.chmod mode, *list + end + +- + # + # Options: noop verbose + # +@@ -969,7 +966,6 @@ module FileUtils + 'touch' => %w( noop verbose ) + } + +- + # + # This module has all methods of FileUtils module, but it outputs messages + # before acting. This equates to passing the :verbose flag to +diff -ruN -p lib/yaml.rb lib/yaml.rb +--- lib/yaml.rb 2004-07-31 05:38:41.000000000 +0900 ++++ lib/yaml.rb 2005-01-08 04:34:36.000000000 +0900 +@@ -1,5 +1,5 @@ + # -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4 +-# $Id: yaml.rb,v 1.9.2.7 2004/07/30 20:38:41 why Exp $ ++# $Id: yaml.rb,v 1.9.2.8 2005/01/07 19:34:36 why Exp $ + # + # = yaml.rb: top-level module with methods for loading and parsing YAML documents + # +@@ -400,7 +400,8 @@ module Kernel + # ryan:: Either way, I certainly will have a pony parade. + # + +- def y( *x ) ++ def y( o, *x ) ++ x.unshift o + puts( if x.length == 1 + YAML::dump( *x ) + else +diff -ruN -p numeric.c numeric.c +--- numeric.c 2004-11-18 12:47:14.000000000 +0900 ++++ numeric.c 2005-01-11 09:46:07.000000000 +0900 +@@ -2,8 +2,8 @@ + + numeric.c - + +- $Author: matz $ +- $Date: 2004/11/18 03:47:14 $ ++ $Author: ocean $ ++ $Date: 2005/01/11 00:46:07 $ + created at: Fri Aug 13 18:33:09 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -2767,6 +2767,9 @@ Init_Numeric() + #elif defined(_UNICOSMP) + /* Turn off floating point exceptions for divide by zero, etc. */ + _set_Creg(0, 0); ++#elif defined(__BORLANDC__) ++ /* Turn off floating point exceptions for overflow, etc. */ ++ _control87(MCW_EM, MCW_EM); + #endif + id_coerce = rb_intern("coerce"); + id_to_i = rb_intern("to_i"); +diff -ruN -p random.c random.c +--- random.c 2005-01-06 17:24:04.000000000 +0900 ++++ random.c 2005-01-07 23:05:43.000000000 +0900 +@@ -2,8 +2,8 @@ + + random.c - + +- $Author: ocean $ +- $Date: 2005/01/06 08:24:04 $ ++ $Author: akr $ ++ $Date: 2005/01/07 14:05:43 $ + created at: Fri Dec 24 16:39:21 JST 1993 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -216,7 +216,7 @@ rand_init(vseed) + rb_obj_classname(vseed)); + } + len = (len + 3) / 4; /* number of 32bit words */ +- buf = ALLOCA_N(long, len); /* allocate longs for init_by_array */ ++ buf = ALLOC_N(long, len); /* allocate longs for init_by_array */ + memset(buf, 0, len * sizeof(long)); + if (FIXNUM_P(seed)) { + buf[0] = FIX2ULONG(seed) & 0xffffffff; +@@ -248,7 +248,7 @@ rand_init(vseed) + first = 0; + old = saved_seed; + saved_seed = seed; +- ++ free(buf); + return old; + } + +diff -ruN -p test/ruby/test_readpartial.rb test/ruby/test_readpartial.rb +--- test/ruby/test_readpartial.rb 1970-01-01 09:00:00.000000000 +0900 ++++ test/ruby/test_readpartial.rb 2005-01-09 03:17:13.000000000 +0900 +@@ -0,0 +1,74 @@ ++require 'test/unit' ++require 'timeout' ++require 'fcntl' ++ ++class TestReadPartial < Test::Unit::TestCase ++ def make_pipe ++ r, w = IO.pipe ++ begin ++ yield r, w ++ ensure ++ r.close unless r.closed? ++ w.close unless w.closed? ++ end ++ end ++ ++ def pipe ++ make_pipe {|r, w| ++ yield r, w ++ } ++ return unless defined?(Fcntl::F_SETFL) ++ return unless defined?(Fcntl::F_GETFL) ++ return unless defined?(Fcntl::O_NONBLOCK) ++ make_pipe {|r, w| ++ r.fcntl(Fcntl::F_SETFL, r.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK) ++ yield r, w ++ } ++ end ++ ++ def test_length_zero ++ pipe {|r, w| ++ assert_equal('', r.readpartial(0)) ++ } ++ end ++ ++ def test_closed_pipe ++ pipe {|r, w| ++ w << 'abc' ++ w.close ++ assert_equal('ab', r.readpartial(2)) ++ assert_equal('c', r.readpartial(2)) ++ assert_raises(EOFError) { r.readpartial(2) } ++ assert_raises(EOFError) { r.readpartial(2) } ++ } ++ end ++ ++ if !File::ALT_SEPARATOR # read on pipe cannot timeout on Windows. ++ def test_open_pipe ++ pipe {|r, w| ++ w << 'abc' ++ assert_equal('ab', r.readpartial(2)) ++ assert_equal('c', r.readpartial(2)) ++ assert_raises(TimeoutError) { ++ timeout(0.1) { r.readpartial(2) } ++ } ++ } ++ end ++ ++ def test_with_stdio ++ pipe {|r, w| ++ w << "abc\ndef\n" ++ assert_equal("abc\n", r.gets) ++ w << "ghi\n" ++ assert_equal("de", r.readpartial(2)) ++ assert_equal("f\n", r.readpartial(4096)) ++ assert_equal("ghi\n", r.readpartial(4096)) ++ assert_raises(TimeoutError) { ++ timeout(0.1) { r.readpartial(2) } ++ } ++ } ++ end ++ end ++ ++end ++ +diff -ruN -p variable.c variable.c +--- variable.c 2005-01-01 01:15:02.000000000 +0900 ++++ variable.c 2005-01-10 23:08:22.000000000 +0900 +@@ -2,8 +2,8 @@ + + variable.c - + +- $Author: matz $ +- $Date: 2004/12/31 16:15:02 $ ++ $Author: nobu $ ++ $Date: 2005/01/10 14:08:22 $ + created at: Tue Apr 19 23:55:15 JST 1994 + + Copyright (C) 1993-2003 Yukihiro Matsumoto +@@ -1289,7 +1289,8 @@ rb_autoload(mod, id, file) + tbl = check_autoload_table(av); + } + else { +- av = Data_Wrap_Struct(0, rb_mark_tbl, st_free_table, 0); ++ av = Data_Wrap_Struct(rb_cData, rb_mark_tbl, st_free_table, 0); ++ RBASIC(av)->klass = 0; + st_add_direct(tbl, autoload, av); + DATA_PTR(av) = tbl = st_init_numtable(); + } +diff -ruN -p version.h version.h +--- version.h 2005-01-06 13:54:55.000000000 +0900 ++++ version.h 2005-01-10 23:09:48.000000000 +0900 +@@ -1,14 +1,14 @@ + #define RUBY_VERSION "1.8.2" +-#define RUBY_RELEASE_DATE "2005-01-06" ++#define RUBY_RELEASE_DATE "2005-01-10" + #define RUBY_VERSION_CODE 182 +-#define RUBY_RELEASE_CODE 20050106 ++#define RUBY_RELEASE_CODE 20050110 + + #define RUBY_VERSION_MAJOR 1 + #define RUBY_VERSION_MINOR 8 + #define RUBY_VERSION_TEENY 2 + #define RUBY_RELEASE_YEAR 2005 + #define RUBY_RELEASE_MONTH 1 +-#define RUBY_RELEASE_DAY 6 ++#define RUBY_RELEASE_DAY 10 + + RUBY_EXTERN const char ruby_version[]; + RUBY_EXTERN const char ruby_release_date[]; diff -urN ruby18.orig/files/patch-800_delegate.rb ruby18/files/patch-800_delegate.rb --- ruby18.orig/files/patch-800_delegate.rb Wed Dec 31 19:00:00 1969 +++ ruby18/files/patch-800_delegate.rb Tue Feb 22 16:52:00 2005 @@ -0,0 +1,25 @@ +Index: ./lib/delegate.rb +=================================================================== +RCS file: /src/ruby/lib/delegate.rb,v +retrieving revision 1.14.2.3 +diff -u -r1.14.2.3 delegate.rb +--- lib/delegate.rb 17 May 2004 07:18:29 -0000 1.14.2.3 ++++ lib/delegate.rb 25 May 2004 03:33:51 -0000 +@@ -38,7 +38,7 @@ + rescue Exception + $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #` + $@.delete_if{|s| /^\\(eval\\):/ =~ s} +- Kernel::raise ++ ::Kernel::raise + end + end + EOS +@@ -107,7 +107,7 @@ + } + for method in methods + begin +- klass.module_eval <<-EOS ++ klass.module_eval <<-EOS, __FILE__, __LINE__+1 + def #{method}(*args, &block) + begin + @_dc_obj.__send__(:#{method}, *args, &block) diff -urN ruby18.orig/files/patch-900_ri_pager ruby18/files/patch-900_ri_pager --- ruby18.orig/files/patch-900_ri_pager Wed Dec 31 19:00:00 1969 +++ ruby18/files/patch-900_ri_pager Tue Feb 22 16:52:00 2005 @@ -0,0 +1,11 @@ +--- lib/rdoc/ri/ri_display.rb 12 Jan 2004 03:11:25 -0000 1.2 ++++ lib/rdoc/ri/ri_display.rb 17 Jan 2004 17:52:40 -0000 +@@ -211,7 +211,7 @@ + STDOUT.reopen(@save_stdout) + @save_stdout = nil + paged = false +- for pager in [ ENV['PAGER'], "less", "more <", 'pager' ].compact.uniq ++ for pager in [ ENV['PAGER'], 'pager', "less", "more <" ].compact.uniq + if system("#{pager} #{path}") + paged = true + break diff -urN ruby18.orig/pkg-plist ruby18/pkg-plist --- ruby18.orig/pkg-plist Fri Feb 4 23:59:24 2005 +++ ruby18/pkg-plist Tue Feb 22 16:52:00 2005 @@ -59,9 +59,9 @@ %%RUBY_ARCHLIBDIR%%/util.h %%RUBY_ARCHLIBDIR%%/version.h %%RUBY_ARCHLIBDIR%%/zlib.so -@dirrm %%RUBY_ARCHLIBDIR%%/digest -@dirrm %%RUBY_ARCHLIBDIR%%/io @dirrm %%RUBY_ARCHLIBDIR%%/racc +@dirrm %%RUBY_ARCHLIBDIR%%/io +@dirrm %%RUBY_ARCHLIBDIR%%/digest %%RUBYLIB%%%%RUBY_LIBDIR%%/English.rb %%RUBYLIB%%%%RUBY_LIBDIR%%/Env.rb %%RUBYLIB%%%%RUBY_LIBDIR%%/abbrev.rb @@ -643,7 +643,6 @@ %%RUBYLIB%%@dirrm %%RUBY_LIBDIR%%/cgi %%RUBYLIB%%@dirrm %%RUBY_LIBDIR%%/bigdecimal %%RUBYLIB%%@dirrm %%RUBY_LIBDIR%% -@unexec /bin/rmdir -p %D/lib/xemacs/site-lisp 2>/dev/null || true %%RUBY_ELISPDIR%%/.keep_me.%%RUBY_NAME%% @unexec /bin/rmdir %D/%%RUBY_ELISPDIR%% 2>/dev/null || true @unexec /bin/rmdir %D/lib/ruby 2>/dev/null || true @@ -1354,6 +1353,7 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/Enumerable/to_a-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Enumerable/to_set-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Enumerable/zip-i.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/Errno/EXDEV/cdesc-EXDEV.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Errno/cdesc-Errno.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Exception/backtrace-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Exception/cdesc-Exception.yaml @@ -1500,16 +1500,7 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/FileTest/writable%3f-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileTest/writable_real%3f-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileTest/zero%3f-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/_copy_content-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/_copy_entry-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/cdesc-CopyContext_.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/chmod-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/chown-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/copy_content-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/copy_entry-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/new-c.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/preserve-i.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/CopyContext_/stat-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/DryRun/cdesc-DryRun.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/NoWrite/cdesc-NoWrite.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/Verbose/cdesc-Verbose.yaml @@ -1532,9 +1523,11 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_each_src_dest-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_each_src_dest0-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_list-i.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_lstat-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_mkdir-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_output_message-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_same%3f-i.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_stat-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_stream_blksize-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/fu_update_option-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/FileUtils/getwd-i.yaml @@ -1741,6 +1734,7 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/IO/readline-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/IO/readlines-c.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/IO/readlines-i.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/IO/readpartial-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/IO/reopen-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/IO/rewind-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/IO/seek-i.yaml @@ -2838,6 +2832,7 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/Time/year-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Time/zone-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Time/zone_offset-c.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/Time/zone_utc%3f-c.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/TimeExtentionTest/cdesc-TimeExtentionTest.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/TrueClass/%26-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/TrueClass/%5e-i.yaml @@ -2906,10 +2901,10 @@ %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/DataError/cdesc-DataError.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/%3c%3c-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/cdesc-Deflate.yaml -%%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/clone-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/deflate-c.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/deflate-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/flush-i.yaml +%%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/initialize_copy-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/new-c.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/params-i.yaml %%PORTDOCS%%%%RUBY_RIDIR%%/Zlib/Deflate/set_dictionary-i.yaml @@ -3129,6 +3124,7 @@ %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/FalseClass %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/ExceptionForMatrix %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/Exception +%%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/Errno/EXDEV %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/Errno %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/Enumerable %%PORTDOCS%%@dirrm %%RUBY_RIDIR%%/EOFError
Attributes