aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Mk/bsd.ruby.mk4
-rw-r--r--devel/oniguruma/Makefile5
-rw-r--r--devel/oniguruma/distinfo6
-rw-r--r--lang/ruby18/Makefile5
-rw-r--r--lang/ruby18/distinfo6
-rw-r--r--lang/ruby18/files/extrapatch-oniguruma-reggnu.c140
-rw-r--r--lang/ruby18/files/patch-array.c68
-rw-r--r--lang/ruby18/files/patch-bignum.c12
-rw-r--r--lang/ruby18/files/patch-intern.h10
-rw-r--r--lang/ruby18/files/patch-lib_webrick_httpservlet_filehandler.rb51
-rw-r--r--lang/ruby18/files/patch-parse.c19
-rw-r--r--lang/ruby18/files/patch-regex.c14
-rw-r--r--lang/ruby18/files/patch-rexml-update345
-rw-r--r--lang/ruby18/files/patch-sprintf.c28
-rw-r--r--lang/ruby18/files/patch-string.c137
-rw-r--r--lang/ruby18/pkg-plist1
16 files changed, 157 insertions, 694 deletions
diff --git a/Mk/bsd.ruby.mk b/Mk/bsd.ruby.mk
index 88395660e4bf..c8c2af1c0583 100644
--- a/Mk/bsd.ruby.mk
+++ b/Mk/bsd.ruby.mk
@@ -167,9 +167,9 @@ RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
# Ruby 1.8
#
RUBY_RELVERSION= 1.8.6
-RUBY_PORTREVISION= 5
+RUBY_PORTREVISION= 0
RUBY_PORTEPOCH= 1
-RUBY_PATCHLEVEL= 111
+RUBY_PATCHLEVEL= 287
. if ${RUBY_PATCHLEVEL} == 0
RUBY_VERSION?= ${RUBY_RELVERSION}
diff --git a/devel/oniguruma/Makefile b/devel/oniguruma/Makefile
index effc12284a88..604305e857ce 100644
--- a/devel/oniguruma/Makefile
+++ b/devel/oniguruma/Makefile
@@ -11,7 +11,7 @@ CATEGORIES= devel textproc
MASTER_SITES= http://www.geocities.jp/kosako3/oniguruma/archive/:onig \
ftp://ftp.SpringDaemons.com/dustheap/:ruby186
DISTFILES= onigd${PORTVERSION:S/./_/g}${EXTRACT_SUFX}:onig \
- ruby186.patch:ruby186
+ ruby186p286-oniguruma.patch:ruby186
DIST_SUBDIR= ruby
EXTRACT_ONLY= onigd${PORTVERSION:S/./_/g}${EXTRACT_SUFX}
@@ -28,7 +28,8 @@ GNU_CONFIGURE= yes
DOCS= HISTORY README doc/*
post-patch:
- ${CP} ${DISTDIR}/${DIST_SUBDIR}/ruby186.patch ${WRKSRC}/
+ ${CP} ${DISTDIR}/${DIST_SUBDIR}/ruby186p286-oniguruma.patch \
+ ${WRKSRC}/ruby186.patch
post-configure:
${SED} -e 's|%%PREFIX%%|${PREFIX}|' \
diff --git a/devel/oniguruma/distinfo b/devel/oniguruma/distinfo
index 19287c0a492d..fd3ce5c94efd 100644
--- a/devel/oniguruma/distinfo
+++ b/devel/oniguruma/distinfo
@@ -1,6 +1,6 @@
MD5 (ruby/onigd2_5_8.tar.gz) = 82cd47ded85f854149ae620a9fa728e5
SHA256 (ruby/onigd2_5_8.tar.gz) = 11aa092d7cb1c21b7fb60980e9c5a9b931e670c29553ea9444927a8a468e526b
SIZE (ruby/onigd2_5_8.tar.gz) = 218187
-MD5 (ruby/ruby186.patch) = 07b39a49b4339db6ce6d57822ccff901
-SHA256 (ruby/ruby186.patch) = 11b4fc0138edb43425649c10cde5e3c712c8d65c7b9ab52daca09d47a020f803
-SIZE (ruby/ruby186.patch) = 8434
+MD5 (ruby/ruby186p286-oniguruma.patch) = 6977973cc379f60eceb875989f9c7b27
+SHA256 (ruby/ruby186p286-oniguruma.patch) = b02e4b61237eeb11d4c9e84cb214bf138fbd51bacab1ab541c8ded4c008508c2
+SIZE (ruby/ruby186p286-oniguruma.patch) = 8574
diff --git a/lang/ruby18/Makefile b/lang/ruby18/Makefile
index 832ff9d51312..9a3c2055ec6b 100644
--- a/lang/ruby18/Makefile
+++ b/lang/ruby18/Makefile
@@ -170,6 +170,11 @@ pre-configure:
.endif
${TOUCH} ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT}
+post-configure:
+.if defined(WITH_ONIGURUMA)
+ cd ${WRKSRC}/ && ${PATCH} -p0 < ${PATCHDIR}/extrapatch-oniguruma-reggnu.c
+.endif
+
post-build:
#
# Hack to allow modules to be installed into separate PREFIX and/or under user
diff --git a/lang/ruby18/distinfo b/lang/ruby18/distinfo
index 3e98b59f2198..d861dfd5c7ac 100644
--- a/lang/ruby18/distinfo
+++ b/lang/ruby18/distinfo
@@ -1,3 +1,3 @@
-MD5 (ruby/ruby-1.8.6-p111.tar.bz2) = e1d38b7d4f1be55726d6927a3395ce3b
-SHA256 (ruby/ruby-1.8.6-p111.tar.bz2) = 85c694678313818a5083bcfd66ae389fc053b506d93b5ad46f3764981c120fbb
-SIZE (ruby/ruby-1.8.6-p111.tar.bz2) = 3919396
+MD5 (ruby/ruby-1.8.6-p287.tar.bz2) = 80b5f3db12531d36e6c81fac6d05dda9
+SHA256 (ruby/ruby-1.8.6-p287.tar.bz2) = ac15a1cb78c50ec9cc7e831616a143586bdd566bc865c6b769a0c47b3b3936ce
+SIZE (ruby/ruby-1.8.6-p287.tar.bz2) = 3956902
diff --git a/lang/ruby18/files/extrapatch-oniguruma-reggnu.c b/lang/ruby18/files/extrapatch-oniguruma-reggnu.c
new file mode 100644
index 000000000000..8d09202dbe27
--- /dev/null
+++ b/lang/ruby18/files/extrapatch-oniguruma-reggnu.c
@@ -0,0 +1,140 @@
+--- reggnu.c.orig 2008-08-15 20:48:50.000000000 +0400
++++ reggnu.c 2008-08-15 20:49:03.000000000 +0400
+@@ -254,3 +254,137 @@
+ }
+ #endif
+ }
++typedef unsigned int (*mbc_startpos_func_t) _((const char *string, unsigned int pos));
++
++static unsigned int asc_startpos _((const char *string, unsigned int pos));
++static unsigned int euc_startpos _((const char *string, unsigned int pos));
++static unsigned int sjis_startpos _((const char *string, unsigned int pos));
++static unsigned int utf8_startpos _((const char *string, unsigned int pos));
++
++/* adjust startpos value to the position between characters. */
++int
++re_mbc_startpos(string, size, startpos, range)
++ const char *string;
++ int size, startpos, range;
++{
++ OnigEncoding current_enc = onigenc_get_default_encoding();
++ int i;
++
++ if (current_enc == ONIG_ENCODING_ASCII)
++ i = asc_startpos(string, startpos);
++ else if (current_enc == ONIG_ENCODING_EUC_JP)
++ i = euc_startpos(string, startpos);
++ else if (current_enc == ONIG_ENCODING_SJIS)
++ i = sjis_startpos(string, startpos);
++ else if (current_enc == ONIG_ENCODING_UTF8)
++ i = utf8_startpos(string, startpos);
++ else
++ return (-1);
++
++ if (i < startpos) {
++ if (range > 0) {
++ startpos = i + mbclen(string[i]);
++ }
++ else {
++ int len = mbclen(string[i]);
++ if (i + len <= startpos)
++ startpos = i + len;
++ else
++ startpos = i;
++ }
++ }
++ return startpos;
++}
++
++#define mbc_isfirst(t, c) (t)[(unsigned char)(c)]
++#define mbc_len(t, c) ((t)[(unsigned char)(c)]+1)
++
++static unsigned int
++asc_startpos(string, pos)
++ const char *string;
++ unsigned int pos;
++{
++ return pos;
++}
++
++#define euc_islead(c) ((unsigned char)((c) - 0xa1) > 0xfe - 0xa1)
++#define euc_mbclen(c) mbc_len(mbctab_euc, (c))
++static unsigned int
++euc_startpos(string, pos)
++ const char *string;
++ unsigned int pos;
++{
++ unsigned int i = pos, w;
++
++ while (i > 0 && !euc_islead(string[i])) {
++ --i;
++ }
++ if (i == pos || i + (w = euc_mbclen(string[i])) > pos) {
++ return i;
++ }
++ i += w;
++ return i + ((pos - i) & ~1);
++}
++
++static const unsigned char mbctab_sjis_trail[] = { /* 0x40-0x7E,0x80-0xFC */
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0
++};
++
++#define sjis_isfirst(c) mbc_isfirst(mbctab_sjis, (c))
++#define sjis_istrail(c) mbctab_sjis_trail[(unsigned char)(c)]
++#define sjis_mbclen(c) mbc_len(mbctab_sjis, (c))
++static unsigned int
++sjis_startpos(string, pos)
++ const char *string;
++ unsigned int pos;
++{
++ unsigned int i = pos, w;
++
++ if (i > 0 && sjis_istrail(string[i])) {
++ do {
++ if (!sjis_isfirst(string[--i])) {
++ ++i;
++ break;
++ }
++ } while (i > 0);
++ }
++ if (i == pos || i + (w = sjis_mbclen(string[i])) > pos) {
++ return i;
++ }
++ i += w;
++ return i + ((pos - i) & ~1);
++}
++
++#define utf8_islead(c) ((unsigned char)((c) & 0xc0) != 0x80)
++#define utf8_mbclen(c) mbc_len(mbctab_utf8, (c))
++static unsigned int
++utf8_startpos(string, pos)
++ const char *string;
++ unsigned int pos;
++{
++ unsigned int i = pos, w;
++
++ while (i > 0 && !utf8_islead(string[i])) {
++ --i;
++ }
++ if (i == pos || i + (w = utf8_mbclen(string[i])) > pos) {
++ return i;
++ }
++ return i + w;
++}
++#undef utf8_islead
diff --git a/lang/ruby18/files/patch-array.c b/lang/ruby18/files/patch-array.c
deleted file mode 100644
index d585bd70b7c1..000000000000
--- a/lang/ruby18/files/patch-array.c
+++ /dev/null
@@ -1,68 +0,0 @@
---- array.c.orig 2008-06-21 12:28:01.000000000 +0400
-+++ array.c 2008-06-21 12:37:24.000000000 +0400
-@@ -20,6 +20,7 @@
- static ID id_cmp;
-
- #define ARY_DEFAULT_SIZE 16
-+#define ARY_MAX_SIZE (LONG_MAX / sizeof(VALUE))
-
- void
- rb_mem_clear(mem, size)
-@@ -120,7 +121,7 @@
- if (len < 0) {
- rb_raise(rb_eArgError, "negative array size (or size too big)");
- }
-- if (len > 0 && len * sizeof(VALUE) <= len) {
-+ if (len > ARY_MAX_SIZE) {
- rb_raise(rb_eArgError, "array size too big");
- }
- if (len == 0) len++;
-@@ -293,7 +294,7 @@
- if (len < 0) {
- rb_raise(rb_eArgError, "negative array size");
- }
-- if (len > 0 && len * (long)sizeof(VALUE) <= len) {
-+ if (len > ARY_MAX_SIZE) {
- rb_raise(rb_eArgError, "array size too big");
- }
- if (len > RARRAY(ary)->aux.capa) {
-@@ -359,6 +360,10 @@
- }
- }
-
-+ if (idx >= ARY_MAX_SIZE) {
-+ rb_raise(rb_eIndexError, "index %ld too big", idx);
-+ }
-+
- rb_ary_modify(ary);
- if (idx >= RARRAY(ary)->aux.capa) {
- long new_capa = RARRAY(ary)->aux.capa / 2;
-@@ -366,6 +371,9 @@
- if (new_capa < ARY_DEFAULT_SIZE) {
- new_capa = ARY_DEFAULT_SIZE;
- }
-+ if (new_capa >= ARY_MAX_SIZE - idx) {
-+ new_capa = (ARY_MAX_SIZE - idx) / 2;
-+ }
- new_capa += idx;
- if (new_capa * (long)sizeof(VALUE) <= new_capa) {
- rb_raise(rb_eArgError, "index too big");
-@@ -975,6 +983,9 @@
- rb_ary_modify(ary);
-
- if (beg >= RARRAY(ary)->len) {
-+ if (beg > ARY_MAX_SIZE - rlen) {
-+ rb_raise(rb_eIndexError, "index %ld too big", beg);
-+ }
- len = beg + rlen;
- if (len >= RARRAY(ary)->aux.capa) {
- REALLOC_N(RARRAY(ary)->ptr, VALUE, len);
-@@ -2378,7 +2389,7 @@
- if (len < 0) {
- rb_raise(rb_eArgError, "negative argument");
- }
-- if (LONG_MAX/len < RARRAY(ary)->len) {
-+ if (ARY_MAX_SIZE/len < RARRAY(ary)->len) {
- rb_raise(rb_eArgError, "argument too big");
- }
- len *= RARRAY(ary)->len;
diff --git a/lang/ruby18/files/patch-bignum.c b/lang/ruby18/files/patch-bignum.c
deleted file mode 100644
index 6bb648daf0b3..000000000000
--- a/lang/ruby18/files/patch-bignum.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- bignum.c.orig 2007-09-19 06:13:21.000000000 +0400
-+++ bignum.c 2008-06-26 01:54:38.000000000 +0400
-@@ -652,6 +652,9 @@
- if (BIGZEROP(x)) {
- return rb_str_new2("0");
- }
-+ if (i >= LONG_MAX/SIZEOF_BDIGITS/CHAR_BIT) {
-+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
-+ }
- j = SIZEOF_BDIGITS*CHAR_BIT*i;
- switch (base) {
- case 2: break;
diff --git a/lang/ruby18/files/patch-intern.h b/lang/ruby18/files/patch-intern.h
deleted file mode 100644
index 02bb9ff09ba1..000000000000
--- a/lang/ruby18/files/patch-intern.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- intern.h.orig 2008-06-21 12:49:23.000000000 +0400
-+++ intern.h 2008-06-21 12:49:29.000000000 +0400
-@@ -400,6 +400,7 @@
- void ruby_default_signal _((int));
- /* sprintf.c */
- VALUE rb_f_sprintf _((int, VALUE*));
-+VALUE rb_str_format _((int, VALUE*, VALUE));
- /* string.c */
- VALUE rb_str_new _((const char*, long));
- VALUE rb_str_new2 _((const char*));
diff --git a/lang/ruby18/files/patch-lib_webrick_httpservlet_filehandler.rb b/lang/ruby18/files/patch-lib_webrick_httpservlet_filehandler.rb
deleted file mode 100644
index e993320bad3b..000000000000
--- a/lang/ruby18/files/patch-lib_webrick_httpservlet_filehandler.rb
+++ /dev/null
@@ -1,51 +0,0 @@
---- lib/webrick/httpservlet/filehandler.rb 2007-02-13 02:01:19.000000000 +0300
-+++ lib/webrick/httpservlet/filehandler.rb 2008-03-03 17:36:04.000000000 +0300
-@@ -163,6 +163,7 @@
- end
- end
- end
-+ prevent_directory_traversal(req, res)
- super(req, res)
- end
-
-@@ -198,6 +199,22 @@
-
- private
-
-+ def prevent_directory_traversal(req, res)
-+ # Preventing directory traversal on DOSISH platforms;
-+ # Backslashes (0x5c) in path_info are not interpreted as special
-+ # character in URI notation. So the value of path_info should be
-+ # normalize before accessing to the filesystem.
-+ if File::ALT_SEPARATOR
-+ # File.expand_path removes the trailing path separator.
-+ # Adding a character is a workaround to save it.
-+ # File.expand_path("/aaa/") #=> "/aaa"
-+ # File.expand_path("/aaa/" + "x") #=> "/aaa/x"
-+ expanded = File.expand_path(req.path_info + "x")
-+ expanded[-1, 1] = "" # remove trailing "x"
-+ req.path_info = expanded
-+ end
-+ end
-+
- def exec_handler(req, res)
- raise HTTPStatus::NotFound, "`#{req.path}' not found" unless @root
- if set_filename(req, res)
-@@ -256,7 +273,7 @@
-
- def check_filename(req, res, name)
- @options[:NondisclosureName].each{|pattern|
-- if File.fnmatch("/#{pattern}", name)
-+ if File.fnmatch("/#{pattern}", name, File::FNM_CASEFOLD)
- @logger.warn("the request refers nondisclosure name `#{name}'.")
- raise HTTPStatus::NotFound, "`#{req.path}' not found."
- end
-@@ -310,7 +327,7 @@
-
- def nondisclosure_name?(name)
- @options[:NondisclosureName].each{|pattern|
-- if File.fnmatch(pattern, name)
-+ if File.fnmatch(pattern, name, File::FNM_CASEFOLD)
- return true
- end
- }
diff --git a/lang/ruby18/files/patch-parse.c b/lang/ruby18/files/patch-parse.c
deleted file mode 100644
index ae35f9f316ac..000000000000
--- a/lang/ruby18/files/patch-parse.c
+++ /dev/null
@@ -1,19 +0,0 @@
---- parse.c.orig 2008-06-26 01:19:07.000000000 +0400
-+++ parse.c 2008-06-26 01:20:12.000000000 +0400
-@@ -10705,7 +10705,7 @@
- rb_mem_clear(vars+i, len-i);
- }
- else {
-- *vars++ = (VALUE)ruby_scope;
-+ *vars++ = 0;
- rb_mem_clear(vars, len);
- }
- ruby_scope->local_vars = vars;
-@@ -10721,6 +10721,7 @@
- if (!(ruby_scope->flags & SCOPE_CLONE))
- xfree(ruby_scope->local_tbl);
- }
-+ ruby_scope->local_vars[-1] = 0; /* no reference needed */
- ruby_scope->local_tbl = local_tbl();
- }
- }
diff --git a/lang/ruby18/files/patch-regex.c b/lang/ruby18/files/patch-regex.c
deleted file mode 100644
index 16451e45807e..000000000000
--- a/lang/ruby18/files/patch-regex.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- regex.c.orig 2008-06-26 01:17:14.000000000 +0400
-+++ regex.c 2008-06-26 01:18:42.000000000 +0400
-@@ -3169,6 +3169,11 @@
- if (startpos < 0 || startpos > size)
- return -1;
-
-+ if (!string) {
-+ if (size == 0) string = "";
-+ else return -1;
-+ }
-+
- /* Update the fastmap now if not correct already. */
- if (fastmap && !bufp->fastmap_accurate) {
- re_compile_fastmap(bufp);
diff --git a/lang/ruby18/files/patch-rexml-update b/lang/ruby18/files/patch-rexml-update
deleted file mode 100644
index 2b0e31143d49..000000000000
--- a/lang/ruby18/files/patch-rexml-update
+++ /dev/null
@@ -1,345 +0,0 @@
-diff -ruN ruby-1.8.6-p111/lib/rexml/attribute.rb ruby-1.8.6-p114/lib/rexml/attribute.rb
---- lib/rexml/attribute.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/attribute.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -50,7 +50,7 @@
- @element = first.element
- end
- elsif first.kind_of? String
-- @element = parent if parent.kind_of? Element
-+ @element = parent
- self.name = first
- @normalized = second.to_s
- else
-diff -ruN ruby-1.8.6-p111/lib/rexml/document.rb ruby-1.8.6-p114/lib/rexml/document.rb
---- lib/rexml/document.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/document.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -66,6 +66,7 @@
- def add( child )
- if child.kind_of? XMLDecl
- @children.unshift child
-+ child.parent = self
- elsif child.kind_of? DocType
- # Find first Element or DocType node and insert the decl right
- # before it. If there is no such node, just insert the child at the
-@@ -183,7 +184,7 @@
- output = Output.new( output, xml_decl.encoding )
- end
- formatter = if indent > -1
-- if transitive
-+ if trans
- REXML::Formatters::Transitive.new( indent, ie_hack )
- else
- REXML::Formatters::Pretty.new( indent, ie_hack )
-diff -ruN ruby-1.8.6-p111/lib/rexml/element.rb ruby-1.8.6-p114/lib/rexml/element.rb
---- lib/rexml/element.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/element.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -553,6 +553,7 @@
- def attribute( name, namespace=nil )
- prefix = nil
- prefix = namespaces.index(namespace) if namespace
-+ prefix = nil if prefix == 'xmlns'
- attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" )
- end
-
-@@ -854,15 +855,15 @@
- # Source (see Element.initialize). If not supplied or nil, a
- # new, default Element will be constructed
- # Returns:: the added Element
-- # a = Element.new 'a'
-- # a.elements.add Element.new 'b' #-> <a><b/></a>
-- # a.elements.add 'c' #-> <a><b/><c/></a>
-+ # a = Element.new('a')
-+ # a.elements.add(Element.new('b')) #-> <a><b/></a>
-+ # a.elements.add('c') #-> <a><b/><c/></a>
- def add element=nil
- rv = nil
- if element.nil?
-- Element.new "", self, @element.context
-+ Element.new("", self, @element.context)
- elsif not element.kind_of?(Element)
-- Element.new element, self, @element.context
-+ Element.new(element, self, @element.context)
- else
- @element << element
- element.context = @element.context
-diff -ruN ruby-1.8.6-p111/lib/rexml/encoding.rb ruby-1.8.6-p114/lib/rexml/encoding.rb
---- lib/rexml/encoding.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/encoding.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -56,8 +56,13 @@
-
- def check_encoding str
- # We have to recognize UTF-16, LSB UTF-16, and UTF-8
-- return UTF_16 if /\A\xfe\xff/n =~ str
-- return UNILE if /\A\xff\xfe/n =~ str
-+ if str[0] == 0xfe && str[1] == 0xff
-+ str[0,2] = ""
-+ return UTF_16
-+ elsif str[0] == 0xff && str[1] == 0xfe
-+ str[0,2] = ""
-+ return UNILE
-+ end
- str =~ /^\s*<\?xml\s+version\s*=\s*(['"]).*?\1\s+encoding\s*=\s*(["'])(.*?)\2/um
- return $3.upcase if $3
- return UTF_8
-diff -ruN ruby-1.8.6-p111/lib/rexml/parsers/baseparser.rb ruby-1.8.6-p114/lib/rexml/parsers/baseparser.rb
---- lib/rexml/parsers/baseparser.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/parsers/baseparser.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -1,5 +1,7 @@
- require 'rexml/parseexception'
-+require 'rexml/undefinednamespaceexception'
- require 'rexml/source'
-+require 'set'
-
- module REXML
- module Parsers
-@@ -24,7 +26,8 @@
- # Nat Price gave me some good ideas for the API.
- class BaseParser
- NCNAME_STR= '[\w:][\-\w\d.]*'
-- NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
-+ NAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})"
-+ UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
-
- NAMECHAR = '[\-\w\d\.:]'
- NAME = "([\\w:]#{NAMECHAR}*)"
-@@ -35,7 +38,7 @@
-
- DOCTYPE_START = /\A\s*<!DOCTYPE\s/um
- DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/um
-- ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um
-+ ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\4/um
- COMMENT_START = /\A<!--/u
- COMMENT_PATTERN = /<!--(.*?)-->/um
- CDATA_START = /\A<!\[CDATA\[/u
-@@ -45,7 +48,7 @@
- XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um
- INSTRUCTION_START = /\A<\?/u
- INSTRUCTION_PATTERN = /<\?(.*?)(\s+.*?)?\?>/um
-- TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{NAME_STR}\s*=\s*(["']).*?\3)*)\s*(\/)?>/um
-+ TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{UNAME_STR}\s*=\s*(["']).*?\5)*)\s*(\/)?>/um
- CLOSE_MATCH = /^\s*<\/(#{NAME_STR})\s*>/um
-
- VERSION = /\bversion\s*=\s*["'](.*?)['"]/um
-@@ -133,6 +136,7 @@
- @tags = []
- @stack = []
- @entities = []
-+ @nsstack = []
- end
-
- def position
-@@ -188,6 +192,7 @@
- end
- return [ :end_document ] if empty?
- return @stack.shift if @stack.size > 0
-+ #STDERR.puts @source.encoding
- @source.read if @source.buffer.size<2
- #STDERR.puts "BUFFER = #{@source.buffer.inspect}"
- if @document_status == nil
-@@ -213,6 +218,7 @@
- return [ :processing_instruction, *@source.match(INSTRUCTION_PATTERN, true)[1,2] ]
- when DOCTYPE_START
- md = @source.match( DOCTYPE_PATTERN, true )
-+ @nsstack.unshift(curr_ns=Set.new)
- identity = md[1]
- close = md[2]
- identity =~ IDENTITY
-@@ -288,6 +294,9 @@
- val = attdef[3]
- val = attdef[4] if val == "#FIXED "
- pairs[attdef[0]] = val
-+ if attdef[0] =~ /^xmlns:(.*)/
-+ @nsstack[0] << $1
-+ end
- end
- end
- return [ :attlistdecl, element, pairs, contents ]
-@@ -312,6 +321,7 @@
- begin
- if @source.buffer[0] == ?<
- if @source.buffer[1] == ?/
-+ @nsstack.shift
- last_tag = @tags.pop
- #md = @source.match_to_consume( '>', CLOSE_MATCH)
- md = @source.match( CLOSE_MATCH, true )
-@@ -345,19 +355,47 @@
- raise REXML::ParseException.new("missing attribute quote", @source) if @source.match(MISSING_ATTRIBUTE_QUOTES )
- raise REXML::ParseException.new("malformed XML: missing tag start", @source)
- end
-- attrs = []
-- if md[2].size > 0
-- attrs = md[2].scan( ATTRIBUTE_PATTERN )
-+ attributes = {}
-+ prefixes = Set.new
-+ prefixes << md[2] if md[2]
-+ @nsstack.unshift(curr_ns=Set.new)
-+ if md[4].size > 0
-+ attrs = md[4].scan( ATTRIBUTE_PATTERN )
- raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0
-+ attrs.each { |a,b,c,d,e|
-+ if b == "xmlns"
-+ if c == "xml"
-+ if d != "http://www.w3.org/XML/1998/namespace"
-+ msg = "The 'xml' prefix must not be bound to any other namespace "+
-+ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
-+ raise REXML::ParseException.new( msg, @source, self )
-+ end
-+ elsif c == "xmlns"
-+ msg = "The 'xmlns' prefix must not be declared "+
-+ "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
-+ raise REXML::ParseException.new( msg, @source, self)
-+ end
-+ curr_ns << c
-+ elsif b
-+ prefixes << b unless b == "xml"
-+ end
-+ attributes[a] = e
-+ }
- end
-
-- if md[4]
-+ # Verify that all of the prefixes have been defined
-+ for prefix in prefixes
-+ unless @nsstack.find{|k| k.member?(prefix)}
-+ raise UndefinedNamespaceException.new(prefix,@source,self)
-+ end
-+ end
-+
-+ if md[6]
- @closed = md[1]
-+ @nsstack.shift
- else
- @tags.push( md[1] )
- end
-- attributes = {}
-- attrs.each { |a,b,c| attributes[a] = c }
- return [ :start_element, md[1], attributes ]
- end
- else
-@@ -371,6 +409,8 @@
- # return PullEvent.new( :text, md[1], unnormalized )
- return [ :text, md[1] ]
- end
-+ rescue REXML::UndefinedNamespaceException
-+ raise
- rescue REXML::ParseException
- raise
- rescue Exception, NameError => error
-diff -ruN ruby-1.8.6-p111/lib/rexml/parsers/treeparser.rb ruby-1.8.6-p114/lib/rexml/parsers/treeparser.rb
---- lib/rexml/parsers/treeparser.rb 2007-02-13 02:01:19.000000000 +0300
-+++ lib/rexml/parsers/treeparser.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -1,4 +1,5 @@
- require 'rexml/validation/validationexception'
-+require 'rexml/undefinednamespaceexception'
-
- module REXML
- module Parsers
-@@ -29,8 +30,7 @@
- return
- when :start_element
- tag_stack.push(event[1])
-- # find the observers for namespaces
-- @build_context = @build_context.add_element( event[1], event[2] )
-+ el = @build_context = @build_context.add_element( event[1], event[2] )
- when :end_element
- tag_stack.pop
- @build_context = @build_context.parent
-@@ -86,6 +86,8 @@
- end
- rescue REXML::Validation::ValidationException
- raise
-+ rescue REXML::UndefinedNamespaceException
-+ raise
- rescue
- raise ParseException.new( $!.message, @parser.source, @parser, $! )
- end
-diff -ruN ruby-1.8.6-p111/lib/rexml/rexml.rb ruby-1.8.6-p114/lib/rexml/rexml.rb
---- lib/rexml/rexml.rb 2007-07-28 17:24:46.000000000 +0400
-+++ lib/rexml/rexml.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -1,3 +1,4 @@
-+# -*- encoding: utf-8 -*-
- # REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby.
- #
- # REXML is a _pure_ Ruby, XML 1.0 conforming,
-@@ -10,8 +11,9 @@
- #
- # Main page:: http://www.germane-software.com/software/rexml
- # Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom>
--# Version:: 3.1.7.1
--# Date:: 2007/209
-+# Version:: 3.1.7.2
-+# Date:: 2007/275
-+# Revision:: $Revision: 13815 $
- #
- # This API documentation can be downloaded from the REXML home page, or can
- # be accessed online[http://www.germane-software.com/software/rexml_doc]
-@@ -20,10 +22,10 @@
- # or can be accessed
- # online[http://www.germane-software.com/software/rexml/docs/tutorial.html]
- module REXML
-- COPYRIGHT = "Copyright © 2001-2007 Sean Russell <ser@germane-software.com>"
-- DATE = "2007/209"
-- VERSION = "3.1.7.1"
-- REVISION = "$Revision: 1270$".gsub(/\$Revision:|\$/,'').strip
-+ COPYRIGHT = "Copyright \xC2\xA9 2001-2006 Sean Russell <ser@germane-software.com>"
-+ VERSION = "3.1.7.2"
-+ DATE = "2007/275"
-+ REVISION = "$Revision: 13815 $".gsub(/\$Revision:|\$/,'').strip
-
- Copyright = COPYRIGHT
- Version = VERSION
-diff -ruN ruby-1.8.6-p111/lib/rexml/source.rb ruby-1.8.6-p114/lib/rexml/source.rb
---- lib/rexml/source.rb 2007-07-28 06:46:08.000000000 +0400
-+++ lib/rexml/source.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -17,8 +17,8 @@
- elsif arg.kind_of? Source
- arg
- else
-- raise "#{source.class} is not a valid input stream. It must walk \n"+
-- "like either a String, IO, or Source."
-+ raise "#{arg.class} is not a valid input stream. It must walk \n"+
-+ "like either a String, an IO, or a Source."
- end
- end
- end
-@@ -134,6 +134,7 @@
- def initialize(arg, block_size=500, encoding=nil)
- @er_source = @source = arg
- @to_utf = false
-+
- # Determining the encoding is a deceptively difficult issue to resolve.
- # First, we check the first two bytes for UTF-16. Then we
- # assume that the encoding is at least ASCII enough for the '>', and
-@@ -145,13 +146,16 @@
- str = @source.read( 2 )
- if encoding
- self.encoding = encoding
-- elsif /\A(?:\xfe\xff|\xff\xfe)/n =~ str
-- self.encoding = check_encoding( str )
-- elsif (0xef == str[0] && 0xbb == str[1])
-+ elsif 0xfe == str[0] && 0xff == str[1]
-+ @line_break = "\000>"
-+ elsif 0xff == str[0] && 0xfe == str[1]
-+ @line_break = ">\000"
-+ elsif 0xef == str[0] && 0xbb == str[1]
- str += @source.read(1)
- str = '' if (0xbf == str[2])
-+ @line_break = ">"
- else
-- @line_break = '>'
-+ @line_break = ">"
- end
- super str+@source.readline( @line_break )
- end
-diff -ruN ruby-1.8.6-p111/lib/rexml/undefinednamespaceexception.rb ruby-1.8.6-p114/lib/rexml/undefinednamespaceexception.rb
---- lib/rexml/undefinednamespaceexception.rb 1970-01-01 03:00:00.000000000 +0300
-+++ lib/rexml/undefinednamespaceexception.rb 2007-11-04 07:50:15.000000000 +0300
-@@ -0,0 +1,8 @@
-+require 'rexml/parseexception'
-+module REXML
-+ class UndefinedNamespaceException < ParseException
-+ def initialize( prefix, source, parser )
-+ super( "Undefined prefix #{prefix} found" )
-+ end
-+ end
-+end
diff --git a/lang/ruby18/files/patch-sprintf.c b/lang/ruby18/files/patch-sprintf.c
deleted file mode 100644
index 21d485558fcc..000000000000
--- a/lang/ruby18/files/patch-sprintf.c
+++ /dev/null
@@ -1,28 +0,0 @@
---- sprintf.c.orig 2008-06-21 12:50:30.000000000 +0400
-+++ sprintf.c 2008-06-21 12:50:46.000000000 +0400
-@@ -247,7 +247,15 @@
- int argc;
- VALUE *argv;
- {
-+ return rb_str_format(argc - 1, argv + 1, GETNTHARG(0));
-+}
-+
-+VALUE
-+rb_str_format(argc, argv, fmt)
-+ int argc;
-+ VALUE *argv;
- VALUE fmt;
-+{
- const char *p, *end;
- char *buf;
- int blen, bsiz;
-@@ -276,7 +284,8 @@
- rb_raise(rb_eArgError, "flag after precision"); \
- }
-
-- fmt = GETNTHARG(0);
-+ ++argc;
-+ --argv;
- if (OBJ_TAINTED(fmt)) tainted = 1;
- StringValue(fmt);
- fmt = rb_str_new4(fmt);
diff --git a/lang/ruby18/files/patch-string.c b/lang/ruby18/files/patch-string.c
deleted file mode 100644
index 8eb0e590daaf..000000000000
--- a/lang/ruby18/files/patch-string.c
+++ /dev/null
@@ -1,137 +0,0 @@
---- string.c.orig 2008-06-21 12:38:53.000000000 +0400
-+++ string.c 2008-06-21 12:49:20.000000000 +0400
-@@ -452,22 +452,16 @@
- */
-
- static VALUE
--rb_str_format(str, arg)
-+rb_str_format_m(str, arg)
- VALUE str, arg;
- {
-- VALUE *argv;
-+ VALUE tmp = rb_check_array_type(arg);
-
-- if (TYPE(arg) == T_ARRAY) {
-- argv = ALLOCA_N(VALUE, RARRAY(arg)->len + 1);
-- argv[0] = str;
-- MEMCPY(argv+1, RARRAY(arg)->ptr, VALUE, RARRAY(arg)->len);
-- return rb_f_sprintf(RARRAY(arg)->len+1, argv);
-+ if (!NIL_P(tmp)) {
-+ return rb_str_format(RARRAY_LEN(tmp), RARRAY_PTR(tmp), str);
- }
-
-- argv = ALLOCA_N(VALUE, 2);
-- argv[0] = str;
-- argv[1] = arg;
-- return rb_f_sprintf(2, argv);
-+ return rb_str_format(1, &arg, str);
- }
-
- static int
-@@ -694,18 +688,14 @@
- return str;
- }
-
--VALUE
--rb_str_buf_cat(str, ptr, len)
-+static VALUE
-+str_buf_cat(str, ptr, len)
- VALUE str;
- const char *ptr;
- long len;
- {
- long capa, total;
-
-- if (len == 0) return str;
-- if (len < 0) {
-- rb_raise(rb_eArgError, "negative string size (or size too big)");
-- }
- rb_str_modify(str);
- if (FL_TEST(str, STR_ASSOC)) {
- FL_UNSET(str, STR_ASSOC);
-@@ -714,9 +704,16 @@
- else {
- capa = RSTRING(str)->aux.capa;
- }
-+ if (RSTRING(str)->len >= LONG_MAX - len) {
-+ rb_raise(rb_eArgError, "string sizes too big");
-+ }
- total = RSTRING(str)->len+len;
- if (capa <= total) {
- while (total > capa) {
-+ if (capa + 1 >= LONG_MAX / 2) {
-+ capa = total;
-+ break;
-+ }
- capa = (capa + 1) * 2;
- }
- RESIZE_CAPA(str, capa);
-@@ -729,6 +726,19 @@
- }
-
- VALUE
-+rb_str_buf_cat(str, ptr, len)
-+ VALUE str;
-+ const char *ptr;
-+ long len;
-+{
-+ if (len == 0) return str;
-+ if (len < 0) {
-+ rb_raise(rb_eArgError, "negative string size (or size too big)");
-+ }
-+ return str_buf_cat(str, ptr, len);
-+}
-+
-+VALUE
- rb_str_buf_cat2(str, ptr)
- VALUE str;
- const char *ptr;
-@@ -747,7 +757,7 @@
- }
- if (FL_TEST(str, STR_ASSOC)) {
- rb_str_modify(str);
-- REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len+len);
-+ REALLOC_N(RSTRING(str)->ptr, char, RSTRING(str)->len+len+1);
- memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len);
- RSTRING(str)->len += len;
- RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; /* sentinel */
-@@ -769,29 +779,8 @@
- rb_str_buf_append(str, str2)
- VALUE str, str2;
- {
-- long capa, len;
--
-- rb_str_modify(str);
-- if (FL_TEST(str, STR_ASSOC)) {
-- FL_UNSET(str, STR_ASSOC);
-- capa = RSTRING(str)->aux.capa = RSTRING(str)->len;
-- }
-- else {
-- capa = RSTRING(str)->aux.capa;
-- }
-- len = RSTRING(str)->len+RSTRING(str2)->len;
-- if (capa <= len) {
-- while (len > capa) {
-- capa = (capa + 1) * 2;
-- }
-- RESIZE_CAPA(str, capa);
-- }
-- memcpy(RSTRING(str)->ptr + RSTRING(str)->len,
-- RSTRING(str2)->ptr, RSTRING(str2)->len);
-- RSTRING(str)->len += RSTRING(str2)->len;
-- RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; /* sentinel */
-+ str_buf_cat(str, RSTRING(str2)->ptr, RSTRING(str2)->len);
- OBJ_INFECT(str, str2);
--
- return str;
- }
-
-@@ -4657,7 +4646,7 @@
- rb_define_method(rb_cString, "casecmp", rb_str_casecmp, 1);
- rb_define_method(rb_cString, "+", rb_str_plus, 1);
- rb_define_method(rb_cString, "*", rb_str_times, 1);
-- rb_define_method(rb_cString, "%", rb_str_format, 1);
-+ rb_define_method(rb_cString, "%", rb_str_format_m, 1);
- rb_define_method(rb_cString, "[]", rb_str_aref_m, -1);
- rb_define_method(rb_cString, "[]=", rb_str_aset_m, -1);
- rb_define_method(rb_cString, "insert", rb_str_insert, 2);
diff --git a/lang/ruby18/pkg-plist b/lang/ruby18/pkg-plist
index ca90945b304e..704f411685fa 100644
--- a/lang/ruby18/pkg-plist
+++ b/lang/ruby18/pkg-plist
@@ -297,6 +297,7 @@ lib/lib%%RUBY_NAME%%.so.%%RUBY_SHLIBVER%%
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/etc.so
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/fcntl.so
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/intern.h
+%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/largefile.h
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/io/wait.so
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/missing.h
%%RUBY_LIBDIR%%/%%RUBY_ARCH%%/nkf.so